Hello. I'm trying to boot FreeBSD for arm32 bit as DomU on my ARM Chromebook. Basically there are two ways to accomplish this task :
1) to write a patch that allows the FreeBSD kernel to boot as a zImage file. This could be accomplished applying this patch to a specific file that's on the source code of FreeBSD : https://xenbits.xen.org/gitweb/?p=p...8;hb=0782e25d98cc1391472717035f986c979edef0c9 <https://xenbits.xen.org/gitweb/?p=people/julieng/freebsd.git;a=blob_plain;f=sys/arm/conf/XENVIRT;h=ff6433392e6fc2d5fa7c1ad1f7c40155003af9a8;hb=0782e25d98cc1391472717035f986c979edef0c9> This patch was written by Julien Grall a lot of time ago and now it does not work anymore. This is the reason : It appears FreeBSD-CURRENT removed the last step converting the kernel file to kernel.bin. The patch can be readily rebased, but without kernel.bin that doesn't do too much. So,without a rebase of that patch the first option is not applicable. And I'm not able to fix it. 2) booting FreeBSD using U-Boot,as explained to me by a xen developer : I was trying to explain why and how Julien's patch works so that you could be the one to re-do something similar or fix the patch on the FreeBSD kernel that you are working with. I am happy to help review and write patches but I don't work with the FreeBSD kernel so I wouldn't be able to help you quickly. However, I might have a suggestion. Do you know if FreeBSD can be booted by U-Boot ? Because U-Boot definitely boots as Xen on ARM guest firmware/bootloader. You should be able to build U-Boot and use the U-Boot binary as Xen guest kernel, then U-Boot could load FreeBSD from disk or network and start it. For instance as domU config file: kernel="/home/petalinux/u-boot.bin" disk = [ '/home/petalinux/test.img,raw,xvda' ] I know it is important to build u-boot with the following config to make it work on Xen. CONFIG_CMO_BY_VA_ONLY=y According with these suggestions (and with the suggestions of a FreeBSD developer) I have compiled the needed u-boot.bin from scratch using this procedure : # git clone https://github.com/u-boot/u-boot.git # cd u-boot # ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make snow_defconfig : this line generates the file .config # nano .config and I've added these parameters : CONFIG_ARMV7_NONSEC=n CONFIG_EFI_GRUB_ARM32_WORKAROUND=y suggested to me by a FreeBSD developer in relation to the FreeBSD fragment : https://github.com/freebsd/freebsd-ports/blob/main/sysutils/u-boot-master/files/FreeBSD_Fragment but I haven't added this parameter : CONFIG_CMO_BY_VA_ONLY=y according with what he said,instead : "I took a brief look at your post and it seems to me that the option CONFIG_CMO_BY_VA_ONLY is irrelevant to your target armv7 32 bit platform : https://source.denx.de/u-boot/u-boot/-/blob/master/arch/arm/cpu/armv8/Kconfig?ref_type=heads#L3 Finally,the uboot-bin file is generated with this command : # ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make At this point,I took a look inside the .config file and I saw that the parameter "CONFIG_ARMV7_NONSEC=n" has been removed. So,for some reason,it is not accepted and this could be a problem.... These are the xen config files that I've used : nano freebsd.cfg name="test" kernel="u-boot.bin" extra = "console=hvc0" memory=256 vcpus=1 disk = [ 'FreeBSD-13.2-RELEASE-armv7.img,raw,xvda' ] nano start-freebsd xl create freebsd.cfg xl console freebsd This is what happens when I launch the vm : # ./start-freebsd Parsing config from freebsd.cfg xc: error: panic: xg_dom_core.c:689: xc_dom_find_loader: no loader found: Invalid kernel libxl: error: libxl_dom.c:571:libxl__build_dom: xc_dom_parse_image failed libxl: error: libxl_create.c:1640:domcreate_rebuild_done: Domain 1:cannot (re-)build domain: -3 libxl: error: libxl_domain.c:1183:libxl__destroy_domid: Domain 1:Non-existent domain libxl: error: libxl_domain.c:1137:domain_destroy_callback: Domain 1:Unable to destroy guest libxl: error: libxl_domain.c:1064:domain_destroy_cb: Domain 1:Destruction of domain failed freebsd is an invalid domain identifier (rc=-6) -- Mario.