发新话题
 搜藏 打印 该页面添加到 Mister Wong

Building your own custom Zaurus ROM image

Building your own custom Zaurus ROM image

网上收集来的资料,很难得。对应的机器型号是老了点,但是依然适用。
http://genealogy.holt.org/~casey ... M_Instructions.html

Building your own custom Zaurus ROM image
For the Sharp Zaurus SL500D and SL5500

Standard Disclaimer:
This has the potential of making a nice paperweight out of your Zaurus. Do this at your own rist. I make no guarantees that this will work. Also BACK UP YOUR DATA before you do this procedure. Reflashing will erase all of your data, and I mean all of it. Creating your own ROM will most likely cause you serious heartburn as well, but I can't help you there. =)

Also, for most of this process you will need root on your local Linux box. (Or at least permissions to run the various commands described.) It's not my fault if you mess your system up, and I take no responsibility for catastrophic mistakes. If you don't feel comfortable with this, stick with the standard ROM's, or go with Open Zaurus, which is coming along very nicely, I might add.

That said, lets have some fun...

Sources of Information
http://www.zauruszone.com/howtos/building_custom_rom.shtml -- Benjamin Meyer did a great HowTo that may be easier to follow. 9/2/03 Looks like this link is no longer availble. If you know where the original went, let me know and I'll update the link.

http://www.btinternet.com/~p.fli ... omimage-layout.html -- Paul Flinders work on how the file system is laid out. 9/2/03 Looks like this link is no longer availble. If you know where the original went, let me know and I'll update the link.

http://www.btinternet.com/~p.fli ... l-rootfs-howto.html -- Paul Flinders write up of extracting the file system. 9/2/03 Looks like this link is no longer availble. If you know where the original went, let me know and I'll update the link.

Details on the 5500 ROM image OSPack and building your own kernel.

Step 1 -- Get an image
Download an image from the Sharp web site: 5000D and 5500  

Step 2 -- Extract the image
Extract the romdisk from the image.

5000D -

First you will need to unzip the downloaded file from Sharp. Do this with the command:

  unzip SL5UpdateV13x.zip

This will give you a readme.txt file and a ROMIMAGE file. The ROMIMAGE file contains the kernel and romdisk for the Zaurus. Now we want to extract the contents of the ROMIMAGE and loop mount it so we can get at the contents.

  modprobe cramfs
  losetup -o 1835008 /dev/loop0 ROMIMAGE
  mkdir /mnt/flashimage
  mount /dev/loop0 /mnt/flashimag

Now we copy it somewhere so we can have write access to it. Once we copy it we will unmount the original as we will have no more need for it.

  cd /mnt/flashimage
  mkdir /tmp/zaurusfilesys
  tar cf - . | (cd /tmp/zaurusfilesys; tar xvf -)
  umount /dev/loop0

5500 -

First you will need to unzip the downloaded file from Sharp. Do this with the command:

  modprobe cramfs
  losetup -o 1835008 /dev/loop0 ospack.srom
  mkdir /mnt/flashimage
  mount /dev/loop0 /mnt/flashimage

Now we copy it somewhere so we can have write access to it. Once we copy it we will unmount the original as we will have no more need for it.

  cd /mnt/flashimage
  mkdir /tmp/zaurusfilesys
  cd /mnt/flashimage
  tar cf - . | (cd /tmp/zaurusfilesys; tar xvf -)
  umount /dev/loop0

Step 3 -- Extract the home directory tar ball
The contents of the home directory (/home/root) are contained in a file in the rom called .home_default.tar. It's found in /tmp/zaurusfilesys/root. I like to extract it outside of the filesystem repository. Create a /tmp/zaurushome directory you can put the contents of home in and extract the tar ball to it. Here are the commands:

  mkdir /tmp/zaurushome
  cd /tmp/zaurushome
  tar xf /tmp/zaurusfilesys/root/.home_default.tar

Now you have everything you need to modify your own ROM image. The zaurushome contains all of the symlinks to the actual programs. All of the contents in zaurushome will end up in RAM, so you will want to keep it as small as possible.

