Talk:Bering-uClibc 4.x - User Guide - Appendices - Hints and Tips for Network Booting

From bering-uClibc
Revision as of 16:28, 22 April 2011 by Davidmbrooke (Talk | contribs) (Created to capture design rationale for PXE boot solution)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

I'm going to use this "discussion" page to capture my design rationale for PXE booting on Bering-uClibc 4.x. Please comment (i.e. update this page) if you would like to discuss or propose an alternative design solution for any of the areas where changes from the non-PXE initrd are required. Davidmbrooke 16:28, 22 April 2011 (UTC)


1. Need some way to retrieve files from a remote server so need to include the client component for a file transfer protocol within initrd.lrp.

  • Options: tftp (BusyBox), ftp, ssh, wget, curl,...
  • Design: Use "curl", because it supports a very wide range of protocols using "URL" syntax. While it's not the smallest file size it is the most flexible.
  • Implementation: Need to include the curl executable (/usr/bin/curl) plus the shared libraries it needs in initrd.lrp. Required shared libraries are:
    • /usr/lib/libcurl.so.4
    • /usr/lib/libz.so
    • /lib/libgcc_s.so.1 (included in standard initrd)
    • /lib/libc.so.0 (included in standard initrd)
    • /usr/lib/libssh2.so.1
    • /usr/lib/libssl.so.0.9.8
    • /usr/lib/libcrypto.so.0.9.8
    • /lib/libdl.so.0
    • /lib/ld-uClibc.so.0 (included in standard initrd)
  • Note: Need to ensure that /usr/bin/curl is built before initrd. Add curl to <Requires> in sources.cfg


2. Need to modify /init (managed in Git as repo/initrd/root.linuxrc)

  • This needs to bring up a network interface and run a DHCP client if we are PXE booting. How does it know to do that - can we auto-detect? Don't think so; need something to signal that this should be done. Also need to specify which network interface to use (though it will probably be eth0).
    • Design: Use new kernel command-line argument "LEAFPXEIF" which /init knows as $KCMD_LEAFPXEIF. Add this to pxelinux.cfg (on the APPEND line). If this argument is present then:
      • Bring up the specified network interface (using /sbin/ip)
      • Run a DHCP client
      • Stop the DHCP client at the end of the script, so that the "normal" network startup can proceed
  • Need to know where to look for leaf.cfg and the LRP files. We use $KCMD_LEAFCFG and $PKGPATH for these right now, with values like "/dev/fd0:vfat,/dev/sr0:iso9660" but those only specify "local" devices. We need some way of specifying "remote" locations too.
    • Design: Use "URL" syntax like http://server/path/ or tftp://server/path - basically whatever syntax is accepted by "curl"
  • Don't want to have two versions of /init to maintain, so need to still accept the old-style "device" format as well as the new-style "URL" format.
    • Design: Have the /init script auto-detect which syntax is being used, based on whether it starts "/dev" (old-style) or not. Do this check separately for each of the comma-separated entries in the variables, so something like the following would be legal syntax: /dev/sda1:vfat,http://server/path/leaf.cfg


3. Need to include the kernel Module(s) which implement the device driver for eth0 in initrd.lrp

  • Design: Include all of our "standard" network interface card Modules in directory /lib/modules in initrd.lrp
  • Implementation: Refer to the Modules listed in repo/kmodules/common.cfg and add entries to repo/initrd/buildtool.mk - change the line that reads
    ohci-hcd usb-storage sd_mod sr_mod isofs vfat floppy usbhid >mod ; \
    to read
    ohci-hcd usb-storage sd_mod sr_mod isofs vfat floppy usbhid \
    e100 e1000 e1000e r8169 skge sky2 mii 8139too >mod ; \
    Note that this automatically identifies the further Modules needed as dependencies.


4. Need to include the "ip" command in initrd.lrp, so that we can bring up the network interface.

  • Implementation: /sbin/ip is the executable but that relies on some shared libraries:
    • /lib/libresolv.so.0
    • /lib/libdl.so.0
    • /lib/libgcc_s.so.1 (included in standard initrd)
    • /lib/libc.so.0 (included in standard initrd)
    • /lib/ld-uClibc.so.0 (included in standard initrd)
  • Note: Need to ensure that /sbin/ip is built before initrd. Add iproute to <Requires> in sources.cfg


5. Need to include a DHCP client in initrd.lrp.

  • Design: Use "dhcpcd", our "standard" DHCP client
  • Implementation: /sbin/dhcpcd is the executable. This relies on shared libraries but they are all included in the standard initrd.
  • Note: Need to ensure that /sbin/dhcpcd is built before initrd. Add dhcpcd to <Requires> in sources.cfg
  • TODO: Also need some configuration files and run-time directories for dhcpcd


6. Need to build separate initrd.lrp files for PXE and non-PXE booting. Currently we generate initrd-geode.lrp, initrd-i486.lrp and initrd-i686.lrp

  • Design: Retain the existing initrd-*.lrp files as-is but add initrd-geode_pxe.lrp, initrd-i486_pxe.lrp and initrd-i686_pxe.lrp and rename these to the regular names (removing the "_pxe") in the PXE buildimage.cfg files.