- create a tree of files you want in the image
- install the makefs port
- use makefs to create your image.
Create a tree of files
You'll need to create an image of what you want. Let's assume that it is a powerpc root disk for FreeBSD. For the sake of simplicity, I'm assuming that the kernel comes from elsewhere. If not, then you'll need to add the buildkernel/installkernel targets
- setenv TARGET powerpc
- setenv MAKEOBJDIRPREFIX /tmp/imp/obj
- make buildworld
- sudo make installworld DESTDIR=/tmp/imp/ppc-root
- sudo make distrib-dirs DESTDIR=/tmp/imp/ppc-root
- sudo make distribution DESTDIR=/tmp/imp/ppc-root
- echo "hostname=ppc-qemu" > /tmp/imp/ppc-root/etc/rc.conf
- echo ifconfig_DEFAULT=DHCP >> /tmp/imp/ppc-root/etc/rc.conf
- echo /dev/ad0a / ufs rw 1 1 > /tmp/imp/ppc-root/etc/fstab
Installing the makefs port
NetBSD created a tool to create file systems. Colin Percival ported this to FreeBSD and make a FreeBSD port to boot. He's no longer maintaining the port, but I try to keep it compiling. Installing the port is done in the usual FreeBSD way:
- cd /usr/ports/sysutils/makefs
- make all
- sudo make install
- make clean
Once you have makefs installed, creating the image is the next step. You'll need to figure out how big you wish to make the image. For me, I think that 500MB is a good size. The base system is about 250MB, and that leaves room left over for testing programs in the emulator.
- makefs -B big -s 500m /tmp/imp/ppc-root-image /tmp/imp/ppc-root
Thanks for the tip!
ReplyDeleteThis helps me quite a bit, too bad porting the netbsd endian neutral filesystem code isn't as straightforward as it could be.