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
Index: ChangeLog
===================================================================
RCS file: /cvs/flashboot/ChangeLog,v
retrieving revision 1.156
diff -u -r1.156 ChangeLog
--- ChangeLog	22 Aug 2007 05:51:49 -0000	1.156
+++ ChangeLog	28 Aug 2007 15:00:37 -0000
@@ -1,3 +1,11 @@
+20070828
+ - (niclas) New build-livecd.sh script for creating bootable iso images
+ - (niclas) Add directory /cd to list.largekernel
+ - (niclas) New file boot.conf.iso
+ - (niclas) New file fstab.initial.iso
+ - (niclas) Add iso to build-bindist.sh
+ - (niclas) Add instructions to README
+
 20070818
  - (aanriot) Include mg(1)
  - (djm) Typo in list file, from Alexandre Anriot
Index: README
===================================================================
RCS file: /cvs/flashboot/README,v
retrieving revision 1.16
diff -u -r1.16 README
--- README	20 Jun 2007 16:15:20 -0000	1.16
+++ README	28 Aug 2007 15:00:38 -0000
@@ -165,6 +165,31 @@
 entries are transferred (see TERMTYPES in the Makefile).
 
 
+Creating bootable cd
+--------------------
+
+To create an iso image suitable for booting and running flashboot
+on a x86 PC, first read the build instructions above. Step 1 and 2 
+must be successfull and in step 3 use the build-livecd.sh script with 
+the GENERIC-RD kernel config.
+
+    # ./build-livecd.sh GENERIC-RD
+
+The build-live_cd.sh script will create the directory live_cd before
+creating the image. Everything in this directory will be included on the
+cd. The files cdbr, cdboot etc/boot.conf is required for booting. To
+customize the cd with additional data, create the directory live_cd in
+advance and populate with data and modify rc.{init|more} as needed.
+The build-livecd.sh will use the default flashboot config files 
+and make modifications prior to ramdisk creation. Any customisation to 
+ramdisk setup should be done by editing build-livecd.sh.
+
+If everything worked then you should find a new iso image in 
+obj/live_cd{version}.iso. Without any customisation the iso is roughly 
+9MB in size. Finally... burn the iso with your favorite cd burning 
+program.
+
+
 Support and bug reporting
 -------------------------
 
Index: build-bindist.sh
===================================================================
RCS file: /cvs/flashboot/build-bindist.sh,v
retrieving revision 1.2
diff -u -r1.2 build-bindist.sh
--- build-bindist.sh	20 Jun 2007 16:15:20 -0000	1.2
+++ build-bindist.sh	28 Aug 2007 15:00:38 -0000
@@ -81,3 +81,7 @@
 ./build-diskimage.sh image
 gzip image
 mv image.gz bindist/${DISTNAME}.large.image
