Flashing Kernel and Root File System using RedBoot
Creating an image
A kernel image and a root file system can be created using All Boards LTIB or compiling the kernel and setting the correct set of files.
Create a root file system image from a set of files converting the files to a jffs2 file system. For this, install the package mtd-tools.
In Ubuntu type
apt-get install mtd-tools
For making an root file system for flash, use the jffs2 file system like:
mkfs.jffs2 -r rootfs/ -e 0x20000 -n -p -o rootfs.jffs2
Where rootfs/ is the original set of file for the file system and rootfs.jffs2 is the output image file.
Some connections errors can be avoided by All Boards Configuring RedBoot.
The process below uses TFTP to copy the files between host and target. See All Boards TFTP for detail in configurations.
Copy the kernel image and the root file system image to the TFTP dir. For example, in LTIB dir, type
sudo cp ./rootfs/boot/zImage /tftpboot sudo cp rootfs.jffs2 /tftpboot/
Where /tftpboot is the dir configured for TFTP
The next steps are performed in a Minicom session, and happens on the board.
Formatting the flash:
Load kernel image (zImage) using the command below. Remember to modify the host IP address:
load -r -b 0x100000 /tftpboot/zImage -h 10.29.244.99
The address 0x100000 is used as a temporary location
Create the kernel at the right address (0x200000, for i.MX31 PDK)
fis create -f 0x200000 kernel
Flashing root file system
Load root file system image (rootfs.jffs2) to the temporary address. Remember to modify the host IP address:
load -r -b 0x100000 /tftpboot/rootfs.jffs2 -h 10.29.244.99
Create the root file system in the right address (0x600000, for i.MX31 PDK.
fis create -f 0x600000 root
You can now load your kernel in the flash by typing:
fis load kernel
To know if the root file system written in the flash was correctly saved, execute the NFS file system and mount the flash.
For load the the root file system by NFS, type:
exec -b 0x100000 -l 0x200000 -c "noinitrd console=ttymxc0,115200 root=/dev/nfs nfsroot=10.29.244.99:/tftpboot/rootfs init=/linuxrc ip=10.29.241.6:10.29.244.99"
Wait the system go up, then mount the flash at /mnt. Reminde that the flash has a jffs2 file system.
mount -t jffs2 /dev/mtdblock2 /mnt ls /mnt
List the /mnt contents. The output must be the right file system.
Modifying the initial script
Reset the board and press CTRL-C.
Type fc to modify the configurations and insert the initialization script.
RedBoot> fc Run script at boot: true Boot script: Enter script, terminate with empty line >> fis load kernel >> exec -c "noinitrd console=ttymxc0,115200 root=/dev/mtdblock2 rw rootfstype=jffs2 ip=none" >> Boot script timeout (1000ms resolution): 1 Use BOOTP for network configuration: false Gateway IP address: 10.29.241.254 Local IP address: 10.29.241.6 Local IP address mask: 255.255.254.0 Default server IP address: 10.29.244.99 Board specifics: 0 Console baud rate: 115200 Set eth0 network hardware address [MAC]: false GDB connection port: 9000 Force console for special debug messages: false Network debug at boot time: false Update RedBoot non-volatile configuration - continue (y/n)? y ... Read from 0x07ee0000-0x07eff000 at 0x00080000: . ... Erase from 0x00080000-0x000a0000: . ... Program from 0x07ee0000-0x07f00000 at 0x00080000: . RedBoot>
Remember to save the configuration in the flash by typing y
Reset the system.
To certify that the board is loading the system from flash, remove the ethernet cable.