Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- To me it seems like the netboot code is broken, passing parameter ip=dhcp or ip=[CLIENT_IP]:[SERVER_IP]:[GATEWAY_IP]:[NETMASK]:[HOSTNAME]:[DEVICE]:[AUTOCONF] as exampled by ip=10.0.0.1::10.0.0.254:255.255.255.0::eth0 or ip=:::::eth0:dhcp does not allow the configure_network() function to establish networking in the exisitng code. After realising it was the network config that was throwing me off I've put together a patch that replaces configure_network() with a simple ipconfig statement and adds support for netboot=http fetch=http://..../root.squashfs. There is a limitation in the initramfs where there is not dns resolver so url and nfsroot has to be IP address only. iPXE can work around it by letting iPXE resolve dns names and pass IP to kernel.
- As far as I can tell it works with both nfs and http, dhcp and static ip.
- casper-http-simple.patch
- --- initrd/scripts/casper 2016-05-26 11:11:48.505135324 +0200
- +++ initrd-http/scripts/casper 2016-05-26 11:20:21.969120753 +0200
- @@ -32,6 +32,10 @@
- parse_cmdline() {
- for x in $(cat /proc/cmdline); do
- case $x in
- + netboot=*)
- + export NETBOOT="${x#netboot=}";;
- + fetch=*)
- + export URL="${x#fetch=}";;
- showmounts|show-cow)
- export SHOWMOUNTS='Yes' ;;
- persistent)
- @@ -191,26 +195,48 @@
- /sbin/udevadm trigger
- /sbin/udevadm settle
- - ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf | tee /netboot.config
- + #this seems broken.
- + #ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf | tee /netboot.config
- + #replace with very basic netconfig based on ip= parameter
- + case ${STATICIP} in
- + dhcp)
- + ipconfig :::::eth0:dhcp
- + ;;
- + *)
- + ipconfig ${STATICIP}
- + ;;
- + esac
- if [ "${NFSROOT}" = "auto" ]; then
- NFSROOT=${ROOTSERVER}:${ROOTPATH}
- fi
- - [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}"
- -
- - if [ "${NETBOOT}" != "nfs" ] && do_cifsmount ; then
- - rc=0
- - elif do_nfsmount ; then
- - NETBOOT="nfs"
- - export NETBOOT
- - rc=0
- - fi
- + case ${NETBOOT} in
- + nfs)
- + [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}"
- + if do_nfsmount ; then rc=0; fi ;;
- + cifs)
- + [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${NFSROOT}"
- + if do_cifsmount ; then rc=0; fi ;;
- + http|httpfs)
- + [ "$quiet" != "y" ] && log_begin_msg "Trying netboot from ${URL}"
- + if do_httpmount ; then rc=0; fi ;;
- + esac
- [ "$quiet" != "y" ] && log_end_msg
- return ${rc}
- }
- +do_httpmount() {
- + rc=1
- + livefs_root=/tmp/root
- + mkdir -p ${livefs_root}
- + mount -t tmpfs -o size=`wget ${URL} --spider --server-response -O - 2>&1 | sed -ne '/Content-Length/{s/.*: //;p}'` tmpfs ${livefs_root}
- + mkdir -p ${livefs_root}/casper
- + if wget ${URL} -O ${livefs_root}/casper/root.squashfs; then rc=0; fi
- + return ${rc}
- +}
- +
- do_nfsmount() {
- rc=1
- modprobe "${MP_QUIET}" nfs
- patch-initrd-from-iso.sh (asume .iso and .patch is in pwd to start with)
- export TKL=turnkey-core-14.1-jessie-amd64
- rm -rf ~/${TKL}
- mount -o loop ${TKL}.iso /mnt
- mkdir ~/${TKL}
- cp casper-http-simple.patch ~/${TKL}
- cd ~/${TKL}
- cp -r /mnt/casper .
- umount /mnt
- mkdir -p casper/initrd
- cd casper/initrd
- gunzip -c ../initrd.gz | cpio -i
- patch -p1 < ~/${TKL}/casper-http-simple.patch
- find . | cpio -H newc -o | gzip -9 > ../initrd.gz
- cd ..
- rm -r initrd
- tkl.ipxe
- #!ipxe
- set server x.x.x.x
- set path boot/tkl
- #nslookup serverip ${server}
- #set server ${serverip}
- dhcp
- kernel http://${server}/${path}/vmlinuz
- initrd http://${server}/${path}/initrd.gz
- imgargs vmlinuz boot=casper di-live single noinithooks ip=dhcp netboot=http fetch=http://${server}/${path}/10root.squashfs
- boot || shell
- menu entry for pxelinux.0 to chainload iPXE
- label iPXE-TKL
- menu label iPXE ^Turnkey Linux
- kernel ipxe.krn dhcp && chain http://x.x.x.x/boot/tkl.ipxe || shell
- menuentry "iPXE Turnkey Linux" for grub
- {
- linux16 /ipxe.lkrn
- initrd16 /tkl.ipxe
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement