Creating a FreeBSD QEMU image howto.

Hello.
I wonder if someone you can point me to some tutorial showing the method of installing FREEBSD aarch64 in QEMU.
I've tried to do so, for creating an image for RASPBERRY but without success.
When arriving to disk partition, I can't create the FAT32 dos partition.

Some help ??
Thank you.
 
I fount the start point, Crochet-FreeBSD
It's super old but should still contain some useful hints and tips.

Building those images is typically done with release(7) nowadays.

Code:
       WITH_VMIMAGES	Set to a non-null value	to build virtual machine  disk
			images	as  part  of the release build.	 WITH_VMIMAGES
			may also  be  specified	 as  an	 environment  variable
			passed to make(1).

			The  option  requires  mkimg(1)	 version  20140927  or
			later.
Code:
For a list of  supported	 VMFORMATS  values  (including	cloud  hosting
       provider	formats) along with a brief description, run:

	     cd	/usr/src
	     make -C release list-vmtargets
 
Cloud and VM Images stuff here;
/usr/src/release/tools/
Look here for calls:
vmimage.subr
 
Last edited:
The reason I want to create my Own RPI, OrangePI images is about ZFS.
I read previousely that ZFS need so many RAM to run well.
That hardware I have has a maximum of 2GB.
Raspberry PI 4B+ => 1GB
OrangePI 3LTS => 2GB.
Unless the FreeBSD team have changed ZFS or You, (community) have some recommendation about this topic.
Also, if there is a way to change the Filesystem.
 
On the Raspberry Pi Image, there are 3 partitions, ESP EFI FAT32 (or FAT16) 50MB, SWAP partition 2048 MB for HDD, SDD, or USB Flash Drive. Not for TF card or microSD card, Note, system hangs a little when NO SWAP is availble when you have 50+ Firefox Browser Tabs open. Mouse cursor does not move, or only slowly. A quick Ctrl-W or Alt-F4, is it Ctrl-F4 will close the last window that used up the free memory. On 8 Gig Raspberry Pi 4B, normally no swap memory is used. ( Well until you go past the limit of 8 Gb :>) A memory space low notifier would help for the Desktop User.
Then ZFS or UFS partition for your FreeBSD Data , Kernel /boot/kernel/kernel.image ?? and FreeBSD /boot files, /etc files.
BSAIDUS, Sounds like you wish to save off the files from a ZFS partition to an outside file storage area, Change the partition type from ZFS-data to UFS partition type. Next newfs /dev/da0p3, and then write the saved files back from outside file storage area into the new UFS partition. That sounds do able. Me tired tonight, Don't know what gltches and problems could arise from this operation. Please, I welcome copious notes here and maybe a copy and paste onto my blogsite detailing how to manually create a ZFS file system on an empty ZFS-data type partition.
Learning ZFS on root setup for Raspberry Pi 4B
Honey I broke my zfs USB sata ssd 1TB


So on a USB Flash Drive using GPT scheme gpart -s GPT /dev/da0 for Raspberry Pi, Don't Touch the ESP EFI partition. Should be able to boot "either a ZFS partition or UFS partition" with the EFI image:
Gpart Manual 13.2 newfs Manual 13.2
Vermaden had better instructions on setting up a microSD card for ARM processors. UFS operates with gptboot.efi file
The needed fix is to copy /boot/gptboot.efi in place of bootaa64.efi file. (which is a copy of /boot/gptzfsboot.efi 4 ZFS)
Code:
ls -l /mnt/esp/EFI/BOOT/bootaa64.efi
cp -p /boot/gptboot.efi  /mnt/esp/EFI/BOOT/bootaa64.efi
ls -l /mnt/esp/EFI/BOOT/bootaa64.efi
ls -l /mnt/esp/EFI/FREEBSD
cp -p /boot/gptboot.efi  /mnt/esp/EFI/FREEBSD/bootaa64.efi
# copyover existing bootaa64.efi (copy of gtpzfsboot.efi) with gptboot.efi file for UFS boot operation

mkdir  -p  /mnt/esp
mkdir  -p  /mnt/rootfs

mount  -t msdosfs /dev/da0p1  /mnt/esp
mount   /dev/da0p3  /mnt/rootfs               UFS partition type

mount -t zfs /dev/da0p3 /mnt/rootfs         ZFS partition type

