Forum.ArchosFans.com

Unofficial Archos Support Forum
It is currently Fri Dec 13, 2019 4:16 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 18 posts ] 
Author Message
 Post subject: Archos hack for dummies
PostPosted: Fri Jan 04, 2008 7:21 am 
Offline
Archos User
Archos User

Joined: Fri Oct 26, 2007 6:03 pm
Posts: 88
Location: orlando
This Thread is for people with little or no knowledge of Linux and would like to ask questions about scripting or looking for a place to start learning.Please post any questions, links to beginners guides, and advice.

Me myself am a nub, but i know i'm not alone. So i will be looking for tuts and posting them here

Everyday Linux Commands
http://www.freeos.com/articles/4414/

Linux How-tos
http://www.freeos.com/projdetails/1/3-13/

Linux Tutorial Basics
http://www.linux-tutorial.info/modules. ... t&pageid=7

Linux Tuts(a lot)
http://www.linuxplanet.com/linuxplanet/tutorials/

Getting Started with SSH
http://kimmo.suominen.com/docs/ssh/

http://cri.ch/linux/docs/sk0018.html

SSH Command help
http://www.ss64.com/bash/

Very Helpful Site for beginners in SSH
http://www.linuxcommand.org/


Top
   
 Post subject:
PostPosted: Fri Jan 04, 2008 2:49 pm 
Offline
Archos Guru
Archos Guru

Joined: Sat Jul 14, 2007 1:49 am
Posts: 285
Location: Scotland
thanks for this, i want to be able to help with the hack but i havent a clue what they are talking about, hopefully this will help.


Top
   
 Post subject:
PostPosted: Fri Jan 04, 2008 3:00 pm 
Offline
Archos Novice
Archos Novice

Joined: Sun Nov 18, 2007 2:55 am
Posts: 10
Great post...

This way we won't bother the serious job..


Top
   
 Post subject:
PostPosted: Fri Jan 04, 2008 3:15 pm 
Offline
Archos Novice
Archos Novice

Joined: Fri Jan 04, 2008 1:52 pm
Posts: 3
Thx :lol: :D


Top
   
 Post subject:
PostPosted: Fri Jan 04, 2008 5:13 pm 
Offline
Archos Guru
Archos Guru

Joined: Wed Nov 21, 2007 6:41 pm
Posts: 448
Archos Gen5 ToolChain HOWTO (See also http://code.google.com/p/arcwelder/wiki ... nvironment)

I'm using Fedora 8 Linux, the procedure is similar on other Linux distros but some commands may be different.

Get the Archos Generation 5 Source Code (190mb download) UPDATE: Direct Download for AX05_GPL.iso

It's an iso image, which can be burnt to cd or loop mounted as follows (we'll need to be root for this, so issue 'su -' command first)
Code:
su -
mkdir /mnt/ARCHOS_GPL
mount -o loop -t iso9660 path_to/AX05_GPL.iso /mnt/ARCHOS_GPL


Now change to a directory where you want the build directory created, and untar the whole package
Code:
tar xvf /mnt/ARCHOS_GPL/AX05_GPL.tar.bz2


Now we can change into the newly created AX05_GPL/ build directory and build the toolchain, but first we must ensure gnu development tools are installed, on Fedora you install via yum as follows
Code:
yum groupinstall "Development Tools"
yum install ncurses-devel


UPDATE: For fedora 12 you also need 'yum install docbook-utils-pdf', and edit two files to comment out some lines:

AX05_GPL/buildroot/target/checkdevs/checkdevs.c , line 584:
Code:
        //if (group) {
            gid = get_ug_id(group, my_getgrnam);
        //} else {
        //  gid = getgid();
        //}
        //if (user) {
            uid = get_ug_id(user, my_getpwnam);
        //} else {
        //  uid = getuid();
        //}


AX05_GPL/buildroot/target/makedevs/makedevs.c, line 427:
Code:
        //if (group) {
            gid = get_ug_id(group, my_getgrnam);
        //} else {
        //  gid = getgid();
        //}
        //if (user) {
            uid = get_ug_id(user, my_getpwnam);
        //} else {
        //  uid = getuid();
        //}


Now let's build the toolchain (You can read the brief AX05_GPL/README.txt for instructions also)

Code:
cd AX05_GPL/buildroot
cp configs/A605/defconfig .config
make sconfig


Now to do a test build, just type
Code:
make


And after half an hour or so on a 2Ghz core2 duo (~1hour on an atom netbook) the build will complete (to speed it up run make menuconfig first and in Build options select to run 2 jobs at a time rather than 1), and will create an archos root image and opt image in buildroot/, rootfs.arm_no_fpu.cramfs & optfs.arm_no_fpu.cramfs.

