arm64 as Tier 1 for FreeBSD 13
Paul Mather
paul at gromit.dlib.vt.edu
Wed Dec 4 16:33:12 UTC 2019
On Dec 4, 2019, at 6:30 AM, Ed Maste <emaste at freebsd.org> wrote:
> On Wed, 4 Dec 2019 at 09:49, Paul Mather <paul at gromit.dlib.vt.edu> wrote:
>>
>> I'm running FreeBSD/arm64 12-STABLE on a Raspberry Pi 3 using a root-on-ZFS setup. I've been using packaged base for quite some time, cross-building on FreeBSD/amd64. Every time I upgrade FreeBSD via "pkg upgrade" it seems to me that it does not take an inordinately long time. It takes longer than packaged base on a regular FreeBSD/amd64 server with spinning disk, but not an excessive amount of time. It's certainly on the order of minutes, not hours.
>
> Indeed, migrating to pkg base is the presumed solution for the
> "freebsd-update would be too slow on SD card root" issue.
>
> Perhaps you wouldn't mind writing up the steps you're using to
> cross-build and install updates?
I am using already existing documentation from the FreeBSD project. (Many thanks to the original authors!)
1. Building and serving pkg packages
For a long time I have built packages for my FreeBSD systems using Poudriere and serve them over the network via the Poudriere build machine. See:
- https://www.freebsd.org/doc/handbook/ports-poudriere.html
I use Nginx (via www/nginx) to serve the pkg repos (based on the /usr/local/share/examples/poudriere/nginx.conf.sample file in the ports-mgmt/poudriere installed port).
Note, you don't really need Poudriere in all this, but I find it useful for also cross-building my FreeBSD/arm64 ports. Because I was using Poudriere long before PkgBase, I included it here as something folks might also want to use.
2. Cross-building for FreeBSD/arm64
To cross-build, I use the "mk" script provided at the arm/crossbuild section of the FreeBSD Wiki. See:
- https://wiki.freebsd.org/arm/crossbuild
In the case of my FreeBSD/arm64 systems, my "config/mk.conf" and "config/make.conf" consist solely of the following:
===== config/mk.conf =====
mk_arch="aarch64"
mk_kernel="GENERIC"
===== config/mk.conf =====
===== config/make.conf =====
REPODIR=/build/repo
===== config/make.conf =====
I have a simple script, "rebuild_os_pkgs" that cross-builds everything and makes the base packages that end up under /build/repo:
===== rebuild_os_pkgs =====
#!/bin/sh
mk buildworld
mk buildkernel
mk packages
===== rebuild_os_pkgs =====
(My "mk" script is in /usr/local/bin.)
To build an updated OS I run that script after first having updated the OS source in the "src" subdirectory (e.g., via "make update"). (You can symlink "src" to "/usr/src" if you want to save space.) The "mk packages" step results in a pkg-compliant repository with all the PkgBase packages in it.
3. FreeBSD/arm64 PkgBase
I followed the PkgBase documentation at the FreeBSD Wiki to set up my Raspberry Pi 3 to use the OS packages build on the FreeBSD/amd64 build machine using the "rebuild_os_pkgs" script. See:
- https://wiki.freebsd.org/PkgBase
I have this snippet on the OS package build machine to serve out the pkg repository created as part of the rebuild_os_pkgs run:
=====
location /FreeBSD-base {
alias /build/repo;
autoindex on;
allow all;
}
=====
If you are used to building and serving pkg packages (e.g., ports packages) then the real workhorse in all this is the "mk" cross-building script + FreeBSD build system that is cross-building capable.
I encourage folks to check out the FreeBSD documentation on cross-building for ARM and PkgBase that I mention above. They have a lot of useful information.
Cheers,
Paul.
More information about the freebsd-arm
mailing list