This is an old revision of the document!
Table of Contents
Making auto-upgrade CF cards
Any card can be made to do something interesting by putting a script called NBLXLoad.sh on the first partition. The shell script in this file will be exectuted in the initrd (Initial Ram Disk) environment after the kernel boots. It will normally be used to perform software installation/updates.
Note the system only checks for the NBLXLoad.sh any special operation scripts must be called that to be run.
Putting the Netbook LX images in nand
This is performed quite simply, the files necessary are in every daily build
These files should be copied to a FAT formated CF card:
These files are:
- nBkPro.ing: a BooSt script that partitions the flash.
- NBLXLoad.sh: a shell script that is run after the kernel mounts the CF card
- NBkProOs.img: a version of the kernel that has BooSt options set so that it copies itself into the first flash partition from the CF, then runs itself
- soho-image-*.jffs2: the filesystem image that you want copied into the main flash partition.
The BooSt script nBkPro.img does this:
nand -ignore erase 18 ee8 (Ignore forces boost to erase the blocks) nand partition e8
(you can verify if the erase procedure has worked by doing a nand check) (using nand - ignore erase 18 fe8 also erases the user data on the nand and give a completely clean restart)
This will leave the “OS” partition (3MB (nand sectors 0-18), containing BooSt and the kernel) alone and erase the rest of the flash (except from the 4MB user partition - use fe8 instead of ee8 to nuke that too). The partition command defines the “OS” partition block e8 (ie being 3Mb - 18blocks for BooSt, the rest for the Kernel and Initrd).
More details about the nand and BooSt commands to change it are in Using BooSt.
Once the card and boost have been prepared, simply insert the cf card. If you observe on the serial console you should see the nand being programmed. Once programmed the boot should continue and the system should now be bootable from nand.
Note that the kernel is copied into nand by BooSt, whilst the root filesystem is copied in by the NBLXLoad.sh script.
REMOVE the CF card before you restart or the system will reflash on the next boot!
Recovering from a broken nand rootfs
The nand may be cleared by replacing the above NBLXLoad.sh script with the NBLXLoad-clear.sh from the krnbuild/nand/ directory (copies of the current version of these scripts are in the http://nexus.psiondev.com/~autobuild/ also). Note the script should still be called NBLXLoad.sh (i.e. you need to rename the script once copied) and should be removed if you continute to boot from the CF card or the erase will happen every time.
Partitioning a suitable CF Card for nand and cf use
It is possible to use one card for both installing images to nand flash, and for booting and running from the CF. To do this you need at least a 256MB card so there is space for a 70MB DOS 1st partition and a 170MB Linux partition.
This allows room for the above-listed files to go on the card for nand-flashing, and for a rootfs to live in the Linux ext2 partition for running from CF. The cards supplied with the Netbook are generally partitioned 4MB/500MB and new ones are generally partionned/formatted all DOS so you need to re-partition them as above.
Cfdisk is the tool for partitioning. When you insert your CF card it appears as a device. That is likley to be /dev/sda or /dev/hde depending on your hardware. Know which you use and be sure because if you repartition one of your main disks accidentally you will regret it. Cfdisk is a friendly tool and is easily driven with menus. What you need to do if something like this:
- cfdisk /dev/hde
- Check the partition list looks right - 'Q'uit if it doesn't
- 'D'elete the exisiting partitions
- Create 'N'ew partition, ('P'rimary at the 'S'tart, size 70MB)
- Set the 'T'ype to '06' (DOS FAT)
- Set it 'B'ootable (although this is not important here)
- Create another 'N'ew partition ('P'rimary, at the 'S'tart, filling the rest of the disk (the default size))
- set the Type defaults to Linux (i.e. ext2)
- now 'W'rite that partition table to actually make the changes.
Next you need to format these new partitions so you can copy stuff onto them - remember to adjust you device name to suit your set-up:
- mkfs.msdos /dev/hde1 (you need the dosfstool package installed to have this command)
- mkfs.ext2 /dev/hde2
Now you can mount the partitions and copy files to them as normal.