Date: Tue, 30 Mar 2010 18:18:19 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Jay Hall <jhall@socket.net> Cc: freebsd-questions@freebsd.org Subject: Re: Custom Kernel to Memory Stick Message-ID: <87eij14z44.fsf@kobe.laptop> In-Reply-To: <03658C6E-697A-43C5-9E6D-8B261D18F9A4@socket.net> (Jay Hall's message of "Mon, 29 Mar 2010 10:49:08 -0500") References: <03658C6E-697A-43C5-9E6D-8B261D18F9A4@socket.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 29 Mar 2010 10:49:08 -0500, Jay Hall <jhall@socket.net> wrote: > Ladies and Gentlemen, > > I have been asked to explore the possibility of booting FreeBSD from a > memory stick. This was not a problem; worked great when installed from > the distribution CD. > > What would be the best way to get our custom configuration onto the > memory stick? The fastest way I know is to create an image to an 'image' file stored on disk or ramdisk and then dd the image to the USB disk. You can create a suitably large image with truncate(1), e.g.: truncate -s 1g /var/tmp/image.bin Then attach the image to an mdconfig device: mdconfig -a -t vnode -u 20 -f /var/tmp/image.bin Create a filesystem on it, and install everything from your buildworld and buildkernel run: fdisk -BI /dev/md20 bsdlabel -w -B /dev/md20s1 newfs -U /dev/md20s1a Mount the new image partition before installkernel+installworld: mount -t ufs /dev/md20s1a /mnt Then you sould be able to install with DESTDIR pointing to the image partition: cd /usr/src env DESTDIR=/mnt make installkernel installworld Don't forgte to use mergemaster with -D /mnt to install the /mnt/etc files from /usr/src/etc. Then tweak the /mnt/etc/fstab file to point at the USB disk as the root filesystem. Finally detach the image and write it on a USB disk: umount /mnt mdconfig -du 20 dd if=/var/tmp/image.bin of=/dev/da0 bs=4m One of the nice tricks you can use for the root filesystem of the USB disk is to add a UFS label to the USB root filesystem. This way you don't have to assume that the USB root filesystem is called da0s1a but you can use /dev/ufs/LABELNAME in the fstab file of the image partition.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87eij14z44.fsf>