User Tools

Site Tools


loading_a_kernel_to_onboard_flash_memory_from_a_tftp_server

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:

RedBoot> fis delete vmlinux
Delete image 'vmlinux' - continue (y/n)? y

We answer yes (y).

Loading the kernel image to RAM

Now we are going to load a new kernel into the RAM:

load -r -b 0x00218000 -h <ftpserver_IPaddress> <kernel_image_name>

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:

RedBoot> load -r -b 0x00218000 -h 192.168.10.99 zImage                          
Using default protocol (TFTP)                                                   
Raw file loaded 0x00218000-0x0037e6fb, assumed entry at 0x00218000

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:

((Top space in memory) - (Base space in memory)) + 1 = (kernel length)

My case was:

((37e6fb) - (218000)) + 1 = (0x001666fc)

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:

ls -l /tftpboot/zImage

You'll get something like this:

-rwxr-xr-x 1 myname myname 1468156 2011-01-06 14:10 /tftpboot/zImage

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:

fis create -b 0x00218000 -l <length> vmlinux

Here are two examples:

fis create -b 0x00218000 -l 0x001666fc vmlinux
fis create -b 0x00218000 -l 1468156 vmlinux

If you get a problem about not being able to locate some bytes and you are sure you've done everything correctly, simply type

RedBoot> fis init -f

and answer yes (y) to the question:

About to initialize [format] flash image system - continue (y/n)? y

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:

RedBoot> fis load vmlinux
RedBoot> exec

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

fconfig

and write:

Boot script:   
fis load vmlinux                                                             
exec

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