You can examine these images by loop mounting them and browsing the mountpoint dir as follows
Code:
mkdir /mnt/rootfs
mkdir /mnt/optfs
mount -o loop -t cramfs rootfs.arm_no_fpu.cramfs /mnt/rootfs
mount -o loop -t cramfs optfs.arm_no_fpu.cramfs /mnt/optfs
ls -l /mnt/rootfs
ls -l /mnt/optfs


The main direcories of interest are /bin, /sbin, /usr/bin and /usr/sbin in rootfs which contain the main linux binaries that run on the Archos (These binaries can be directly copied to /mnt/data/Data (the fat32 partition 30GB-160GB) on the A605 using a usb connection, and then you can execute them in an ssh session to the Archos by typing the full path) and /usr in optfs, which contains the apdf binary and opera fonts amongst other things
(NOTE that you can also copy the binaries directly from the relevant buildroot/build_arm_nofpu/<binary> directory)

Now, what we really want to do is create new apps, compile them and run them on the Archos.

Unfortunately, we are not able to create gui apps yet (patience, patience), so we can only compile command-line apps that run from an ssh console (This enables hackers to do a lot of neat stuff though, since the command line tools are very powerful)

To add new linux commands, type 'make menuconfig' instead of 'make', this will open up a graphical menu which allows you to select all sorts of neat stuff, select the 'Package Selection for the target' section - but beware, as explained by fiat, many of these are configured incorrectly so that the download urls don't work. You can have a go at editing the relevant .mk file in the packages/<package> directory as suggested. Stuff that works right away includes: gawk, bash, Python. Many basic linux commands are bundled into a single binary called 'busybox', that can be configured by changing to the buildroot/build_arm_nofpu/busybox-1.01 directory and typing 'make menuconfig', followed by 'make clean' & 'make' (all in the same directory)

Some further points:

Some of the apps require an extra library or suitable environment variables set on the Archos. Because the Archos root filesystem is read-only we have to set these manually

eg bash & nano require libncurses.so.5, I created a directory 'lib' in /mnt/data/Data on the Archos, copied the libncurses.so.5 there (from the /lib directory in rootfs.no_arm_fpu.cramfs) and then, (while in an ssh session) set the dynamic loader environment variable to point there
Code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/mnt/data/Data/lib


Python needs the python modules directory (copy the whole of /usr/lib/python2.4 to /mnt/data/Data/python2.4) and further env variables need to be set
Code:
export PYTHONHOME=/mnt/data/Data/python2.4
export PYTHONPATH=$PYTHONHOME:$PYTHONHOME/lib-dynload


If you create a directory 'bin' in /mnt/data/Data, and copy all the binaries there, then you can save having to type the full path by adding the directory to the PATH env
Code:
export PATH=$PATH:/mnt/data/Data/bin


All four of these export commands can be placed in a file (eg /mnt/data/Data/env.sh) and then all executed in one go each time you ssh to the archos using
Code:
. /mnt/data/Data/env.sh

(The '.' at the beginning of this command is important)


SO that's the basics - compiling command-line tools to enable further hacking. Eventually the toolchain will be configured to compile gui apps.
Some more advanced stuff involves mounting the optfs and rootfs partitions with write permissions, and also increasing the size of these partitions hugely.

Eventually we'd like a permanent mod of the Archos operating sytem, not just /mnt/data/Data. To do this we need to crack the flash card security, then modify the bootloader so it doesn't do cryptographic checks on the modded files - that looks almost impossible, but some very clever and determined peeps are making some progress (see the main thread)


Last edited by sideways on Mon Dec 14, 2009 5:04 pm, edited 11 times in total.

Top
   
 Post subject:
PostPosted: Fri Jan 04, 2008 6:13 pm 
Offline
Archos User
Archos User

Joined: Fri Oct 26, 2007 6:03 pm
Posts: 88
Location: orlando
Nice Post Sideways :)


Top
   
 Post subject:
PostPosted: Wed Jan 09, 2008 6:47 am 
Offline
Archos Novice
Archos Novice

Joined: Fri Dec 28, 2007 11:06 pm
Posts: 4
Nice Reply Sideways ... I was trying to read all 21 pages in the other topic and being not a big linux techie, could only read 4 pages in the last 2 days. Then I started reading from the last, unfortunately lost track of the story ... :p

But I'm excited about all this stuff. I was waiting for the Archos to get hacked to buy, but too impatient I bought a 604 wifi last week. When I got my piece in hand this thing is already hacked.

