patch: flashdist - openbsd3.9

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

patch: flashdist - openbsd3.9

Manuel Pata
Ora aqui vai um pequeno patch para o flashdist que remove os debug
symbols das libraries do openbsd 3.9 de forma a caber tudo num
CompactFlash de 32mb. (para desactivar esta nova funcionalidade correr o
flashdist com o argumento -g no final)

Este patch também impede o Soekris de ficar parado eternamente no
bootloader à espera de uma intervenção do utilizador.

Testem e digam qualquer coisa ;)

Dica para não estarem sempre a escrever no CF:
dd if=/dev/zero of=soekris.img bs=1k count=3200
vndconfig svndX soekris.img

"Flashdist is an embedded OpenBSD installer. It will install OpenBSD
onto an attached disk, such as an IDE or USB CompactFlash adapter,
Disk-On-Module, hard disk, or whatever. It is designed to install a
minimal version of OpenBSD with features for networking"

Manuel Pata
pata (ate) alface (dote) de

--- Mon Jan 16 10:25:32 2006
+++ Mon Apr  3 06:51:15 2006
@@ -129,7 +129,7 @@
- echo "Usage: [-d] <disk device name> <distfile> <bsd kernel> <openbsd base>"
+ echo "Usage: [-d] <disk device name> <distfile> <bsd kernel> <openbsd base> -g"
  echo "-d >> this option will cause disklabel to always initialize the media with"
  echo "      the kernel's current idea of the disk geometry even if the old disklabel"
@@ -138,6 +138,7 @@
  echo "distfile >> distribution list file name"
  echo "bsd kernel >> kernel to install on your flash"
  echo "openbsd base >> unpacked OpenBSD distribution (unpacked baseXX.tgz, etcXX.tgz)"
+ echo "-g >> keep debug symbols (needs more space)"
  echo "example:"
  echo " sd0 flashsmall.txt /usr/src/sys/arch/i386/compile/NET4501/bsd /tmp/openbsd"
@@ -366,6 +367,7 @@
 echo Checking distribution list...
+mkdir /tmp/libstrip
 # Peanut Butter Wolf, give the people some technology!
 for i in `cat $2`; do
  if [ ! -f $4/$i -a ! -h $4/$i -a ! -d $4/$i ]; then
@@ -398,6 +400,18 @@
 cat $TB >> $TA
 rm $TB
+if [ "$5" != "-g" ]; then
+        for l in `cat $TA`; do
+                grep=`echo $l | grep "./usr/lib/"`
+                if [ "$grep" != "" ]; then
+                        newlib=/tmp/libstrip/`echo $l | sed -e "s/.\/usr\/lib\///g"`
+                        echo Stripping $4/$l
+                        objcopy -g $4/$l $newlib
+                        mv $newlib $4/$l
+                fi
+        done
 # This $asize method seems to create a disklabel which works
@@ -474,7 +488,8 @@
 echo Copying bsd kernel, boot blocks, /etc/resolv.conf...
 cp $4/usr/mdec/boot $TT/boot
 cp /etc/resolv.conf $TT/etc/resolv.conf
-cp $3 $TT/bsd
+cp $3 /tmp/bsd
+gzip -o $TT/bsd /tmp/bsd
 echo Installing boot blocks...
 /usr/mdec/installboot $TT/boot $4/usr/mdec/biosboot $1
@@ -614,6 +629,9 @@
   if [ -f $i ]; then
    echo -n " $i"
    cp $i $TT/etc
+   if [ "$i" == "boot.conf" ]; then
+ echo "boot bsd" >> $TT/etc/$i;
+   fi
    echo WARNING: Unable to copy \"$i\" to destination filesystem, must be done manually
@@ -658,6 +676,7 @@
 echo -n Unmounting filesystem...
 umount $TT
 rmdir $TT
+rmdir /tmp/libstrip
 rm $T $TA
 echo done!

OpenBSD mailing list
[hidden email]