Bug 29680

Summary: picobsd in -current needs mdconfig
Product: Base System Reporter: Rob Mallory <rmallory>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description Rob Mallory 2001-08-13 20:20:01 UTC
/src/release/picobsd/build/Makefile.conf needs $COMPILE  to ref $ARCH/compile, and there is quite a bit of work to UNBLOAT the kernel,
but here is the basic patch to fix up the picobsd script to use mdconfig
instead of deprecated vnconfig.

*** picobsd	Thu Jun 21 08:49:46 2001
--- picobsd_mdconfig	Tue Jul 24 20:10:46 2001
***************
*** 77,87 ****
      SITE=${SITE:-}
      FLOPPY_SIZE=${FLOPPY_SIZE:-1440}
  
-     NO_DEVFS=yes # DEVFS is currently broken. Always set this.
- 
      # Find a suitable vnode
!     VNUM=`mount | awk "/vn/ { num++ } END { printf \"%d\", num }"`
!     log "---> Using vn${VNUM}..."
  
      # Location of the boot blocks (in case you want them custom-built)
      boot1=/boot/boot1
--- 77,85 ----
      SITE=${SITE:-}
      FLOPPY_SIZE=${FLOPPY_SIZE:-1440}
  
      # Find a suitable vnode
!     VNUM=`mount | awk "/md/ { num++ } END { printf \"%d\", num }"`
!     log "---> Using ${VNUM}..."
  
      # Location of the boot blocks (in case you want them custom-built)
      boot1=/boot/boot1
***************
*** 365,371 ****
      log "---> Preparing kernel \"$name\" in $MY_TREE"
      (cd $MY_TREE; export name SRC CONFIG # used in this makefile ;
  	make -v -f ${PICO_TREE}/build/Makefile.conf )
!     cp -p ${SRC}/sys/compile/PICOBSD-${name}/kernel ${BUILDDIR}/kernel || \
  	fail $? missing_kernel
      (cd ${BUILDDIR};
      strip kernel
--- 363,369 ----
      log "---> Preparing kernel \"$name\" in $MY_TREE"
      (cd $MY_TREE; export name SRC CONFIG # used in this makefile ;
  	make -v -f ${PICO_TREE}/build/Makefile.conf )
!     cp -p ${SRC}/sys/i386/compile/PICOBSD-${name}/kernel ${BUILDDIR}/kernel || \
  	fail $? missing_kernel
      (cd ${BUILDDIR};
      strip kernel
***************
*** 445,457 ****
      # installed so you have more space on the disk...
      # For small image sizes, use std disktypes
      if [ ${MFS_SIZE} -lt 1024 ] ; then
! 	disklabel -rw vn${VNUM} fd${MFS_SIZE} || fail $? mfs_disklabel
      else
! 	disklabel -rw vn${VNUM} auto || fail $? mfs_disklabel
      fi
!     newfs -i ${MFS_INODES} -m 0 -p 0 -o space /dev/rvn${VNUM}c > /dev/null
!     mount /dev/vn${VNUM}c ${MFS_MOUNTPOINT} || fail $? no_mount
!     log "`df /dev/vn${VNUM}c`"
  }
  
  # Populate the memory filesystem with binaries and non-variable
--- 443,455 ----
      # installed so you have more space on the disk...
      # For small image sizes, use std disktypes
      if [ ${MFS_SIZE} -lt 1024 ] ; then
! 	disklabel -rw md${VNUM} fd${MFS_SIZE} || fail $? mfs_disklabel
      else
! 	disklabel -rw md${VNUM} auto || fail $? mfs_disklabel
      fi
!     newfs -i ${MFS_INODES} -m 0 -p 0 -o space /dev/md${VNUM}c > /dev/null
!     mount /dev/md${VNUM}c ${MFS_MOUNTPOINT} || fail $? no_mount
!     log "`df /dev/md${VNUM}c`"
  }
  
  # Populate the memory filesystem with binaries and non-variable
***************
*** 480,490 ****
      ln -s /dev/null ${MFS_MOUNTPOINT}/var/run/log
      ln -s /etc/termcap ${MFS_MOUNTPOINT}/usr/share/misc/termcap
  
