FreeBSD on AWS Graviton (t4g)

Rafal Lukawiecki raf at rafal.net
Sun Jan 3 18:49:07 UTC 2021


Once again, thanks for your help, Colin. The suggested steps worked and I have managed to build an updated ARM AMI with all the extra packages. I am testing it now and seems quite good. Shutdown behaviour does not bother me.

Indeed, there was not enough space for make in /usr/obj (and not enough for pkg either) so I had to add a couple of memory disks. FYI, the below user data script works well. I run it on a spot instance of a c6g.8xlarge and it was done in just under 30 mins.

I wonder if I am replicating what your AMI maker does anyway by building things using make, or is this still the right way to go around.

I’ve one more question: where can find out the currently *available* level of the patches, ie. the “-p2” in "12.2-RELEASE-p2”? There is nowhere I could see on freebsd.org <http://freebsd.org/> that publishes that, and I assume it has to be somewhere in the svn trees but I cannot find it. I would like a way of being able to check if I am current.

My user data script, perhaps I should post it somewhere…:

#!/bin/sh
PKGS_TO_INSTALL=“Lots of package names go here :)"
export ASSUME_ALWAYS_YES=YES
export PATH="$PATH:/usr/local/bin"
mount -t devfs devfs /mnt/dev
mdconfig -a -t swap -s 8G -u 2
newfs -U md2
mount /dev/md2 /usr/src
mdconfig -a -t swap -s 20G -u 3
newfs -U md3
mount /dev/md3 /bits/usr/obj
svnlite co https://svn.freebsd.org/base/releng/12.2/ /usr/src/
make -j 32 -C /usr/src DESTDIR=/mnt buildworld buildkernel installkernel installworld
yes | /usr/bin/env PATH="$PATH:/usr/local/bin" pkg -r /mnt fetch -d $PKGS_TO_INSTALL
pkg -r /mnt update -f
cp /etc/resolv.conf /mnt/etc/resolv.conf
yes | /usr/bin/env PATH="$PATH:/usr/local/bin" pkg -c /mnt -o ASSUME_ALWAYS_YES=YES install $PKGS_TO_INSTALL
rm /mnt/etc/resolv.conf # You may need to check if there was already another resolv.conf and perhaps restore it (11.1: yes, 12.x: none)
sleep 10
sync; sync; sync;
umount /bits/usr/obj
umount /mnt/src
umount -f /mnt/dev
sync; sync; sync;
sleep 10
sync; sync; sync;
sleep 10
umount -f /mnt
sleep 10
mkami "FreeBSD 12.2 PB 3.16" "Project Botticelli Ltd Customised FreeBSD 12.2"
shutdown -p now

The two memory disks are bit oversized. The pkg cache only needs 4 GB (not 8) and /usr/obj needs just under 10 (not 20) but it saves me from surprises, I hope, as I continue using it over the next few months.

Thanks a lot and regards from Ireland,
Rafal
--
Rafal Lukawiecki
Data Scientist 
Project Botticelli Ltd




More information about the freebsd-cloud mailing list