TFTP kernel + NFS boot for OpenBMC

Lei YU mine260309 at gmail.com
Tue Dec 26 20:26:13 AEDT 2017


Hi,

There may be intents to boot from NFS for OpenBMC, e.g. for study or
debug purpose:

It could be much faster than flashing the entire chip;
The rw partition has limited size so sometime it is not possible to
override a large file with overlay fs;
It does not impact the original BMC chip at all.

Here are the steps to boot OpenBMC via tftp kernel + nfs root for
palmetto, just for reference.
If this is well accepted, this could be added to openbmc/doc.

Enable NFS related kernel configs, e.g. CONFIG_NFS_FS, CONFIG_ROOT_NFS, etc
Prepare the below files built by OpenBMC:

zImage # The kernel
zImage-aspeed-bmc-opp-palmetto.dtb # The dt blob
image-rofs # The ro part for root fs

On tftp server, prepare uImage because the uboot does not support zImage

# The entry address may be different for different systems
mkimage -A arm -O linux -T kernel -C none -a 0x40008000 -e 0x40008000
-n "Linux kernel" -d zImage uImage

And put the uImage and dtb on tftp root dir;
On NFS server, prepare rootfs by extracting the rofs image:

sudo unsquashfs -f -d <nfsroot-dir> image-rofs

In rootfs, add etc/systemd/network/00-bmc-eth0.network, e.g.

[Match]
Name=eth0
[Network]
Address=192.168.0.60/24
[DHCP]
CriticalConnection=true

This is needed because when systemd-networkd starts, it will
re-initialize the network;
CriticalConnection=true is needed, otherwise it will release the IP
and cause NFS hang.
It could be DHCP or static ip, it does not matter

Now it’s ready, let’s boot from nfs, e.g.

# In uboot, hit any key to stop autoboot
# Config network
setenv ethaddr <mac addr>
setenv ipaddr 192.168.0.60
setenv serverip 192.168.0.10
# Set bootargs to specify nfs rootfs
setenv bootargs root=/dev/nfs rw
nfsroot=192.168.0.10:/nfsroot/obmc-rofs,nolock console=ttyS4,115200n8
ip=192.168.0.60:192.168.0.10:192.168.0.10:255.255.255.0
# Load kernel and dtb
tftp 0x40000000 uImage
tftp 0x40800000 zImage-aspeed-bmc-opp-palmetto.dtb
# Boot from kernel/dtb in ram
bootm 0x40000000 - 0x40800000

With above steps, the BMC works happily on NFS rootfs, I can replace
kernel/services easily.

—
BRs,
Lei YU


More information about the openbmc mailing list