Re: cvs commit: src/tools/tools/nanobsd Makefile i386.diskimage

From: Andrea Campi <andrea+freebsd_current_at_webcom.it>
Date: Sat, 21 Aug 2004 18:11:40 +0200
Hi Thomas,

On Mon, Aug 16, 2004 at 10:41:58PM +0000, Thomas Quinot wrote:
> thomas      2004-08-16 22:41:58 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     tools/tools/nanobsd  Makefile i386.diskimage 
>   Log:
>   Properly identify the root filesystem to be used in /etc/fstab in each
>   slice of the flash card, ensuring that the loader will mount the root fs
>   from the booted slice by default.

I think this is not what you intended to do:

===================================================================
RCS file: /usr/local/www/cvsroot/FreeBSD/src/tools/tools/nanobsd/i386.diskimage,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -p -r1.7 -r1.8
--- src/tools/tools/nanobsd/i386.diskimage	2004/05/28 21:23:23	1.7
+++ src/tools/tools/nanobsd/i386.diskimage	2004/08/16 22:41:58	1.8
[...]
_at__at_ -43,18 +69,40 _at__at_ fdisk ${MD}
 boot0cfg -B -b ${WD}/boot/boot0sio -s 1 -m 3 ${MD}
 rm -f ${TMPFILE1}
 bsdlabel -w -B ${MD}s1
-newfs -O1 -U ${MD}s1a
-newfs -O1 -U ${MD}s3
+
+# Prepare primary root slice
+
+newfs ${PRIROOTLABEL} -O1 -U ${MD}s1a
 mount /dev/${MD}s1a ${TMPMNT}
 (cd ${WD} && find . -print | cpio -dump ${TMPMNT}) || true
+make_fstab ${PRIROOTSLICE}
 df ${TMPMNT}
 umount ${TMPMNT}
+
+# Prepare alternative root slice
+
+dd if=/dev/${MD}s1 of=/dev/${MD}s2 bs=64k
+if [ -n "${ALTROOTLABEL}" ]; then
+  tunefs ${ALTROOTLABEL} /dev/${MD}s2a
+fi
+mount /dev/${MD}s2a ${TMPMNT}
+make_fstab ${ALTROOTSLICE}
+umount ${TMPMNT}
+

make_fstab creates the /etc/fstab file in ${WD}, but in both cases
you call it *after* copying from ${WD} to the destination filesystem,
so in fact they are noops. I think you should probably change make_fstab
like this:

make_fstab () {
  echo "/dev/$1 / ufs ro 1 1" > $2/etc/fstab
}

and pass it the destination:

make_fstab ${ALTROOTSLICE} ${TMPMNT}

What do you think? I can send you a diff if you prefer.

Bye,
	Andrea

-- 
                  Weird enough for government work.
Received on Sat Aug 21 2004 - 16:04:28 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:07 UTC