[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Booting from Memory Stick
- To: jhall_(_at_)_vandaliamo_(_dot_)_net, freebsd-questions_(_at_)_freebsd_(_dot_)_org
- Subject: Re: Booting from Memory Stick
- From: Walker <zflyer_(_at_)_gmail_(_dot_)_com>
- Date: Sun, 2 Mar 2008 11:37:58 -0500
- Cc:
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=XMg+cxHVtTmDKJxG1JIKJlmAHD+8j6x2UZMOII8g5v4=; b=PGWcph5XACYmPup7E9QLHFiUHWBmbTf3wy9fN8UillplxkaAP8oSjHde0wKgRnyG9rpIz0scm0dEYGip9SnbEjuk7zLuLeRfhYffBEwtRxQPlgADI92OSRMnOsjESAZiLlKEGY77pj+CXT2IW5OrspllVvHTZt2MdXdpYmgdqik=
On Sat, Mar 1, 2008 at 4:23 PM, <jhall_(_at_)_vandaliamo_(_dot_)_net> wrote:
> I am working on getting a FreeBSD system to boot from a USB memory stick.
FWIW, my cut/paste script for installing 7.0 to a USB flash drive.
This is adapted from a post by Ceri Davies (thank you!).
** This assumes the drive is at /dev/da0 and that /dev/md0 is not in use **
# set these; the two mount points should not exist
export ISOFILE='/tmp/7.0-RELEASE-i386-disc1.iso'
export ISOMNT='/a'
export USBMNT='/b'
# zero the device for better compression when were done (optional)
dd bs=10m if=/dev/zero of=/dev/da0
# mdconfig and mount the media
mkdir -m 555 ${ISOMNT} ${USBMNT}
mdconfig -a -t vnode -u 0 -f ${ISOFILE}
mount -t cd9660 /dev/md0 ${ISOMNT}
# label and newfs the flash drive
fdisk -BI /dev/da0
bsdlabel -B -w da0s1
newfs -U -L FBSDusb /dev/da0s1a
mount /dev/da0s1a ${USBMNT}
# install the OS
cd ${ISOMNT}/*RELEASE/base
DESTDIR=${USBMNT} ./install.sh
# install the generic kernel
cd ${ISOMNT}/*RELEASE/kernels
DESTDIR=${USBMNT} ./install.sh generic
rmdir ${USBMNT}/boot/kernel
mv ${USBMNT}/boot/GENERIC ${USBMNT}/boot/kernel
# set boot0 options
boot0cfg -v -B -o noupdate -t 90 da0
# install a fstab; adjust as needed (like /tmp size)
cat >> ${USBMNT}/etc/fstab << EOF
# Device Mountpoint FStype Options Dump Pass
/dev/ufs/FBSDusb / ufs rw,noatime 1 1
md /tmp mfs rw,-s150M,nosuid,noatime 0 0
md /var/run mfs rw,-s4M,nosuid,noatime 0 0
md /var/log mfs rw,-s16M,nosuid,noatime 0 0
/dev/acd0 /cdrom cd9660 ro,noauto,nosuid 0 0
/proc /proc procfs rw,noauto 0 0
/tmp /var/tmp nullfs rw 0 0
EOF
# install an rc.conf
cat >> ${USBMNT}/etc/rc.conf << EOF
ifconfig_DEFAULT="DHCP"
ifconfig_fwe0="NOAUTO"
ifconfig_plip0="NOAUTO"
sshd_enable="YES"
syslogd_flags="-vv"
sendmail_enable="NONE"
EOF
# set root password and timezone (optionally add users here as well)
chroot ${USBMNT} /bin/sh
passwd root
tzsetup
# clean up
cd /
umount ${ISOMNT} ${USBMNT}
rmdir ${ISOMNT} ${USBMNT}
mdconfig -d -u 0
# backup and compress (~ 84MB) (optional)
dd bs=10m if=/dev/da0 of=usbflash-freebsd_7.0.img
nice bzip2 usbflash-freebsd_7.0.img
# done
_______________________________________________
freebsd-questions_(_at_)_freebsd_(_dot_)_org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe_(_at_)_freebsd_(_dot_)_org"
Visit your host, monkey.org