Step 4 -- Remove unwanted programs
Now for the fun stuff. In order to remove applications, you need to figure out what files are associated with them. That's the tricky part. Here is a link I put together with (I think) a list of apps and their files.

Apps and their associated files

As you will notice in the above link, all the apps have files in the home tar ball as well as in the rom file system. If you look in the home tar ball, the duplicates are all symlinks back to the ROM. Remove the applications you don't want.

A word about sizes. Since the file system is compressed, you won't get a good idea of sizes until you compress it again. However, you can tell if a program is a memory hog by looking at relative sizes. Use the command "ls -lh" to see sizes of files in bytes. For example, evm, the Insignia Java JVM is 1.6 MB. Compressed it will be somewhere like 1 MB. But, since you only have 14.8 MB of ROM to play with, that is a big chunk of space. Consider that the tkcCalendar uncompressed is 271K and it gives you and idea of size comparisons.

For example, in my ROM I took out the JVM (and all it's associated files), a couple of the games, the original datebook, address, todo, and a few others and added most of theKomany apps I have purchased.

So, to remove the default calendar program, you would do:

  rm zaurusfilesys/usr/QtPalmtop.rom/bin/datebook
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-adding.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-alarm-setup.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-event-alarm.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-event-repeat-daily.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-event-repeat-monthly.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-event-repeat-weekly.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-event-repeat-yearly.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-event-repeat.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-event-times.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-event.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-setup.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook-views.html
  rm zaurusfilesys/usr/QtPalmtop.rom/help/html/datebook.html
  rm zaurushome/home/QtPalmtop/apps/Applications/datebook.desktop
  rm zaurushome/home/QtPalmtop/bin/datebook
  rm zaurushome/home/QtPalmtop/help/html/datebook-adding.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-alarm-setup.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-event-alarm.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-event-repeat-daily.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-event-repeat-monthly.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-event-repeat-weekly.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-event-repeat-yearly.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-event-repeat.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-event-times.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-event.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-setup.html
  rm zaurushome/home/QtPalmtop/help/html/datebook-views.html
  rm zaurushome/home/QtPalmtop/help/html/datebook.html

This will remove all of the files associated with the default calendar program. (See the above link on apps and their associated files.)

Step 5 -- Add new programs.

This is where the rubber hits the road. The tricky part is figuring out where to put all the files. We will start with extracting the contents of an ipk. Since ipk files are just tar gzipped files, we can use the command:

  tar zxf myprog.ipk

So, for example, let's replace the calendar program. We removed all the default calendar files at the end of Step 4. Now let's look at the contents of the ipk. I'm using version -21 and here is what is inside:

  $tar zxvf qpe-tkccalendar_1.5.0-21_arm.ipk
  ./debian-binary
  ./control.tar.gz
  ./data.tar.gz
  $

All right. Now we extract the data.tar.gz file for all the data file to be put in the ROM image. Don't worry about the other files. We can just ignore them.

  $tar zxvf data.tar.gz
  ./opt/
  ./opt/QtPalmtop/
  ./opt/QtPalmtop/etc/
  ./opt/QtPalmtop/etc/tkcCalendar/
  ./opt/QtPalmtop/etc/tkcCalendar/descriptions
  ./opt/QtPalmtop/etc/tkcCalendar/locations
  ./opt/QtPalmtop/bin/
  ./opt/QtPalmtop/bin/datebook
  ./opt/QtPalmtop/apps/
  ./opt/QtPalmtop/apps/theKompany.com/
  ./opt/QtPalmtop/apps/theKompany.com/tkcCalendar.desktop
  ./opt/QtPalmtop/apps/Applications/
  ./opt/QtPalmtop/apps/Applications/datebook.desktop
  ./opt/QtPalmtop/pics/
  ./opt/QtPalmtop/pics/tkcCalendar/
  ./opt/QtPalmtop/pics/tkcCalendar/01.png
  ./opt/QtPalmtop/pics/tkcCalendar/02.png
  ./opt/QtPalmtop/pics/tkcCalendar/03.png
  ./opt/QtPalmtop/pics/tkcCalendar/04.png
  ./opt/QtPalmtop/pics/tkcCalendar/05.png
  ./opt/QtPalmtop/pics/tkcCalendar/10.png
  ./opt/QtPalmtop/pics/tkcCalendar/event_template.png
  ./opt/QtPalmtop/pics/tkcCalendar/report.png
  ./opt/QtPalmtop/pics/tkcCalendar/today.png
  ./opt/QtPalmtop/pics/tkccalendarsplash.png
  ./opt/QtPalmtop/pics/tkcCalendar.png
  $

Where the files should go?

Copy all the opt/QtPalmtop/etc/* files and directories into zaurushome/home/etc/
Copy all the opt/QtPalmtop/apps/* files into zaurushome/home/QtPalmtop/apps/

Copy all the opt/QtPalmtop/pics/* files into zaurusfilesys/usr/QtPalmtop.rom/pics/
Copy all the opt/QtPalmtop/bin/* files into zaurusfilesys/usr/QtPalmtop.rom/bin/

Step 6 -- Symlink 'till the cows come home
Create symlinks in zaurushome to the ROM area. This step is the whole trick to getting this to work. Fortunately, if you mess up this step, you can always just create the link on the zarus itself using the terminal program. You will want to make sure you come back and create the links right in the home tar ball or else next time you flash you will have to create the links by hand again.

The Zaurus has links from the home area to ROM which allows users to overwrite programs in ROM with ones in memory. This is how theKompany apps and others "replace" the default applications. They just put their app over top of the symlink. Now you get it. =)

You will need to create links for the picture files in zaurusfilesys/usr/QtPalmtop.rom/pics/ as well as the applications. Most of the other stuff will be ok without. Luckily, you can create a link to a top level directory, such as the following for the tkcCalendar/ pics directory:

  cd zaurushome/home/QtPalmtop/pics
  ln -s /usr/QtPalmtop.rom/pics/tkcCalendar/ tkcCalendar

And the link for the application should look like this:

  cd zaurushome/home/QtPalmtop/bin
  ln -s /usr/QtPalmtop.rom/bin/datebook datebook

Do that for all the files in the opt/QtPalmtop/pics/ directory from teh data.tar.gz of the .ipk file. For example, if in the pics/ directory there were three picture files and a directory with lots of files in it, you will need to create four symlinks. One for the directory, and three for the actual pictures.

Note: The links will show as not being linked to anything (unless you have the app on your desktop in the same location it is on the Zaurus.) That is fine and expected.

Note: For theKompany applications you will also need to follow the above procedure for the qpe-thekompany .ipk.

Now that the links are made, you are ready to roll your own ROM.


Step 7 -- Recreate the home directory tar ball
Once all of the symlinks are made, recreate the home directory tar ball using the following commands:

  cd zaurushome/
  tar cf .home_default.tar home/

Now copy the .home_default.tar file into the zaurusfilesys/root/ directory and overwrite the old .home_default.tar file.

Step 8 -- Create a new romdisk
Create a new romdisk image to flash.

Note that you need to run mkcramfs as root or your Z won't boot.

  mkcramfs zaurusfilesys initrd.bin

Check the size of your new initrd.bin. If it's over 14.8 MB, it's too big and you will have problems during the flash process. Best to start out around 14.2 MB and work up from there. You might have to do some playing to get it just right. I still have 3-400 K free in mine, but that's good enough for me.

Step 9 -- Flash it to the Zaurus
Copy initrd.bin (which is your new romdisk image) to CF card and flash it to the Zaurus using the procedure described here from steps 5 on. This will  only reflash the file system and will leave the bootloader and linux kernel alone. (Very nice for testing as you can mess up the filesystem and still flash the original ROM's and modified filesystems (initrd.bin files.)

Step 10 -- Boot and test it out
'Nuf said.

Let me know if y ou have problems with these instructions or can add some value to it. I'd love to hear your feedback. casey@sovereign.org
Building your own custom Zaurus ROM image

==========================================================

[ 本帖最后由 wjping119 于 2006-2-27 18:02 编辑 ]

本文由wjping119 发布于Linuxsky 论坛,网址:http://bbs.linuxsky.org/thread-1967-1-1.html

TOP

发新话题