Advice for hacking on ufs/ffs
Rick C. Petty
rick-freebsd at kiwi-computer.com
Tue Jul 25 18:34:12 UTC 2006
On Tue, Jul 25, 2006 at 10:53:31AM -0700, Shane Adams wrote:
>
> I used dd to create 1G file.
A faster way is:
touch filename
truncate -s 1g filename
You also may wish to look at qemu-img, which is installed with qemu.
> I did mdconfig -a -t vnode -f /bigdrive/bsdfilesystem -u 0
I'm pretty sure "-t vnode" is implied by "-f".
> I downloaded the 20M boot only ISO.
>
> I ran qemu specifying -cdrom as the 20M iso, and -hda to /bigdrive/bsdfilesystem.
>
> Qemu started fine, and I proceeded to go through the basic install process, at that point it asked me to toss in the correct CD with the packages to complete the installation (Which I didnt' have the CD handy and it was late so I will try again tonight).
You didn't use the network install, especially if you only had the
boot-only CD? If your media type was set to network, it should have
attempted to grab the packages from there. Not that you need any packages
installed to play with UFS.
> Anyway - you said you do a make DESTDIR to your mdconfig'd file. Did you mount the file you mdconfiged?
You have to mount it because DESTDIR points to a directory, not a device or
image. I'd suggest:
mount /dev/md0s1a /mnt
[mount your other filesystems, if applicable, under /mnt/]
cd /usr/src; make DESTDIR=/mnt installworld installkernel
cd /usr/src/etc; make DESTDIR=/mnt distribution
> If so, does a make installworld install a boot loader as well?
No.
> I'm not clear on how you used qemu to boot agains that device. Perhaps you did a normal BSD install on it then later mounted it to get your stuff on there?
That would be easier, but you might wish to put an MBR and a label on your
image:
fdisk -BI /dev/md0
bsdlabel -Bw /dev/md0
You may wish to partition the label for separate file systems, although
that's not necessary. Don't forget to newfs each of your filesystems, e.g.
newfs /dev/md0s1a
Using this method won't require you to run the installer inside qemu.
The nice thing about using qemu to test your hacking is that you can use
the -snapshot mode to preserve the disk image(s), that way if the qemu
"box" panics, you don't need to fsck or any of that.
-- Rick C. Petty
More information about the freebsd-fs
mailing list