BTW just clarify this thing to me ... by SSH do you mean opening the shell through wifi or a shell on the archos display ?? If I go about this, will my regular apps continue to work ??


Top
   
 Post subject:
PostPosted: Wed Jan 09, 2008 10:34 pm 
Offline
Archos Guru
Archos Guru

Joined: Wed Nov 21, 2007 6:41 pm
Posts: 448
ksaravanakumar wrote:
BTW just clarify this thing to me ... by SSH do you mean opening the shell through wifi or a shell on the archos display ?? If I go about this, will my regular apps continue to work ??


Yup, ssh via wifi. It won't affect your archos apps at all (None of the current installs "hacks" will cause any problems). However if you start experimenting in the ssh session you need to be careful. Best to just use it to view directory contents, and to run simple custom apps.

The aim is to get a full alternative gui working (based on qtopia) which won't require ssh access.


Top
   
PostPosted: Sun Mar 07, 2010 12:48 pm 
Offline
Archos Guru
Archos Guru

Joined: Tue Dec 04, 2007 9:48 pm
Posts: 595
When running "make" I get the following error after a while.
BTW I am using Ubuntu 9.04 64 bit

Code:
In function ÔÇÿopenÔÇÖ,
    inlined from ÔÇÿcollect_executeÔÇÖ at /root/toolchain_build_arm_nofpu/gcc-3.4.3/gcc/collect2.c:1535:
/usr/include/bits/fcntl2.h:51: error: call to ÔÇÿ__open_missing_modeÔÇÖ declared with attribute error: open with O_CREAT in second argument needs 3 arguments
make[2]: *** [collect2.o] Error 1
make[2]: Leaving directory `/root/toolchain_build_arm_nofpu/gcc-3.4.3-initial/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/root/toolchain_build_arm_nofpu/gcc-3.4.3-initial'
make: *** [/root/toolchain_build_arm_nofpu/gcc-3.4.3-initial/.compiled] Error 2


Does anybody know what is going wrong?

Maurice 8)


Top
   
PostPosted: Sun Mar 07, 2010 3:25 pm 
Offline
Archos Guru
Archos Guru

Joined: Fri Aug 15, 2008 12:14 pm
Posts: 274
API change. You have to open that file and add the third parameter. The one thing I don't remember is what it was.


Top
   
PostPosted: Sun Mar 07, 2010 3:38 pm 
Offline
Archos Guru
Archos Guru

Joined: Tue Dec 04, 2007 9:48 pm
Posts: 595
I did that, I changed the following line:

Code:
redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT);


to

Code:
redir_handle = open (redir, O_WRONLY | O_TRUNC | O_CREAT,0664);


I don't know if 0664 is correct (I came across that with google), but now it runs alot further until the next error:

Code:
make[3]: *** [libgcc.a] Aborted
make[3]: *** Deleting file `libgcc.a'
make[3]: Leaving directory `/home/maurice/toolchain_build_arm_nofpu/gcc-3.4.3-initial/gcc'
make[2]: *** [libgcc.a] Error 2
make[2]: Leaving directory `/home/maurice/toolchain_build_arm_nofpu/gcc-3.4.3-initial/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/home/maurice/toolchain_build_arm_nofpu/gcc-3.4.3-initial'
make: *** [/home/maurice/toolchain_build_arm_nofpu/gcc-3.4.3-initial/.compiled] Error 2


As you can see I am also not building as root anymore.

Maurice 8)


Top
   
PostPosted: Mon Mar 08, 2010 1:59 am 
Offline
Archos Guru
Archos Guru

Joined: Wed Nov 21, 2007 6:41 pm
Posts: 448
In Fedora 12 After unpacking the AX05 iso image I just did

Code:
cd AX05_GPL/buildroot
cp configs/A605/defconfig .config
make sconfig


then make the edits to makedevs.c and checkdevs.c described above

and then run 'make'

Did you do all those steps?

I also noticed I have the gcc 4.4 and 3.4 compilers installed (via package compat-gcc-34), I wonder if that is why it works ok for me?


Top
   
PostPosted: Mon Mar 08, 2010 5:32 am 
Offline
Archos Guru
Archos Guru

Joined: Tue Dec 04, 2007 9:48 pm
Posts: 595
Quote:
then make the edits to makedevs.c and checkdevs.c described above

and then run 'make'

Did you do all those steps?


I did do them all. I will see if I get the 2 compilers installed, maybe that helps.

Maurice 8)


Top
   
PostPosted: Mon Mar 08, 2010 9:31 pm 
Offline
Archos Guru
Archos Guru

Joined: Wed Nov 21, 2007 6:41 pm
Posts: 448
@divx118

