Home NAS (Advanced) • Load and boot your kernel via TFTP

Load and boot your kernel via TFTP

 - 

Now that you know how to control uBoot (see previous post) you can start booting up your kernel. As said earlier, this is best to do using the serial connection and Clunc can only be used if your desktop kernel supports netconsole. Since i don’t use netconsole, i cannot give any information about that, in this case use Google!.

In order to use TFTP for boot, there needs to be a TFTP server on your network, if you’re using Linux on your desktop you can install a very simple tool calles ATFTPd, so install this first:
sudo apt-get install atftpd atftp

In this post i assume that your NAS is with IP 192.168.0.3 and the “TFTP server” is 192.168.0.2 with the devices using 192.168.0.1 as gateway.

When finished installing, copy your previously built kernel into the TFTP folder:
sudo cp /root/uImage /srv/tftp/

Now enter uBoot with clunc or Minicom and make sure you see the prompt like:
Marvell >

First we need to set some environment variables, else the loading of your kernel will fail as well as accessing your harddisk:

Start with the IP assignment:
setenv serverip 192.168.0.2
setenv ipaddr 192.168.0.3
setenv gatewayip 192.168.0.1

Now modify the bootargs variable (will be lost on reset or reboot):
setenv bootargs console=ttyS0,115200 root=/dev/sda1 rw init=/bin/bash
You’ve just entered on what line the console is (ttyS0) with it’s baudrate (115200) and that the rootdisk is /dev/sda1 in readwrite mode. You’ve also set the init process to /bin/bash (the bash shell).

Now we want to load the kernel into RAM via TFTP:
tftp 00800000 uImage
You’ll see alot of characters loading horizontally, when done, boot the kernel:
bootm 00800000

If you’ve set up the netconsole right (serial always works) you should see the verbose output of your kernel booting on your NAS!
You should be left with a bash prompt ready for your commands.

In my next post I’ll let you see how to compleet the second stage of the debootstrap process and installing needed software on the device.

Author:langerak

Leave a Reply

Your email address will not be published. Required fields are marked*

*

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.