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 -s 0x800 –n -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 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.
Format the flash
redboot> fis init -f
Make a Bad Block Table
redboot> nand scan
Load kernel image (zImage) using the command below. Remember to modify the host IP address:
redboot> 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 (0x100000, for IMX27PDK)
redboot> fis create -f 0x100000 kernel
Load root file system image (rootfs.jffs2) to the temporary address. Remember to modify the host IP address:
redboot> load -r -b 0x100000 /tftpboot/rootfs.jffs2 -h 10.29.244.99
Create the root file system in the right address (0x600000, for IMX27PDK)
redboot> fis create -f 0x600000 root
This step can be omitted!
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 -c "noinitrd console=ttymxc0,115200 root=nfs nfsroot=<server_ip>:<root_path_on_server> ip=dhcp"
Wait the system go up, then mount the flash at /mnt. Reminde that the flash has a jffs2 file system.
mount -t jffs2 /dev/mtdblock4 /mnt ls /mnt
List the /mnt contents. The output must be the right file system.
For testing root file system on NAND, type
exec -c "noinitrd console=ttymxc0,115200 root=/dev/mtdblock4 rw rootfstype=jffs2 ip=dhcp"
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/mtdblock4 rw rootfstype=jffs2 ip=dhcp" >> 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.