Difference between revisions of "Hammer How to JFFS2 Root"

From eLinux.org
Jump to: navigation, search
Line 4: Line 4:
  
 
Do these steps FIRST:
 
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'''
+
Turn off all initramfs and initrd support in your kernel
* Make sure the correct '''Default Kernel Commandline''' (in APEX, Environment) is set to point to /mnt/mtdblock1 as the root partition
+
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.
 
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.
  
  Press RESET on Hammer
+
In Buildroot do:
  Press Ctrl/C to get to the APEX command prompt
+
 
 +
  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/<project> 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|Hammer Board]].
 +
 
 +
Do:
 +
 
 +
  Press RESET on Hammer and Ctrl/C to get to the APEX command prompt
 
  xreceive 0x30800000 (this is the address to upload to in memory)
 
  xreceive 0x30800000 (this is the address to upload to in memory)
  
In Minicom
+
In Minicom do:
  
  Ctrl A Z S in Minicom
+
  Ctrl/A S
 
  Select Xmodem
 
  Select Xmodem
 
  Browse to or enter the full path of the JFFS2 image to upload
 
  Browse to or enter the full path of the JFFS2 image to upload
  
 
Browse to or enter the name of the JFFS2 image file to upload
 
Browse to or enter the name of the JFFS2 image file 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)
 
  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 <filesize> with the exact filesize returned by doing
+
For the next step, you need to know the exact size in bytes of your JFFS2 file image. Replace <filesize> with the exact file size in bytes returned by doing
  
 
  ls -l
 
  ls -l
Line 30: Line 50:
 
at the shell prompt.
 
at the shell prompt.
  
In APEX then do:
+
In APEX do:
  
 
  copy 0x30800000+<filesize> nor:1280k
 
  copy 0x30800000+<filesize> 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:
+
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 root=/dev/mtdblock1
 
  console=ttySAC0 rootfstype=jffs2 root=/dev/mtdblock1
  
Then rebuild APEX.
+
Then save your configuration, exit, and do:
 +
 
 +
make
  
To make this change more temporary, until you reflash Hammer again, you can set the cmdline parameter in APEX by:
+
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
 
  Rebooting Hammer and pressing Ctrl/C to get to the APEX prompt
  
In APEX:
+
In APEX do:
  
 
  setenv cmdline = "console=ttySAC0 rootfstype=jffs2 root=/dev/mtdblock1"
 
  setenv cmdline = "console=ttySAC0 rootfstype=jffs2 root=/dev/mtdblock1"

Revision as of 14:26, 22 April 2008

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/<project> 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 0x30800000 (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

Browse to or enter the name of the JFFS2 image file 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 <filesize> with the exact file size in bytes returned by doing

ls -l

at the shell prompt.

In APEX do:

copy 0x30800000+<filesize> 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 root=/dev/mtdblock1

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/mtdblock1"
printenv

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