From rd at tilde.se Fri Aug 17 00:01:27 2007 From: rd at tilde.se (Rickard Dahlstrand) Date: Thu, 16 Aug 2007 16:01:27 +0200 Subject: [flashboot] script to write flash directly with split flashboot and msdos partition In-Reply-To: References: Message-ID: <46C458B7.5000106@tilde.se> I think this is a great idea and if it's tested and works we should include it in the dist. Has anyone else tested and used this? Does anyone else find this useful? Rickard. Marcel Wiget wrote: > While looking for a way to use larger than 128mb compact flash cards > and an easy way to > > a) use Windows or OS/X to write configs and binaries directly on a flash card > b) avoid the "do you want to initialize the flash" question in OS/X > (and possible windows) > c) A way to upload SW updates to a flashboot running device safely > with recovery possibilities > > I created a little script, based on build-diskimage.sh that creates 2 > partitions on the flash, split the available space in half and make > the OpenBSD one bootable and populated with a generated kernel image. > The idea, when running from ramdisk with modified rc scripts, is to > allow the user to upload new configs/images/packages to the msdos > partition, do some sanity checks, and then copy it over to the > production part of the flash. > > WRAP specific issue with >128MB compact flash cards: The BIOS detects > a different flash geometry than a PC. I found a workaround by starting > the bootable OpenBSD partition on the last sector of the first track > and head. It worked for my 128MB, 512MB and 1GB compact flash cards. > Not sure if it breaks on other platforms though. > > Feel free to incorporate this script (or portions/ideas) into > flashboot distribution if deemed useful. > > Marcel > > > > #!/bin/sh > # > # $Id$ > # > # Written by Marcel Wiget in 2007 > # portions based on flashboot build-diskimage.sh > # flashboot can be found at http://www.mindrot.org/projects/flashboot/) > > BASE=`pwd` > DESTDIR=${DESTDIR:-${BASE}/flash-dist} > KERNELFILE=${KERNELFILE:-${BASE}/obj/bsd.gz} > SUDO=sudo > MOUNTPOINT=/mnt > > # This is for boot.conf and should match the kernel ttyspeed. > # Which should be 9600 for GENERIC-RD, 38400 for WRAP12 and 19200 for the rest. > TTYSPEED=${TTYSPEED:-38400} > > # Don't start without a device contain the fash as a parameter > if [ "$1" = "" ]; then > cat << __EOC > > usage: $0 device > > This script erases any existing data on the specified flash drive > and creates 2 equal size partitions and formats them, a bootable > flashboot OpenBSD partition and a FAT-32 formatted MSDOS partition. > > The OpenBSD partition will be updated and configured with the flashboot > standard distribution. A properly installed and compiled flashboot > distribution is required. See http://www.mindrot.org/projects/flashboot/ > > WARNING: the content of the specified flash device will be DESTROYED! > > Example: $0 sd0 > > __EOC > exit 1 > fi > > DEVICE=$1 > > # Does the kernel exist at all > if [ ! -r $KERNELFILE ]; then > echo "ERROR! $KERNELFILE does not exist or is not readable." > exit 1 > fi > > # get fdisk info from DEVICE > GEOMETRY=`${SUDO} fdisk $DEVICE 2>/dev/null | grep geometry: | awk > '{print $4}' ` > > # device for real? > if [ "X$GEOMETRY" == "X" ]; then > echo "ERROR! /dev/$DEVICE does not exist or cant read flash geometry." > exit 1 > fi > # > echo -n "\n$DEVICE: Geometry is $GEOMETRY " > > cylinders=`echo $GEOMETRY | cut -d / -f 1` > heads=`echo $GEOMETRY | cut -d / -f 2` > sectors=`echo $GEOMETRY | cut -d / -f 3` > let flashsize=$cylinders*$heads*$sectors/2048 > > echo "and holds about $flashsize MBytes" > > # sanity check. If the flash is bigger than 1GB, we're probably > # dealing with a HD instead of a flash card! > > > if [ "$flashsize" -gt "1024" ]; then > echo "\nERROR! /dev/$DEVICE seems rather large ($flashsize MB)." > echo "If you're sure this isn't your HD, please modify this script." > echo "This script assumes flash cards used are <= 512MB" > exit 1 > fi > > echo "\nReady to partition and format flash drive in /dev/$DEVICE" > echo "Hit ^C now if you're not sure this is the right flash or" > echo "Enter to continue" > > read null > > # calculate CHS start end for OpenBSD and MSDOS partition > let startcyl1=0 > let endcyl1=$cylinders/2 > let startcyl2=$endcyl1+1 > let endcyl2=$cylinders-1 > let head=$heads-1 > > # Create a new Master Boot Record with 2 partitions: > # 0: OpenBSD bootable (where we will addd a disklabel) > # 3: MSDOS partition > # A standard behaviour of fdisk when using reinit is assumed. > > # Using the odd starting CHS of 0/0/32 helps us getting around > # the problem on WRAP platforms where the bootstrap code has > # a different oppinion about the flash's geometry. > > ${SUDO} fdisk -ye $DEVICE << __EOC >/dev/null 2>&1 > reinit > edit 0 > A6 > 0 > 0 > 32 > $endcyl1 > $head > $sectors > edit 3 > 0B > $startcyl2 > 0 > 1 > $endcyl2 > $head > $sectors > flag 0 > update > quit > __EOC > > echo "\nNew partition table:" > ${SUDO} fdisk $DEVICE 2>/dev/null > > # Edit now the new disklabel by defining partition a > ${SUDO} disklabel -c -d -E $DEVICE << __EOC >/dev/null 2>&1 > m a > 4.2BSD > > > w > q > __EOC > > # disklabel $DEVICE > > # initialize both new filesystems: > echo "\nFormat MSDOS Partition:" > ${SUDO} newfs_msdos -L OpenBSD /dev/r${DEVICE}i > echo "\nFormat OpenBSD Partition:" > ${SUDO} newfs /dev/r${DEVICE}a > > echo "\nMounting destination to ${MOUNTPOINT}..." > if ! ${SUDO} mount -o async /dev/${DEVICE}a ${MOUNTPOINT}; then > echo Mount failed.. > exit > fi > > echo "" > echo "Copying bsd kernel, boot blocks and /etc/boot.conf..." > ${SUDO} cp ${DESTDIR}/usr/mdec/boot ${MOUNTPOINT}/boot > ${SUDO} cp ${KERNELFILE} ${MOUNTPOINT}/bsd > ${SUDO} mkdir ${MOUNTPOINT}/etc > ${SUDO} sed "/^stty/s/19200/${TTYSPEED}/" < > ${BASE}/initial-conf/boot.conf > boot.conf$$ > ${SUDO} cp boot.conf$$ ${MOUNTPOINT}/etc/boot.conf > ${SUDO} rm -f boot.conf$$ > > echo "" > echo "Installing boot blocks..." > ${SUDO} /usr/mdec/installboot ${MOUNTPOINT}/boot > ${DESTDIR}/usr/mdec/biosboot ${DEVICE} > > ${SUDO} mkdir ${MOUNTPOINT}/conf > ${SUDO} mkdir ${MOUNTPOINT}/pkg > # Here is where you add your own packages and configuration to the flash... > > echo "" > echo "Unmounting and cleaning up..." > ${SUDO} umount $MOUNTPOINT > exit 0 > ################################################ > _______________________________________________ > flashboot mailing list > flashboot at mindrot.org > https://lists.mindrot.org/mailman/listinfo/flashboot > From rd at tilde.se Fri Aug 17 01:41:14 2007 From: rd at tilde.se (Rickard Dahlstrand) Date: Thu, 16 Aug 2007 17:41:14 +0200 Subject: [flashboot] New kernels and images.. Message-ID: <46C4701A.9030604@tilde.se> Hi, New 4.1 kernels with the 009-patch and the latest flashboot-utils are up at http://tilde.se/flashboot/ All the changes can be found in the changelog http://tilde.se/flashboot/download/4.1/ChangeLog however the biggest news at this point is the addition of a backupconfig-script. This script will take all files in /etc/ (and others dirs if you tell it to) and copy the changed files over to flash. Also the script createconfig that helps the user setup initial configuration much like the install-system in normal OpenBSD. For me this represents a significant move to a much more user-friendly distribution that hopefully will attract new users (not) :-) Rickard. PS. The cvs has been broken for a while, Niclas restored the functionality of the comment in the end if rc by changing "mount /flash/" to "mount -A". This however meant the the fstab which contained noauto for /flash/ did not mount /flash/. Binaries above are fixed, CVS should be updated within a day or so. From djm at fuyu.mindrot.org Sat Aug 18 11:55:29 2007 From: djm at fuyu.mindrot.org (Damien Miller) Date: Sat, 18 Aug 2007 11:55:29 +1000 (EST) Subject: [flashboot] CVS: fuyu.mindrot.org: flashboot Message-ID: <20070818015529.9FFC03C6B2@fuyu.mindrot.org> CVSROOT: /var/cvs Module name: flashboot Changes by: djm at fuyu.mindrot.org 07/08/18 11:55:29 Modified files: . : ChangeLog list Log message: - (djm) Typo in list file, from Alexandre Anriot Diff commands: cvs -nQq rdiff -u -r1.153 -r1.154 flashboot/ChangeLog cvs -nQq rdiff -u -r1.53 -r1.54 flashboot/list CVSWeb: http://cvsweb.mindrot.org/index.cgi/flashboot/ChangeLog?r1=1.153;r2=1.154 http://cvsweb.mindrot.org/index.cgi/flashboot/list?r1=1.53;r2=1.54 Please note that there may be a delay before commits are available on the public CVSWeb site. From djm at fuyu.mindrot.org Sat Aug 18 21:47:27 2007 From: djm at fuyu.mindrot.org (Damien Miller) Date: Sat, 18 Aug 2007 21:47:27 +1000 (EST) Subject: [flashboot] CVS: fuyu.mindrot.org: flashboot Message-ID: <20070818114727.E95C63C6B2@fuyu.mindrot.org> CVSROOT: /var/cvs Module name: flashboot Changes by: djm at fuyu.mindrot.org 07/08/18 21:47:27 Modified files: . : COMMELL-LE564 ChangeLog Log message: - (djm) Add re (Realtek ethernet) and rgephy to Commell kernel Diff commands: cvs -nQq rdiff -u -r1.9 -r1.10 flashboot/COMMELL-LE564 cvs -nQq rdiff -u -r1.154 -r1.155 flashboot/ChangeLog CVSWeb: http://cvsweb.mindrot.org/index.cgi/flashboot/COMMELL-LE564?r1=1.9;r2=1.10 http://cvsweb.mindrot.org/index.cgi/flashboot/ChangeLog?r1=1.154;r2=1.155 Please note that there may be a delay before commits are available on the public CVSWeb site. From niclas.rosell at iis.se Wed Aug 29 01:50:45 2007 From: niclas.rosell at iis.se (Niclas Rosell) Date: Tue, 28 Aug 2007 17:50:45 +0200 Subject: [flashboot] New build-livecd.sh script to create bootable cdrom Message-ID: <1188316245.17529.19.camel@localhost> Hi all. I have been working on a new build script to create a bootable cd from flashboot. I have tried not to interfere with existing code and the only change/addition is in list.largekernel where the directory /cd is added as a mount point for the cd. The rest is in done in build_livecd.sh and with two new files (initial-conf/boot.conf.iso and initial-conf/fstab.initial.iso). Backups can be stored to USB memories but I do have some issues with certain types of memory sticks but that is more of a compatibility/driver issue with OpenBSD i think. Anyway, please take a look at it and tell me what You think. Regards Niclas Rosell -------------- next part -------------- A non-text attachment was scrubbed... Name: flashboot_iso.diff Type: text/x-patch Size: 6791 bytes Desc: not available Url : http://lists.mindrot.org/pipermail/flashboot/attachments/20070828/8bf50be2/attachment-0002.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: Detta =?ISO-8859-1?Q?=E4r?= en digitalt signerad meddelandedel Url : http://lists.mindrot.org/pipermail/flashboot/attachments/20070828/8bf50be2/attachment-0003.bin From jbg at masterplan.org Fri Aug 31 23:35:39 2007 From: jbg at masterplan.org (Jason George) Date: Fri, 31 Aug 2007 07:35:39 -0600 (MDT) Subject: [flashboot] flashboot build issue? Message-ID: <20070831073350.W14913@ingenuity.resourcechain.com> Damien asked me to forward this to the list. I'll also add that my system is running the Aug 23 snapshot: OpenBSD 4.2 (GENERIC) #374: Thu Aug 23 10:41:10 MDT 2007 deraadt at i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC cpu0: Intel Pentium III ("GenuineIntel" 686-class, 128KB L2 cache) 898 MHz cpu0: FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXS R,SSE ---------- Forwarded message ---------- Date: Thu, 30 Aug 2007 22:43:37 -0600 (MDT) From: Jason George To: djm at mindrot.org Subject: flashboot build issue? Hi - I was wondering if there is an issue with 4.2-based source tree and flashboot. I hadn't run any of the build scripts in about 3.5 months (around the time of the hackathon) but noticed yesterday that my scripts from January were now failing on the build-release portion. (They'd been running fine in different incarnations for well over a year) Initially, they failed trying to install the man page for ypclnt.3. This caused me to start digging. I then downloaded the 20070830 snapshot and encountered the same issue. I tracked it down to the options in mk-mini.conf. If I leave various options of KERBEROS, YP, etc equal to NO, then the build fails in different places when trying to install. My setup involves building a raw, clean source tree from fresh cvs tree from a daily cvsync snapshot. I merge my custom binaries in much later (nothing to do with the build-release script) so that isn't the cause. Any thoughts? A standard build-world from /usr/src works just fine. It's the mk-mini options that are crating the build for me. Did something change in "make" and how it handle its options in the last number of months that I've missed? Commenting options below allows the build-release to run to completion, and the followup scripts to build a compressed kernel, etc run, but the implication is that Kerberos is now compiled in, etc... Thanks! --Jason # more mk-mini.conf # $Id: mk-mini.conf,v 1.1 2006/08/26 17:52:44 jakob Exp $ WARNINGS=yes PIPE=-pipe STATIC= DEBUG= #KERBEROS=no #KERBEROS5=no #YP=no #AFS=no #TCP_WRAPPERS=no # more build-release.sh #!/bin/sh # # $Id: build-release.sh,v 1.2 2006/09/03 18:28:33 jakob Exp $ set -xe ### PATH = /v00/embedded/src/ResourceChain/flashboot-20070830/ BASE=`pwd` #BSDSRCDIR=${BSDSRCDIR:-/usr/src} BSDSRCDIR=${BSDSRCDIR:-/v00/embedded/src/OpenBSD/OpenBSD-current/src} #BSDOBJDIR=${BSDOBJDIR:-${BASE}/flash-obj} BSDOBJDIR=${BSDOBJDIR:-/v00/embedded/obj/flashboot/flash-obj} #DESTDIR=${DESTDIR:-${BASE}/flash-dist} DESTDIR=${DESTDIR:-/v00/embedded/obj/flashboot/flash-dist} _MINI=-mini RELEASEDIR=${BASE}/release${_MINI} MAKECONF=${BASE}/mk${_MINI}.conf SUDO=sudo export BSDSRCDIR BSDOBJDIR DESTDIR RELEASEDIR MAKECONF SUDO cd ${BSDSRCDIR} mkdir -p ${BSDOBJDIR} ${DESTDIR} if [ "x$1" != "xbuilt" ] ; then rm -rf ${DESTDIR}/* make -k cleandir rm -rf ${BSDOBJDIR}/* make obj cd etc make distrib-dirs cd .. make build fi cd etc make distribution-etc-root-var cd .. #