Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Dec 2019 16:33:12 -0000
From:      Paul Mather <paul@gromit.dlib.vt.edu>
To:        Ed Maste <emaste@freebsd.org>
Cc:        Robert Clausecker <fuz@fuz.su>, freebsd-arm <freebsd-arm@freebsd.org>, freebsd-arch <freebsd-arch@freebsd.org>
Subject:   Re: arm64 as Tier 1 for FreeBSD 13
Message-ID:  <8ED17B73-97C0-4843-900D-0EC13C87651C@gromit.dlib.vt.edu>
In-Reply-To: <CAPyFy2AzPWqRCATmG8dsMVQ3DwCN0e8ERiuWiLV79mgN79Z6-A@mail.gmail.com>
References:  <CAPyFy2Aa6Uj0nyQ1Y_KPLd7%2BROJ4xW5i-SpctV1sRVK_BivPHw@mail.gmail.com> <CAPyFy2D91v7SwjZOgMG0a9V%2BH6GVCF8NHKp341N8mwnCvA71cA@mail.gmail.com> <CAPyFy2BP3hFHuFJyo2M-5pc0%2BCmRiyym1TZ81P5xicR4zED1JQ@mail.gmail.com> <CAPyFy2BXWPVOJo%2BGOf83sZFrPHE80-QvdHeWrhi%2BTdj0KDnThg@mail.gmail.com> <17938.1575444597@critter.freebsd.dk> <20191204092402.GA82492@fuz.su> <D140BA2A-71F3-4574-9015-675950705AF2@gromit.dlib.vt.edu> <CAPyFy2AzPWqRCATmG8dsMVQ3DwCN0e8ERiuWiLV79mgN79Z6-A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Dec 4, 2019, at 6:30 AM, Ed Maste <emaste@freebsd.org> wrote:

> On Wed, 4 Dec 2019 at 09:49, Paul Mather <paul@gromit.dlib.vt.edu> =
wrote:
>>=20
>> 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.
>=20
> Indeed, migrating to pkg base is the presumed solution for the
> "freebsd-update would be too slow on SD card root" issue.
>=20
> 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:

=3D=3D=3D=3D=3D config/mk.conf =3D=3D=3D=3D=3D
mk_arch=3D"aarch64"
mk_kernel=3D"GENERIC"
=3D=3D=3D=3D=3D config/mk.conf =3D=3D=3D=3D=3D

=3D=3D=3D=3D=3D config/make.conf =3D=3D=3D=3D=3D
REPODIR=3D/build/repo
=3D=3D=3D=3D=3D config/make.conf =3D=3D=3D=3D=3D

I have a simple script, "rebuild_os_pkgs" that cross-builds everything =
and makes the base packages that end up under /build/repo:

=3D=3D=3D=3D=3D rebuild_os_pkgs =3D=3D=3D=3D=3D
#!/bin/sh
mk buildworld
mk buildkernel
mk packages
=3D=3D=3D=3D=3D rebuild_os_pkgs =3D=3D=3D=3D=3D

(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:

=3D=3D=3D=3D=3D
        location /FreeBSD-base {
            alias /build/repo;
            autoindex on;
            allow all;
        }
=3D=3D=3D=3D=3D


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.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8ED17B73-97C0-4843-900D-0EC13C87651C>