[patch] pxe with tftp improvement

Post there if you plan to contribute to this SystemCd
Posts: 4
Joined: 18 Mar 2011, 15:13

[patch] pxe with tftp improvement

Postby maxx » 18 Apr 2011, 18:59

I posted this a while ago on the wrong board...

Hopefully here it is right and will be included in the next release...

In order to simplify booting sysreccd by PXE i made some improvements
to initram.igz:/init

With these changes you can simpify the pxelinux configuration when
using tftp:

Code: Select all

label mybootentry3
  kernel rescuecd
  append initrd=initram.igz dodhcp netboot=tftp
  ipappend 3

In this case the sysrcd.dat will be obtained from the same server/directory
where the kernel and initrd are.

--- BEGIN PATCH -------------------------------------------------------

Code: Select all

--- init_orig   2011-03-12 14:13:55.000000000 +0100
+++ init   2011-03-12 14:12:33.000000000 +0100
@@ -659,15 +659,20 @@
       sysresccd_panic "Cannot create tmpfs on ${BOOTPATH}"
-   if ! echo "${TFTPBOOT}" | grep -q '^tftp://'
+   if [ "${TFTPBOOT}" = "tftp" -a "${ip}" ]
+      tftpip="`echo ${ip} | cut -d: -f2`"
+      tftpurl="`dirname ${BOOT_IMAGE}`/${LOOPDAT}"
+   elif echo "${TFTPBOOT}" | grep -q '^tftp://'
+   then
+      url="$(echo ${TFTPBOOT} | sed 's!tftp://!!g')" # remote the 'tftp://' prefix
+      tftpip="${url%%/*}"
+      tftpurl="/${url#*/}"
+   else
       sysresccd_panic "You requested an tftp boot, the address is not a valid tftp:// url."
-   good_msg "Downloading ${LOOPDAT} from ${TFTPBOOT}"
-   url="$(echo ${TFTPBOOT} | sed 's!tftp://!!g')" # remote the 'tftp://' prefix
-   tftpip="${url%%/*}"
-   tftpurl="/${url#*/}"
+   good_msg "Downloading ${LOOPDAT} from tftp://${tftpip}/${tftpurl}"
    BOOTMD5=$(echo ${tftpurl} | sed -e "s/${LOOPDAT}/${LOOPMD5}/g") # URL of the md5 file
    cmd1="/bin/busybox tftp -g -r ${BOOTMD5} -l ${BOOTPATH}/${LOOPMD5} ${tftpip}"
    echo "$cmd1"
@@ -1321,6 +1326,12 @@
+      netboot\=tftp)
+         TFTPBOOT=`parse_opt "${x}"`
+         STAGE0='tftp'
+         NETCONFIG='1'
+         NONETMGR='1'
+         ;;
          NFSBOOT=`parse_opt "${x}"`

--- END PATCH ---------------------------------------------------------

I hope you will include this to upcoming releases.

Thank you


BTW. Busybox has a bug displaying the tftp progress bar, don't worry, the
file will be obtained correctly even if the status says "stalled".
--> I reported that bug and now it is fixed in the snapshot (already veryfied by myself)
and so it should be available in the next release (> 1.18.4).
Perhaps you can update busybox then?

Posts: 4
Joined: 18 Mar 2011, 15:13

Re: [patch] pxe with tftp improvement

Postby maxx » 23 Jul 2011, 19:53

Nobody interested???

Posts: 1127
Joined: 07 Apr 2010, 16:19

Re: [patch] pxe with tftp improvement

Postby gernot » 23 Jul 2011, 20:32

Hello Max,
the pxebootserver prefill the pxelinux bootmenu with the correct serveraddress and boot source.
So normal no interaction is needful to boot via PXE.


Return to “Contributions”

Who is online

Users browsing this forum: No registered users and 13 guests