From owner-freebsd-small Tue Nov 5 18:29: 3 2002 Delivered-To: freebsd-small@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EB94237B401 for ; Tue, 5 Nov 2002 18:29:01 -0800 (PST) Received: from mail.cruzio.com (dsl3-63-249-66-221.cruzio.com [63.249.66.221]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B89043E6E for ; Tue, 5 Nov 2002 18:29:01 -0800 (PST) (envelope-from brucem@mail.cruzio.com) Received: (from brucem@localhost) by mail.cruzio.com (8.11.3/8.11.3) id gA631DU02226; Tue, 5 Nov 2002 19:01:13 -0800 (PST) (envelope-from brucem) Date: Tue, 5 Nov 2002 19:01:13 -0800 (PST) From: "Bruce R. Montague" Message-Id: <200211060301.gA631DU02226@mail.cruzio.com> To: bms@spc.org, freebsd-small@FreeBSD.ORG, rizzo@icir.org Subject: Patch to remove perl from picobsd script Sender: owner-freebsd-small@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG FreeBSD-current no longer includes perl in the base installation. However, the picobsd script currently uses perl - as of sometime recent - to binary-edit the "/boot/boot2" boot-track file so as not to try to locate/load the 3rd stage "/boot/loader" at boot-time - it replaces this with "/kernel". Using the same technique that was used to eliminate "write_mfs_in_kernel.c" from the picobsd script, the "boot2" boot-blocks can be updated directly using the "strings" and "dd" utilities as shown in the 2nd patch in the following: --- /usr/src/release/picobsd/build/picobsd Sun Jul 14 12:07:06 2002 +++ picobsd Tue Nov 5 18:46:57 2002 @@ -536,7 +536,7 @@ else disklabel -rw ${l_vndev} auto || fail $? mfs_disklabel fi - newfs -i ${mfs_inodes} -m 0 -p 0 -o space -f 512 -b 4096 \ + newfs -i ${mfs_inodes} -m 0 -o space -f 512 -b 4096 \ /dev/${l_vndev}c > /dev/null mount /dev/${l_vndev}c ${c_mnt} || fail $? no_mount log "`df /dev/${l_vndev}c`" @@ -791,7 +791,11 @@ log "Labeling floppy image" b2=${BUILDDIR}/boot2 # modified boot2 - perl -pne 's/\/boot\/loader/\/kernel\0\0\0\0\0/' ${c_boot2} > ${b2} + cp ${c_boot2} ${b2} + chmod 0644 ${b2} + set `strings -at d ${b2} | grep "/boot/loader"` + echo -e "/kernel\0\0\0\0\0" | dd of=${b2} obs=$1 oseek=1 conv=notrunc + chmod 0444 ${b2} # create a disklabel ... disklabel -Brw -b ${c_boot1} -s ${b2} ${l_vndev} auto || \ @@ -802,7 +806,7 @@ disklabel -R ${l_vndev} /dev/stdin log "Newfs floppy image" - newfs -i ${fd_inodes} -m 0 -p 0 -o space -f 512 -b 4096 \ + newfs -i ${fd_inodes} -m 0 -o space -f 512 -b 4096 \ /dev/${l_vndev}a > /dev/null log "Mounting floppy image" I'd recommend something similar to this patch to eliminate the need for perl; it wasn't required in earlier picobsd script versions, and on a small, slow machine, it's nice to need as little as possible. And POLA and all that... Does this look robust? Regards, - bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-small" in the body of the message