Date: Tue, 5 Nov 2002 19:01:13 -0800 (PST) From: "Bruce R. Montague" <brucem@mail.cruzio.com> To: bms@spc.org, freebsd-small@FreeBSD.ORG, rizzo@icir.org Subject: Patch to remove perl from picobsd script Message-ID: <200211060301.gA631DU02226@mail.cruzio.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211060301.gA631DU02226>