-     if [ "${NO_DEVFS}" != "" ] ; then
- 	(cd ${MFS_MOUNTPOINT}/dev ; ln -s /dev/MAKEDEV ;
- 	    ./MAKEDEV ${MY_DEVS}; rm MAKEDEV)
-     fi
- 
      (
      cd ${BUILDDIR}/crunch
      log "---> Making and installing crunch1 from `pwd`..."
--- 478,483 ----
***************
*** 530,544 ****
      (log "---> Fixing permissions"; cd ${MFS_MOUNTPOINT}; chown -R root . )
      df -ik ${MFS_MOUNTPOINT}
      umount ${MFS_MOUNTPOINT}
!     fsck -p /dev/rvn${VNUM}c
!     vnconfig -u vn${VNUM}
  }
  
  # free as much as possible from the vnode
  free_vnode() {
      umount ${MFS_MOUNTPOINT}    2> /dev/null || true
!     umount /dev/vn${VNUM}       2> /dev/null || true
!     vnconfig -u vn${VNUM} 2> /dev/null || true
  }
  
  final_cleanup() {
--- 523,537 ----
      (log "---> Fixing permissions"; cd ${MFS_MOUNTPOINT}; chown -R root . )
      df -ik ${MFS_MOUNTPOINT}
      umount ${MFS_MOUNTPOINT}
!     fsck -p /dev/md${VNUM}c
!     mdconfig -a -t vnode -u ${VNUM}
  }
  
  # free as much as possible from the vnode
  free_vnode() {
      umount ${MFS_MOUNTPOINT}    2> /dev/null || true
!     umount /dev/md${VNUM}       2> /dev/null || true
!     mdconfig -d -u ${VNUM} 2> /dev/null || true
  }
  
  final_cleanup() {
***************
*** 555,568 ****
      echo "---> fail: Error <$errno> error code <$errcode>"
      case $errcode in
      no_vnconfig)
! 	echo "Error while doing vnconfig of ${imgname} on /dev/rvn${VNUM}..."
  	echo "   Most probably your running kernel doesn't have the vn(4) device."
  	;;
      mfs_disklabel)
  	echo "Error while labeling ${MFS_NAME} size ${MFS_SIZE}"
  	;;
      no_mount)
! 	echo "Error while mounting ${MFS_NAME} (/dev/vn${VNUM}c) on ${MFS_MOUNTPOINT}"
  	;;
      mtree)
  	echo "Error while making hierarchy in ${MFS_MOUNTPOINT}"
--- 548,561 ----
      echo "---> fail: Error <$errno> error code <$errcode>"
      case $errcode in
      no_vnconfig)
! 	echo "Error while doing vnconfig of ${imgname} on /dev/md${VNUM}..."
  	echo "   Most probably your running kernel doesn't have the vn(4) device."
  	;;
      mfs_disklabel)
  	echo "Error while labeling ${MFS_NAME} size ${MFS_SIZE}"
  	;;
      no_mount)
! 	echo "Error while mounting ${MFS_NAME} (/dev/md${VNUM}c) on ${MFS_MOUNTPOINT}"
  	;;
      mtree)
  	echo "Error while making hierarchy in ${MFS_MOUNTPOINT}"
***************
*** 599,605 ****
      dd if=/dev/zero of=${imgname} count=${imgsize} bs=1k 2> /dev/null
      dd if=${boot1}  of=${imgname} conv=notrunc 2> /dev/null
  
!     vnconfig -c -s labels vn${VNUM} ${imgname} || fail $? no_vnconfig
  }
  
  
--- 592,598 ----
      dd if=/dev/zero of=${imgname} count=${imgsize} bs=1k 2> /dev/null
      dd if=${boot1}  of=${imgname} conv=notrunc 2> /dev/null
  
!     mdconfig -a -t vnode -u ${VNUM} -f ${imgname} || fail $? no_vnconfig
  }
  
  
***************
*** 619,630 ****
      log "---> Labeling floppy image"
      b2=${BUILDDIR}/boot2 # modified boot2
      perl -pne 's/\/boot\/loader/\/kernel\0\0\0\0\0/' ${boot2} > ${b2}
!     disklabel -Brw -b ${boot1} -s ${b2} vn${VNUM} fd${FLOPPY_SIZE} || \
  	fail $?  floppy_disklabel
  
!     newfs -i ${FLOPPY_INODES} -m 0 -p 0 -o space /dev/vn${VNUM}c > /dev/null
  
!     mount /dev/vn${VNUM}c ${MFS_MOUNTPOINT}
  
      # preload kernel, compress with kgzip and copy to floppy image
      (
--- 612,623 ----
      log "---> Labeling floppy image"
      b2=${BUILDDIR}/boot2 # modified boot2
      perl -pne 's/\/boot\/loader/\/kernel\0\0\0\0\0/' ${boot2} > ${b2}
!     disklabel -Brw -b ${boot1} -s ${b2} md${VNUM} fd${FLOPPY_SIZE} || \
  	fail $?  floppy_disklabel
  
!     newfs -i ${FLOPPY_INODES} -m 0 -p 0 -o space /dev/md${VNUM}c > /dev/null
  
!     mount /dev/md${VNUM}c ${MFS_MOUNTPOINT}
  
      # preload kernel, compress with kgzip and copy to floppy image
      (

Fix: 

Hopefully the patch above will provoke a few people into fixing the rest of the broken things related to picobsd in -current.  
Commiting this patch sooner rather than later would be _nice_,
since I always like to base my firewall-floppy off of -current.
How-To-Repeat: (cd /src/release/picobsd/build; ./picobsd) in -current
Comment 1 joe freebsd_committer freebsd_triage 2001-09-24 12:31:52 UTC
State Changed
From-To: open->closed

PicoBSD in -current now DTRT WRT mdconfig.