Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 Jan 2015 09:23:06 -0800
From:      Nathan Whitehorn <nwhitehorn@freebsd.org>
To:        freebsd-current@freebsd.org
Subject:   Re: makefs && gpart (...)
Message-ID:  <54A5827A.3000406@freebsd.org>
In-Reply-To: <20150101114829.GA3196@unixarea.DDR.dd>
References:  <20150101114829.GA3196@unixarea.DDR.dd>

next in thread | previous in thread | raw e-mail | index | archive | help

On 01/01/15 03:48, Matthias Apitz wrote:
>
> Hello,
>
> I have a small question and a small request re/ makefs && gpart:
>
> There is a script src/release/i386/make-memstick.sh to create an image
> from a full directory tree; the tree is result of
>
> make installworld DESTDIR=/tree
> make installkernel DESTDIR=/tree
>
> the script mainly does:
>
> ...
> makefs -B little -o label=FreeBSD_Install ${2} ${1}
> if [ $? -ne 0 ]; then
> 	echo "makefs failed"
> 	exit 1
> fi
> rm ${1}/etc/fstab
>
> unit=$(mdconfig -a -t vnode -f ${2})
> if [ $? -ne 0 ]; then
> 	echo "mdconfig failed"
> 	exit 1
> fi
> gpart create -s BSD ${unit}
> gpart bootcode -b ${1}/boot/boot ${unit}
> gpart add -t freebsd-ufs ${unit}
> mdconfig -d -u ${unit}
>
> As you can see, it does makefs first, and after this it creates the
> gpart structure in the image (i.e. in its memory file system).
> Why is this in this order and where exactly starts the file system
> created by makefs?


This is a quirk of BSD disklabels: the first partition can start at 
address 0 and the first 16 sectors of UFS2 file systems are reserved for 
the label headers. It's not portable to other partition schemes. For 
-CURRENT, this script has been replaced, by the way, and doesn't use BSD 
labels anymore.
-Nathan

>
> The request is: it would also be nice if 'make-memstick.sh' would allow
> to pass from the command line some values for the size of the file
> system to be created in the image; I modified it to fit my needs as:
>
>     size=15482880b
>     ...
>     makefs -B little -M ${size} -m ${size} -f 400000 ....
>
> Thanks
>
> 	matthias
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?54A5827A.3000406>