EDIT (update): you have to run make a second time with gcc-3.4 to get the complete cross-compiler toolchain, see below.

I tried the toolchain build on 32bit ubuntu 9.04, and it has the same problems you report, but I was able to successfully build the cross-compiler toolchain by installing gcc-3.4 and running 'make CC=gcc-3.4' after the first 'make' stops:

Code:
sudo apt-get install gcc-3.4


Code:
sudo mkdir /mnt/tmp
sudo mount -o loop /mnt/data/ISOs/AX05_GPL.iso /mnt/tmp
tar xvf /mnt/tmp/AX05_GPL.tar.bz2
cd AX05_GPL/buildroot
cp configs/A605/defconfig .config
make sconfig
make


this runs until you get the attribute error in the open function, so then run 'make' with gcc-3.4:

Code:
make CC=gcc-3.4


this stops with an error about libexpat but by then it has already built the cross-compiler in ~/staging_dir which you can use as per the guide in the NES emulator thread here

edit: (stella build is even more fiddlly on ubuntu)

to build stella I first had to cross-compile and install zlib (with './configure --libdir=/home/$USER/staging_dir/lib/ --includedir=/home/$USER/staging_dir/include/ --prefix=/home/$USER/staging_dir/' , then edit the Makefile and change CC, AR and RANLIB to arm-linux-cc, arm-linux-ar rc, arm-linux-ranlib, then run make, make install)

then in the stella directory I had to edit the configure file and set '_zlib=yes' near the top, and then follow the same instructions as posted in the NES emulator thread except that on ubuntu it doesn't like '~' for your home dir in the modified config.mak file so change those to /home/$USER ( eg run: sed -i "s,~,/home/$USER,g" config.mak )


Top
   
PostPosted: Tue Mar 09, 2010 6:42 pm 
Offline
Archos Guru
Archos Guru

Joined: Tue Dec 04, 2007 9:48 pm
Posts: 595
Thanks sideways, for trying it out for me and give me the solution for building stuff myself on ubuntu. I will however have to wait until next weekend to try it out. Working 12 to 13 hours a day the last 3 months and mostly 6 days a week :( , so not much time left during the week.
BTW I tried installing fedora 12, but it freezes on install on my laptop. Ubuntu 9.04 64 bit is a stable version for me. All newer version of ubuntu give me network trouble.

Maurice 8)


Top
   
PostPosted: Wed May 05, 2010 1:59 am 
Offline
Archos Novice
Archos Novice

Joined: Wed May 05, 2010 1:19 am
Posts: 1
First of all, great idea starting this thread. Always good to know you're not alone.

I must admit I'm completely new to the Archos scene. I recently purchased one after Apple killed my trusty 4 year old iPod with their release of iTunes 9. I was originally sold on the storage capacity coupled with variety of codecs, but the possibility of hacking greatly intrigues me.

However, before I jump into the project, I do have a question for some of the more experienced programmers. Do you believe its feasible for someone who is new to linux to become proficient enough in a reasonable amount of time to actually do meaningful hacking? I have some experience in programming but most of it is higher level languages. I've done the vast majority of my programming in MATLAB and am extremely proficient in that, as well as some brief experience with C, VB, vPython, and Java.

If learning linux is possible to do in a reasonable amount of time I definitely want to pursue it. However, I also don't have a ton of free time, and if learning linux is going to take longer than the life of my Archos then I'm not sure if its a project I want to tackle at the moment.

Thanks in advance!


Top
   
PostPosted: Wed May 05, 2010 7:50 am 
Offline
Archos Guru
Archos Guru

Joined: Thu Nov 23, 2006 3:44 pm
Posts: 524
Location: openaos.org
gtLabRat wrote:
I have some experience in programming but most of it is higher level languages. I've done the vast majority of my programming in MATLAB and am extremely proficient in that, as well as some brief experience with C, VB, vPython, and Java.
All except VishualBasux run on GNU/Linux, and even that to some degree if you use Mono I guess (As a matlab replacement there is Octave, but I'm not sure that's really something to try on an embedded device)

The question is just what you want to do?
I guess it's more about which language you feel most comfortable about. My personal guess is you will get the fastest results with c and gtk+, c++ and qt, or something like python with pygtk bindings. (The last one might not even need a cross compiling environment as it's an interpreted language. In general YMMV

_________________
openAOS


Top
   
PostPosted: Wed Mar 21, 2012 4:12 am 
Offline
Archos Novice
Archos Novice

Joined: Wed Mar 21, 2012 4:09 am
Posts: 1
Adding to the list:

Most used linux commands
http://commands.tips-linux.net


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 18 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited