User Tools

Site Tools


loading_a_kernel_to_onboard_flash_memory_from_a_tftp_server

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

loading_a_kernel_to_onboard_flash_memory_from_a_tftp_server [2017/01/03 21:25] (current)
admin created
Line 1: Line 1:
 +===== Introduction =====
 +If you have successfully compiled a kernel and are ready to place it in the board permanently,​ you need to follow this instructions. First, let's assume we have an TFTP server configured on our computer and the kernel image inside the TFTP folder (if you follow the [[Compiling and running kernel 2.6]] tutorial then you don't need to do anything).
  
 +==== Configuring RedBoot ====
 +The first step is getting into RedBoot'​s menu by pressing ctrl+C until you are in RedBoot'​s command line after you plugged your SBC in. Now, let's erase the old kernel like this:
 +
 +<​code>​
 +RedBoot> fis delete vmlinux
 +Delete image '​vmlinux'​ - continue (y/n)? y
 +</​code>​
 +
 +We answer yes (y).
 +
 +==== Loading the kernel image to RAM ====
 +
 +Now we are going to load a new kernel into the RAM:
 +
 +<​code>​
 +load -r -b 0x00218000 -h <​ftpserver_IPaddress>​ <​kernel_image_name>​
 +</​code>​
 +
 +In my case, ftpserver_IPaddress is192.168.10.99 and <​kernel_image_name>​ is zImage (replace it with the name of your kernel), so the result of loading the kernel should look like this:
 +
 +<​code>​
 +RedBoot> load -r -b 0x00218000 -h 192.168.10.99 zImage ​                         ​
 +Using default protocol (TFTP) ​                                                  
 +Raw file loaded 0x00218000-0x0037e6fb,​ assumed entry at 0x00218000
 +</​code>​
 +
 +We can see that the base space in memory is 0x00218000 and the top, used for the zImage, is 0x0037e6fb. Remember this is HEX, and we will need the kernel image'​s length, so we have 2 ways to get this number:
 +
 +**Option 1**:
 +
 +<​code>​
 +((Top space in memory) - (Base space in memory)) + 1 = (kernel length)
 +</​code>​
 +
 +My case was: 
 +
 +<​code>​
 +((37e6fb) - (218000)) + 1 = (0x001666fc)
 +</​code>​
 +
 +In hexadecimal notation use 0x001666fc or 1468156 for decimal. Don't forget adding 1, because we are talking about zero indexed memory space.
 +
 +**Option 2**:
 +
 +In your computer type:
 +
 +<​code>​
 +ls -l /​tftpboot/​zImage
 +</​code>​
 +
 +You'll get something like this:
 +
 +<​code>​
 +-rwxr-xr-x 1 myname myname 1468156 2011-01-06 14:10 /​tftpboot/​zImage
 +</​code>​
 +
 +Take the size data and change it to hexa. Both methods return the same result obviously, 0x001666fc or 1468156.
 +
 +==== Loading the kernel image to flash ====
 +Now we write the kernel to flash:
 +
 +<​code>​
 +fis create -b 0x00218000 -l <​length>​ vmlinux
 +</​code>​
 +
 +Here are two examples:
 +
 +<​code>​
 +fis create -b 0x00218000 -l 0x001666fc vmlinux
 +</​code>​
 +
 +<​code>​
 +fis create -b 0x00218000 -l 1468156 vmlinux
 +</​code>​
 +
 +If you get a problem about not being able to locate some bytes and you are sure you've done everything correctly, simply type
 +
 +<​code>​
 +RedBoot> fis init -f
 +</​code>​
 +
 +and answer yes (y) to the question:
 +
 +<​code>​
 +About to initialize [format] flash image system - continue (y/n)? y
 +</​code>​
 +
 +Don't forget to type “-f” because this way, the FIS directory gets initialized and all of the flash memory, except for the first blocks of the flash where the boot monitor resides. From here, everything should work fine.
 +
 +==== Running the new kernel ====
 +Once we have finished the last steps successfully,​ let's load our kernel from the onboard flash and run it:
 +
 +<​code>​
 +RedBoot> fis load vmlinux
 +RedBoot> exec
 +</​code>​
 +
 +The result should be GNU/Linux starting! Note that I only used the command ''​exec'',​ because my kernel has the rest of the booting instructions inside. If you haven'​t done this, you need to specified the location of the filesystem to boot from.
 +
 +==== Automatic boot-up ====
 +If you have the kernel'​s boot-up option set up and want to make your SBC start automatically type in RedBoot'​s command line
 +
 +<​code>​
 +fconfig
 +</​code> ​
 +
 +and write:
 +
 +<​code>​
 +Boot script: ​  
 +fis load vmlinux ​                                                            
 +exec
 +
 +</​code>​
 +
 +Press enter twice at the end to finish writing and keep on pressing enter to the end of the configuration wizard. Restart now and you will get GNU/Linux running automatically with your new kernel!
loading_a_kernel_to_onboard_flash_memory_from_a_tftp_server.txt · Last modified: 2017/01/03 21:25 by admin