michaeldexter / occambsd

An application of Occam's razor to FreeBSD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Running OccamBSD on non-HAMMER platforms

antranigv opened this issue · comments

Currently, if I run ./occambsd.sh -p some-profile.txt on a non-AMD64 machine, I get an error like this.

buildkernel failed

root@devbsd14:~/occambsd # tail -5 /tmp/occambsd/logs/build-kernel.log
/tmp/occambsd/OCCAMBSD: unknown option "HAMMER"

make[1]: stopped in /usr/src

make: stopped in /usr/src

Obviously, the issue is that we're setting the CPU to HAMMER, while we're on a non-AMD64 machine.

I did a simple change which is

-echo "cpu      HAMMER" > $work_dir/OCCAMBSD
+case "$(uname -m)" in
+  arm64) CPU=ARM64;;
+  amd64) CPU=HAMMER;;
+esac
+
+echo "cpu      ${CPU}" > $work_dir/OCCAMBSD

And now I get

buildkernel failed

root@devbsd14:~/occambsd # tail -10 /tmp/occambsd/logs/build-kernel.log
WARNING: duplicate device `scbus' encountered in /tmp/occambsd/OCCAMBSD
config: Error: device "aesni" is unknown
config: Error: device "atkbdc" is unknown
config: Error: device "psm" is unknown
config: Error: device "vga" is unknown
config: 4 errors

make[1]: stopped in /usr/src

make: stopped in /usr/src

Clearly, OccamBSD is AMD64 specific.

Digging into the code I found things such as

kernconf_dir="${src_dir}/sys/amd64/conf"

[ -f $src_dir/sys/amd64/conf/GENERIC ] || \

occambsd/occambsd.sh

Lines 144 to 171 in 50eca54

[ -f "$obj_dir/$src_dir/amd64.amd64/release/vm.raw" ] && \
rm "$obj_dir/$src_dir/amd64.amd64/release/vm.raw" \
[ -f "$obj_dir/$src_dir/amd64.amd64/release/raw.img" ] && \
rm "$obj_dir/$src_dir/amd64.amd64/release/raw.img" \
[ -d "$obj_dir/$src_dir/amd64.amd64/release/vm-image" ] && \
chflags -R 0 "$obj_dir/$src_dir/amd64.amd64/release/vm-image" \
[ -d "$obj_dir/$src_dir/amd64.amd64/release/vm-image" ] && \
rm -rf "$obj_dir/$src_dir/amd64.amd64/release/vm-image" \
[ -d "$obj_dir/$src_dir/amd64.amd64/release/disc1" ] && \
chflags -R 0 "$obj_dir/$src_dir/amd64.amd64/release/disc1" \
[ -d "$obj_dir/$src_dir/amd64.amd64/release/disc1" ] && \
rm -rf "$obj_dir/$src_dir/amd64.amd64/release/disc1*" \
[ -d "$obj_dir/$src_dir/amd64.amd64/release/bootonly" ] && \
chflags -R 0 "$obj_dir/$src_dir/amd64.amd64/release/bootonly" \
[ -d "$obj_dir/$src_dir/amd64.amd64/release/bootonly" ] && \
rm -rf "$obj_dir/$src_dir/amd64.amd64/release/bootonly*" \
if [ "$reuse_kernel" = "0" ] ; then
echo ; echo Cleaning kernel object directory
[ -d $obj_dir/$src_dir/amd64.amd64/sys/$kernconf ] && chflags -R 0 $obj_dir/$src_dir/amd64.amd64/sys/$kernconf
[ -d $obj_dir/$src_dir/amd64.amd64/sys/$kernconf ] && rm -rf $obj_dir/$src_dir/amd64.amd64/sys/$kernconf

And the list goes on.

Maybe under this issue we can discuss how can we make OccamBSD platform-agnostic, which steps we need to take and test it on multiple systems.

Personally, I AMD64 and ARM64 as well as IBM Power8, which should cover most of the cases.

The complex part is going to be adding some grepping and what-not to get the list of the modules that we need.

Fixed. Please test.

ARM uses kernel includes while the other platforms support kernel options and devices.

I have added support for this and it builds, but I have not tried it on QEMU or hardware.

The only bug I see is that the CD-ROM step fails with:

install -T release -o root -g wheel -m 555 cc_cdg.ko /usr/obj/usr/src/arm64.aarch64/release/dist/kernel/boot/kernel/
install: cc_cdg.ko: No such file or directory
*** Error code 71

I did not investigate to see if the ARM* CD-ROM images are built differently (like the RPi images).

It is HIGHLY LIKELY that you will need to modify the profile-arm64-minimum.txt profile to get it to boot, but, the infrastructure is there.