Hammer How to JFFS2 Root

This tutorial assumes you are using Minicom to console to your Hammer Board.

This tutorial shows how to configure the Hammer Board software to boot from the flash partition (/dev/mtdblock1) instead of using an initrd in RAM. This should make more RAM available for applications.

Do these steps FIRST:

Turn off all initramfs and initrd support in your kernel Make sure the .SIZE is set correctly in arch/arm/mach-s3c2410/mach-tct-hammer.c Make sure the correct Default Kernel Commandline (in APEX, Environment) is set to point to /mnt/mtdblock1 as the root partition. You may have to edit arch/arm/mach-s3c2410/mach-tct-hammer.c to change the value of .SIZE if your kernel is larger than 1 MB. The most common values for .SIZE are 0x140000 (1280k) and 0x200000 (2048k). These values should be more than large enough for most builds. The .SIZE variable has to be large enough for the boot loader and the kernel together.

In Buildroot do:

make menuconfig uncheck ext2 in Target Options check jffs2 in Target Options Exit and save your new configuration make

There will be a *.jffs2 image file in your buildroot/binaries/ directory - this is your JFFS2 rootfs image.

Do:

Copy the jffs2 file, the apex.bin (bootloader) file, and your zImage (kernel) file to where you have OpenOCD setup for use. Edit your hammer.ocd flash script to comment out the initrd file flash command - you will upload your JFFS2 image later. Do openocd -f hammer.cfg, which will flash the new bootloader and kernel image to your Hammer Board.

Do:

Press RESET on Hammer and Ctrl/C to get to the APEX command prompt xreceive 0x30300000 (this is the address to upload to in memory)

In Minicom do:

Ctrl/A S Select Xmodem Browse to or enter the full path of the JFFS2 image to upload

In APEX do:

erase nor:1280k+0xEC0000 (that value is total amount of flash minus the amount of flash used for kernel and bootloader)

For the next step, you need to know the exact size in bytes of your JFFS2 file image. Replace with the exact file size in bytes returned by doing

ls -l

at the shell prompt.

In APEX do:

copy 0x30300000+ nor:1280k

To make the next change permanent, you need to go into the APEX configuration and set a parameter to tell APEX about your new root file system (JFFS2) and root (/dev/mtdblock1). There is a parameter in the Environment section called Default kernel command line, which you need to set to:

console=ttySAC0 rootfstype=jffs2 init=/linuxrc root=/dev/mtdblock0 rw

Then save your configuration, exit, and do:

make

This will rebuild the APEX bootloader. To make this change more temporary, until you reflash Hammer again, you can set the cmdline parameter in APEX by:

Rebooting Hammer and pressing Ctrl/C to get to the APEX prompt

In APEX do:

setenv cmdline = "console=ttySAC0 rootfstype=jffs2 root=/dev/mtdblock0" printenv

This should show the change you just made. Now press RESET on your Hammer Carrier Board to reboot.