Difference between revisions of "Hammer How to JFFS2 Root"

From eLinux.org
Jump to: navigation, search
 
m (Added more description on copying the jffs2 filesystem in apex. It wasnt very clear that the nor:1280k needed adjusted depending on the change in the size attribute mentioned at the top of the documen)
 
(10 intermediate revisions by 2 users not shown)
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'''
 
* Make sure the correct '''Default Kernel Commandline''' (in APEX, Environment) is set to point to /mnt/mtdblock1 as the root partition
 
  
 +
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.
 
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
+
xreceive 0x30800000
+
  
In Minicom
+
make menuconfig
 +
uncheck ext2 in Target Options
 +
check jffs2 in Target Options
 +
Exit and save your new configuration
 +
make
  
  Ctrl A Z S in Minicom
+
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 0x30300000 (this is the address to upload to in memory)
 +
 
 +
In Minicom do:
 +
 
 +
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
+
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 48:
 
at the shell prompt.
 
at the shell prompt.
  
In APEX then do:
+
In APEX do:
  
  copy 0x30800000+10074460 nor:1280k
+
  copy 0x30300000+<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:
+
NOTE: This command may need changed based on the size allocated for kernel space. In Linux kernel 2.6.29.6 the default allocated space in the mach file is 0x200000 (verify this before you type it). You will see this value in the size attribute of the MTD partitions labeled "System" in the mach-tct_hammer.c file in <kernel root>/arch/arm/s3c2410. So a more appropriate definition would be
 +
copy 0x30300000+<filesize> nor:<system size>
 +
If its 0x200000
 +
copy 0x30300000+<filesize> nor:0x200000
 +
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 init=/linuxrc root=/dev/mtdblock1 rw
  
Then rebuild APEX.
+
Then save your configuration, exit, and do:
  
To make this change more temporary, until you reflash Hammer again, you can set the cmdline parameter in APEX by:
+
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
 
  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"
Line 50: Line 74:
  
 
This should show the change you just made.  Now press RESET on your Hammer Carrier Board to reboot.
 
This should show the change you just made.  Now press RESET on your Hammer Carrier Board to reboot.
 +
 +
[[Category:TCT-Hammer]]
 +
[[Category:TinCanTools]]

Latest revision as of 02:10, 18 November 2009

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 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 <filesize> with the exact file size in bytes returned by doing

ls -l

at the shell prompt.

In APEX do:

copy 0x30300000+<filesize> nor:1280k

NOTE: This command may need changed based on the size allocated for kernel space. In Linux kernel 2.6.29.6 the default allocated space in the mach file is 0x200000 (verify this before you type it). You will see this value in the size attribute of the MTD partitions labeled "System" in the mach-tct_hammer.c file in <kernel root>/arch/arm/s3c2410. So a more appropriate definition would be

copy 0x30300000+<filesize> nor:<system size>

If its 0x200000

copy 0x30300000+<filesize> nor:0x200000

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

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