Difference between revisions of "Niagra 804: Initial Bootup"
(Created page with "== Basic boot up via PXE == === Get an IP address by DHCP === Request an IP address by typing <b><code>dhcp</code></b>: <syntaxhighlight> Octeon cust_n804# dhcp BOOTP broadcast 1 DHCP c...") |
|||
| (14 intermediate revisions by 2 users not shown) | |||
| Line 27: | Line 27: | ||
done | done | ||
Bytes transferred = 33838432 (2045560 hex) | Bytes transferred = 33838432 (2045560 hex) | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Boot the system === | ||
| + | <syntaxhighlight> | ||
| + | bootoctlinux 0 coremask=f #f = cores 0-3, 3ff = cores 0-9 | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | == Booting Debian from SDK created USB/CF image == | ||
| + | |||
| + | === Start the USB service === | ||
| + | <syntaxhighlight> | ||
| + | Octeon cust_n804# usb start | ||
| + | </syntaxhighlight> | ||
| + | You should be able to see the USB storage devices using <code>usb storage</code> at the uBoot prompt: | ||
| + | <syntaxhighlight> | ||
| + | Octeon cust_n804# usb storage | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Load the kernel image to memory === | ||
| + | <syntaxhighlight> | ||
| + | Octeon cust_n804# fatload usb 0:1 $(loadaddr) vmlinux.64 | ||
| + | </syntaxhighlight> | ||
| + | The syntax here is: | ||
| + | * fatload = load a file from FAT filesystem | ||
| + | * usb = device type to be access is a USB storage device | ||
| + | * 0:1 = device '''0''', partition '''1''' - ''devices start at 0, partitions start at 1'' | ||
| + | * $(loadaddr) = memory address into which the file should be loaded (loadaddr = 0x20000000 by default) | ||
| + | * vmlinux.64 = file to load | ||
| + | |||
| + | === Boot the kernel image === | ||
| + | <syntaxhighlight> | ||
| + | Octeon cust_n804# bootoctlinux 0x20000000 numcores=10 root=/dev/sda2 | ||
| + | |||
| + | # alternative, use mem=0 to get access to the full 2GB RAM on the IM804 card | ||
| + | Octeon cust_n804# bootoctlinux 0x0 numcores=10 mem=0 root=/dev/sda2 rw rootdelay=10 | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | == Setup Networking in BusyBox == | ||
| + | Setup the IP networking | ||
| + | <syntaxhighlight> | ||
| + | # grab the IP address from the output of dhcp above | ||
| + | ifconfig mgmt0 172.28.1.84 | ||
| + | route add default gw 172.28.0.1 mgmt0 | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | Setup the <code>resolv.conf</code> file | ||
| + | <syntaxhighlight> | ||
| + | # create the following file | ||
| + | /mnt/sda1 # cat /etc/resolv.conf | ||
| + | nameserver 172.28.0.2 | ||
| + | search pxe.boston.co.uk | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | After this you can use <code>wget</code> to pull files down from the tftp server or the web | ||
| + | |||
| + | == Get the Debian root file system up and running == | ||
| + | Once the kernel has booted, you'll be in a Busy Box environment. We need to mount and <code>chroot</code> to the Debian roots. | ||
| + | |||
| + | === Mount the Debian root fs partition === | ||
| + | The root fs is located on the second partition of the storage device. Mount it: | ||
| + | <syntaxhighlight> | ||
| + | ~ # mount /dev/sdb2 /mnt | ||
| + | kjournald starting. Commit interval 5 seconds | ||
| + | EXT3-fs (sdb2): warning: checktime reached, running e2fsck is recommended | ||
| + | EXT3-fs (sdb2): using internal journal | ||
| + | EXT3-fs (sdb2): recovery complete | ||
| + | EXT3-fs (sdb2): mounted filesystem with writeback data mode | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Bind the Busy Box /proc directory === | ||
| + | Bind the Busy Box /proc directory to the /proc directory of the Debian root fs: | ||
| + | <syntaxhighlight> | ||
| + | ~ # mount --bind /proc /mnt/proc/ | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === chroot to the Debian root fs and start bash === | ||
| + | Chroot: | ||
| + | <syntaxhighlight> | ||
| + | ~ # chroot /mnt | ||
| + | Algorithmics/MIPS FPU Emulator v1.5 | ||
| + | sh-4.1# | ||
| + | </syntaxhighlight> | ||
| + | And start bash: | ||
| + | <syntaxhighlight> | ||
| + | sh-4.1# bash | ||
| + | root@(none):/# | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Set up the networking === | ||
| + | <syntaxhighlight> | ||
| + | root@(none):/# ifconfig mgmt0 172.28.1.95 up | ||
| + | IPv6: ADDRCONF(NETDEV_UP): mgmt0: link is not ready | ||
| + | root@(none):/# mgmt0: Link is up - 1000/Full | ||
| + | IPv6: ADDRCONF(NETDEV_CHANGE): mgmt0: link becomes ready | ||
| + | root@(none):/# | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Set up a default gateway === | ||
| + | <syntaxhighlight> | ||
| + | root@jph1:/# route add default gw 172.28.0.1 mgmt0 | ||
| + | </syntaxhighlight> | ||
| + | And confirm with <code>route -n</code>: | ||
| + | <syntaxhighlight> | ||
| + | root@(none):/# route -n | ||
| + | Kernel IP routing table | ||
| + | Destination Gateway Genmask Flags Metric Ref Use Iface | ||
| + | 0.0.0.0 172.28.0.1 0.0.0.0 UG 0 0 0 mgmt0 | ||
| + | 172.28.0.0 0.0.0.0 255.255.0.0 U 0 0 0 mgmt0 | ||
| + | root@(none):/# | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Create a resolv.conf file === | ||
| + | Create an <code>/etc/resolv.conf</code> file so it looks something like: | ||
| + | <syntaxhighlight> | ||
| + | root@(none):/# cat /etc/resolv.conf | ||
| + | nameserver 172.28.0.2 | ||
| + | search pxe.boston.co.uk | ||
| + | </syntaxhighlight> | ||
| + | And confirm it works by pinging something: | ||
| + | <syntaxhighlight> | ||
| + | root@jph1:/# ping www.google.com | ||
| + | PING www.google.com (173.194.41.178) 56(84) bytes of data. | ||
| + | 64 bytes from lhr08s04-in-f18.1e100.net (173.194.41.178): icmp_req=1 ttl=55 time=3.67 ms | ||
| + | 64 bytes from lhr08s04-in-f18.1e100.net (173.194.41.178): icmp_req=2 ttl=55 time=3.67 ms | ||
| + | ^C | ||
| + | --- www.google.com ping statistics --- | ||
| + | 2 packets transmitted, 2 received, 0% packet loss, time 1001ms | ||
| + | rtt min/avg/max/mdev = 3.670/3.674/3.678/0.004 ms | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Get SSH access working === | ||
| + | Start the SSH server: | ||
| + | <syntaxhighlight> | ||
| + | root@jph1:/# /etc/init.d/ssh restart | ||
| + | Restarting OpenBSD Secure Shell server: sshd. | ||
| + | </syntaxhighlight> | ||
| + | And mount <code>/dev/pts</code>: | ||
| + | <syntaxhighlight> | ||
| + | root@jph1:/# mount /dev/pts | ||
| + | root@jph1:/# | ||
| + | </syntaxhighlight> | ||
| + | '''N.B. - mounting <code>/dev/pts</code> prevents the following error when attempting to SSH into the Debian O/S''' | ||
| + | <syntaxhighlight> | ||
| + | Jons-MacBook-Air-2:~ Jon$ ssh 172.28.32.32 -l root | ||
| + | PTY allocation request failed on channel 0 | ||
| + | WARNING: Your password has expired. | ||
| + | Password change required but no TTY available. | ||
| + | Connection to 172.28.32.32 closed. | ||
| + | </syntaxhighlight> | ||
| + | |||
| + | === Update the repository info === | ||
| + | <syntaxhighlight> | ||
| + | root@jph1:/# apt-get update | ||
| + | Hit http://security.debian.org squeeze/updates Release.gpg | ||
| + | Ign http://security.debian.org/ squeeze/updates/contrib Translation-en | ||
| + | Ign http://security.debian.org/ squeeze/updates/main Translation-en | ||
| + | Ign http://security.debian.org/ squeeze/updates/non-free Translation-en | ||
| + | Hit http://security.debian.org squeeze/updates Release | ||
| + | Hit http://security.debian.org squeeze/updates/main mips Packages | ||
| + | Hit http://security.debian.org squeeze/updates/contrib mips Packages | ||
| + | Hit http://security.debian.org squeeze/updates/non-free mips Packages | ||
| + | Hit http://mirrors.kernel.org squeeze Release.gpg | ||
| + | Ign http://mirrors.kernel.org/debian/ squeeze/contrib Translation-en | ||
| + | Ign http://mirrors.kernel.org/debian/ squeeze/main Translation-en | ||
| + | Ign http://mirrors.kernel.org/debian/ squeeze/non-free Translation-en | ||
| + | Hit http://mirrors.kernel.org squeeze Release | ||
| + | Hit http://mirrors.kernel.org squeeze/main Sources | ||
| + | Hit http://mirrors.kernel.org squeeze/non-free Sources | ||
| + | Hit http://mirrors.kernel.org squeeze/contrib Sources | ||
| + | Hit http://mirrors.kernel.org squeeze/main mips Packages | ||
| + | Hit http://mirrors.kernel.org squeeze/non-free mips Packages | ||
| + | Hit http://mirrors.kernel.org squeeze/contrib mips Packages | ||
| + | Reading package lists... Done | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 18:45, 25 April 2014
Basic boot up via PXE
Get an IP address by DHCP
Request an IP address by typing dhcp:
Octeon cust_n804# dhcp
BOOTP broadcast 1
DHCP client bound to address 172.28.1.84
Octeon cust_n804#Specify a TFTP server
Specify the TFTP server by setting the serverip environment variable:
Octeon cust_n804# setenv server ip 172.28.0.2Identify the boot image to pull down
TFTP down the boot image file:
Octeon cust_n804# tftp 0 /images/im_niagra804/vmlinux_n804.bin
Using octmgmt0 device
TFTP from server 172.28.0.2; our IP address is 172.28.1.84
Filename '/images/im_niagra804/vmlinux_n804.bin'.
Load address: 0x20000000
Loading: #################################################
done
Bytes transferred = 33838432 (2045560 hex)Boot the system
bootoctlinux 0 coremask=f #f = cores 0-3, 3ff = cores 0-9Booting Debian from SDK created USB/CF image
Start the USB service
Octeon cust_n804# usb startYou should be able to see the USB storage devices using usb storage at the uBoot prompt:
Octeon cust_n804# usb storageLoad the kernel image to memory
Octeon cust_n804# fatload usb 0:1 $(loadaddr) vmlinux.64The syntax here is:
- fatload = load a file from FAT filesystem
- usb = device type to be access is a USB storage device
- 0:1 = device 0, partition 1 - devices start at 0, partitions start at 1
- $(loadaddr) = memory address into which the file should be loaded (loadaddr = 0x20000000 by default)
- vmlinux.64 = file to load
Boot the kernel image
Octeon cust_n804# bootoctlinux 0x20000000 numcores=10 root=/dev/sda2
# alternative, use mem=0 to get access to the full 2GB RAM on the IM804 card
Octeon cust_n804# bootoctlinux 0x0 numcores=10 mem=0 root=/dev/sda2 rw rootdelay=10Setup Networking in BusyBox
Setup the IP networking
# grab the IP address from the output of dhcp above
ifconfig mgmt0 172.28.1.84
route add default gw 172.28.0.1 mgmt0Setup the resolv.conf file
# create the following file
/mnt/sda1 # cat /etc/resolv.conf
nameserver 172.28.0.2
search pxe.boston.co.ukAfter this you can use wget to pull files down from the tftp server or the web
Get the Debian root file system up and running
Once the kernel has booted, you'll be in a Busy Box environment. We need to mount and chroot to the Debian roots.
Mount the Debian root fs partition
The root fs is located on the second partition of the storage device. Mount it:
~ # mount /dev/sdb2 /mnt
kjournald starting. Commit interval 5 seconds
EXT3-fs (sdb2): warning: checktime reached, running e2fsck is recommended
EXT3-fs (sdb2): using internal journal
EXT3-fs (sdb2): recovery complete
EXT3-fs (sdb2): mounted filesystem with writeback data modeBind the Busy Box /proc directory
Bind the Busy Box /proc directory to the /proc directory of the Debian root fs:
~ # mount --bind /proc /mnt/proc/chroot to the Debian root fs and start bash
Chroot:
~ # chroot /mnt
Algorithmics/MIPS FPU Emulator v1.5
sh-4.1#And start bash:
sh-4.1# bash
root@(none):/#Set up the networking
root@(none):/# ifconfig mgmt0 172.28.1.95 up
IPv6: ADDRCONF(NETDEV_UP): mgmt0: link is not ready
root@(none):/# mgmt0: Link is up - 1000/Full
IPv6: ADDRCONF(NETDEV_CHANGE): mgmt0: link becomes ready
root@(none):/#Set up a default gateway
root@jph1:/# route add default gw 172.28.0.1 mgmt0And confirm with route -n:
root@(none):/# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.28.0.1 0.0.0.0 UG 0 0 0 mgmt0
172.28.0.0 0.0.0.0 255.255.0.0 U 0 0 0 mgmt0
root@(none):/#Create a resolv.conf file
Create an /etc/resolv.conf file so it looks something like:
root@(none):/# cat /etc/resolv.conf
nameserver 172.28.0.2
search pxe.boston.co.ukAnd confirm it works by pinging something:
root@jph1:/# ping www.google.com
PING www.google.com (173.194.41.178) 56(84) bytes of data.
64 bytes from lhr08s04-in-f18.1e100.net (173.194.41.178): icmp_req=1 ttl=55 time=3.67 ms
64 bytes from lhr08s04-in-f18.1e100.net (173.194.41.178): icmp_req=2 ttl=55 time=3.67 ms
^C
--- www.google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 3.670/3.674/3.678/0.004 msGet SSH access working
Start the SSH server:
root@jph1:/# /etc/init.d/ssh restart
Restarting OpenBSD Secure Shell server: sshd.And mount /dev/pts:
root@jph1:/# mount /dev/pts
root@jph1:/#N.B. - mounting /dev/pts prevents the following error when attempting to SSH into the Debian O/S
Jons-MacBook-Air-2:~ Jon$ ssh 172.28.32.32 -l root
PTY allocation request failed on channel 0
WARNING: Your password has expired.
Password change required but no TTY available.
Connection to 172.28.32.32 closed.Update the repository info
root@jph1:/# apt-get update
Hit http://security.debian.org squeeze/updates Release.gpg
Ign http://security.debian.org/ squeeze/updates/contrib Translation-en
Ign http://security.debian.org/ squeeze/updates/main Translation-en
Ign http://security.debian.org/ squeeze/updates/non-free Translation-en
Hit http://security.debian.org squeeze/updates Release
Hit http://security.debian.org squeeze/updates/main mips Packages
Hit http://security.debian.org squeeze/updates/contrib mips Packages
Hit http://security.debian.org squeeze/updates/non-free mips Packages
Hit http://mirrors.kernel.org squeeze Release.gpg
Ign http://mirrors.kernel.org/debian/ squeeze/contrib Translation-en
Ign http://mirrors.kernel.org/debian/ squeeze/main Translation-en
Ign http://mirrors.kernel.org/debian/ squeeze/non-free Translation-en
Hit http://mirrors.kernel.org squeeze Release
Hit http://mirrors.kernel.org squeeze/main Sources
Hit http://mirrors.kernel.org squeeze/non-free Sources
Hit http://mirrors.kernel.org squeeze/contrib Sources
Hit http://mirrors.kernel.org squeeze/main mips Packages
Hit http://mirrors.kernel.org squeeze/non-free mips Packages
Hit http://mirrors.kernel.org squeeze/contrib mips Packages
Reading package lists... Done