+
+DISTNAME=LIVE_CD-4.1
+./build-livecd.sh GENERIC-RD
+cp obj/${DISTNAME}.iso bindist/${DISTNAME}.iso
Index: build-livecd.sh
===================================================================
RCS file: build-livecd.sh
diff -N build-livecd.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ build-livecd.sh	28 Aug 2007 15:00:38 -0000
@@ -0,0 +1,92 @@
+#!/bin/ksh
+#
+# Builds a 20MB kernel to boot from cd and creates iso image 
+
+BASE=`pwd`
+SRCDIR=${BSDSRCDIR:-/usr/src}
+DESTDIR=${DESTDIR:-${BASE}/flash-dist}
+SUDO=sudo
+
+DISKTAB=disktab.20mb
+NBLKS=40960
+
+export SRCDIR DESTDIR SUDO
+
+# Don't start without a kernel as a parameter
+if [ "$1" = "" ]; then
+  echo "usage: $0 kernel"
+  exit 1
+fi
+
+# Does the kernel exist at all
+if [ ! -r $1 ]; then
+  echo "ERROR! $1 does not exist or is not readable."
+  exit 1
+fi
+
+# Create dir if not there
+mkdir -p obj
+
+# Create a templist
+cat list.largekernel list > list.temp
+
+# Modify list.temp to use fstab.initial.iso
+cat list.temp | sed 's/fstab.initial/fstab.initial.iso/' > list.temp
+
+# Modify mount options in rc.initial. USB memories will not work
+# with sync option 
+cat initial-conf/rc.initial | sed 's/rw,sync,noatime/rw,noatime/' > \
+initial-conf/rc.initial.iso
+
+# Modify list.temp to use rc.initial.iso
+cat list.temp | sed 's/rc.initial/rc.initial.iso/' > list.temp
+
+# Which kernel to use?
+export KERNEL=$1.LARGE
+
+# Create the kernelfile (with increased MINIROOTSIZE)
+grep -v MINIROOTSIZE $1 > $KERNEL
+echo "option MINIROOTSIZE=${NBLKS}" >> $KERNEL
+
+# Cleanup just in case the previous build failed
+${SUDO} umount /mnt/ 
+${SUDO} vnconfig -u vnd0
+make KCONF=${KERNEL} clean
+
+# Make kernel
+make KCONF=${KERNEL} LIST=${BASE}/list.temp NBLKS=${NBLKS} \
+DISKPROTO=${BASE}/disktabs/${DISKTAB} $2 $3 $4
+
+# Cleanup
+rm -f list.temp
+rm -f $KERNEL
+rm -f initial-conf/rc.initial.iso
+
+# Done
+echo "Your kernel is stored here ${BASE}/obj/"
+
+# Prepare directory for creating cd image
+
+mkdir -p live_cd/etc
+cp flash-dist/usr/mdec/cdbr live_cd/cdbr
+cp flash-dist/usr/mdec/cdboot live_cd/cdboot
+cp initial-conf/boot.conf.iso live_cd/etc/boot.conf
+cp obj/bsd.gz live_cd/bsd
+
+# Create the image
+
+vers="4.1"
+#/usr/local/bin/mkisofs -no-iso-translate \
+#-R -T -allow-leading-dots -l -d -D -N -v \
+#-V "LiveCD flashboot-${vers}" -A "LiveCD flashboot-${vers}" \
+#-b cdboot -no-emul-boot -c boot.catalog \
+#-o ./obj/LIVE_CD-${vers}.iso ./live_cd
+/usr/sbin/mkhybrid -R -T -l -L -d -D -N -v \
+-V "LiveCD flashboot-${vers}" \
+-A "LiveCD flashboot-${vers}" \
+-b cdbr \
+-c boot.catalog \
+-o ./obj/LIVE_CD-${vers}.iso \
+./live_cd/
+
+echo "Your iso image is here ${BASE}/obj/LIVE_CD-${vers}.iso"
Index: list.largekernel
===================================================================
RCS file: /cvs/flashboot/list.largekernel,v
retrieving revision 1.7
diff -u -r1.7 list.largekernel
--- list.largekernel	16 Aug 2007 18:16:40 -0000	1.7
+++ list.largekernel	28 Aug 2007 15:00:38 -0000
@@ -27,6 +27,9 @@
 COPY	${DESTDIR}/usr/lib/libwrap.so.4.0	usr/lib/libwrap.so.4.0
 COPY	${DESTDIR}/usr/lib/libpthread.so.7.0	usr/lib/libpthread.so.7.0
 
+# Create mountpoint for cdrom
+SPECIAL mkdir ./cd
+
 # Generate flashboot.mtree again.
 SPECIAL mtree -s2121 -x -c -k mode,nlink,size,link,cksum -p ./ > etc/flashboot.mtree
 
Index: initial-conf/boot.conf.iso
===================================================================
RCS file: initial-conf/boot.conf.iso
diff -N initial-conf/boot.conf.iso
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ initial-conf/boot.conf.iso	28 Aug 2007 15:00:38 -0000
@@ -0,0 +1,2 @@
+set image /bsd
+set timeout 3
Index: initial-conf/fstab.initial.iso
===================================================================
RCS file: initial-conf/fstab.initial.iso
diff -N initial-conf/fstab.initial.iso
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ initial-conf/fstab.initial.iso	28 Aug 2007 15:00:38 -0000
@@ -0,0 +1,3 @@
+/dev/rd0a	/	ffs	rw				0 0
+/dev/sd0i	/flash	msdos	ro,noauto,noatime		0 0
+/dev/cd0a	/cd	cd9660	ro,noauto			0 0

Attachment: signature.asc
Description: Detta är en digitalt signerad meddelandedel

_______________________________________________
flashboot mailing list
[email protected]
https://lists.mindrot.org/mailman/listinfo/flashboot

Reply via email to