cp -pr /mnt/rootfs  /mnt/external_storage_disk/
umount /mnt/rootfs
gpart  modify -i 3 -t freebsd-ufs /dev/da0
newfs  /dev/da0p3
mount  /dev/da0p3  /mnt/rootfs
cp -pr /mnt/external_storage_disk  /mnt/rootfs/
ls -l /mnt/rootfs
df -h  /mnt/rootfs
du -d1 -h /mnt/rootfs
umount /mnt/rootfs
Discussion of Gpart tool and Partitions. resize You can move the contents to a separate disk, unmount, shrink the original partition, create a fresh new empty filesystem and copy everything back. Bakul

Conclusion you can modify a partition type from freebsd-zfs to freebsd-ufs, destroy the data newfs, recopy data from external storage. Leave the Raspberry Pi boot ESP EFI partition the same.
Search Klara Systems FreeBSD articles. Building customized FreeBSD images The FreeBSD Boot Process
Booting a pool from the Rescue System
Yes

Your Question is darn interesting to me. I have spent a lot of time studying these topics. Enjoy porting GhostBSD to my Raspberry Pi 4B. Almost there, now running GhostBSD compiled kernel source code. md5deep audit files Ghostbsd-arm64.blogspot.com Disk setup FreeBSD on ZFS on Raspberry Pi
 

Attachments

  • GPT_UEFI_patitions_01.png
    GPT_UEFI_patitions_01.png
    48.5 KB · Views: 39
  • GPT_UEFI_partitions_01.pdf
    14.6 KB · Views: 52
Last edited:
Hi wb7odyfred .
Thank you for your answers.
I think I'm wrong, I've lunched the two images files given by FreeBSD ( RPI and ROCK64) and I found that they are in UFS filesystem.
I thought that they are in ZFS, there for I want to convert it into UFS.
But I note also, that the swap partition does not exists on these images when lunching in qemu.
Is this normal, or should I create a swap partion.
gpart output
root@uc-rpi:~ # gpart show -p
=> 40 10485680 vtbd0 GPT (5.0G)
40 32728 - free - (16M)
32768 102400 vtbd0p1 efi (50M)
135168 10350552 vtbd0p2 freebsd-ufs (4.9G)
And this is ok for me, but I wonder if systems (hardware) like raspbery pi or orange pi do or not need swap partition.
Is is normal to add a swap partion as a file and mount it?
Remember that the system will be lunched from TF card and many writes in TF card can damage it.


[CONCLUSION]
After searching the forum, I read that it is not advised to use swap on SD card.
SO I have all OK in my situation.
Thank you all for your answers.

PS: a screenshot of the output command mount
 

Attachments

  • Sans titre 3.jpg
    Sans titre 3.jpg
    24.9 KB · Views: 58
Vermaden has a wordpress blog post on setting up ARM boot file system.
The needed fix is to copy /boot/gptboot.efi in place of bootaa64.efi file. (which was a copy of /boot/gptzfsboot.efi for booting ZFS root file system). Check your disks file systems with these commands:
camcontrol devlist
geom disk list
gpart status
gpart show -lp
df -h

zpool list
zfs list
zpool import
zfs get mounted,canmount,mountpoint,setuid,atime,exec zroot/ROOT/default use for other ZFS file volumes.
zfs mount
df -h

Will give you a good picture of your disk setups for UFS 1st set; ZFS 2nd set. Nice to see your photo above, notices UFS file system. I welcome exchange of ideas, so that we all may benefit from using these NEW ARM64 single board computers coming on the market. Like the Raspberry Pi 5, quad A76 cpus. Orange Pi 5 PLUS with 2.5G ethernet and RK3588 octo core A72 (8 cpus). This RK3588 cpu sbcs will make a great desktop SBC and a great router board with 2 ethernet connections. All your thoughts? Will FreeBSD Foundation put some effort into RK3588 SBC boards? PersonalBSD.org t.me/personalBSD Telegram Has FreeBSD running on RK3568 and RK3588 SOC sbcs. SleepWalker helped me make changes in /boot/loader.conf file to boot GhostBSD.org github.com/ghostbsd/ghostbsd-src kernel on Raspberry Pi 4B. The kernel is running just fine. Now Working to get XFCE4 and otter browser or FireFox browser to test HDMI Audio sound output is operational. Should work. Marcos patch file worked like a charm for me last September &, 2022.
Shout out to forums.raspberrypi.com , please read and add your comments there to encourage FreeBSD usage on the Raspberry Pi hardware. Good cheer and advertising of the great FreeBSD software base, when you h.elp other RPI users of FreeBSD software over there on the forums. Write up your RPI solutions on using FreeBSD, over there to encourage activity.
minor Ethernet problems Oct 16 2023 on the RPI forums
 
Back
Top