Help please: Building arm image on amd64 using release(7) results in core dump...

JamesElstone

Active Member

Reaction score: 22
Messages: 115

Hi All,

I need a bit of help please. I have an amd64 system running 12.1-RELEASE-p10 that I am trying to create an embedded arm image using the release(7) mechanism rather than crochet.

I am getting a compile error when attempting to compile the arm image on this amd64 box when following the instructions in release(7).

If I use the following commands from the manual, then it generates an amd64 set of images all OK:
Code:
cd /usr
svn co svn://svn.freebsd.org/base/releng/12.2 src
cd src
make buildworld buildkernel
cd release
make obj
make release
make install    DESTDIR=/var/freebsd-snapshot


But if I attempt the following commands:
Code:
cd /usr
svn co svn://svn.freebsd.org/base/releng/12.2 src
cd src
make buildworld buildkernel
cd release
make obj
cd /usr/src/release
sh release.sh -c arm/RPI-B.conf


that results in the following core dump at the package install stage:

Code:
...
--- installconfig_subdir_lib/clang/libclang ---
===> lib/clang/libclang (installconfig)
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
32-bit compatibility ldconfig path: /usr/lib32
===>  Deinstalling for u-boot-rpi3
/bin/sh: /usr/local/sbin/pkg-static: not found
===>   u-boot-rpi3 not installed, skipping
===>  License GPLv2 accepted by the user
===>   u-boot-rpi3-2020.10 depends on file: /usr/local/sbin/pkg - not found
===>  License BSD2CLAUSE accepted by the user
===> Fetching all distfiles required by pkg-1.15.10 for building
===>  Extracting for pkg-1.15.10
===>  License BSD2CLAUSE accepted by the user
===> Fetching all distfiles required by pkg-1.15.10 for building
=> SHA256 Checksum mismatch for freebsd-pkg-1.15.10_GH0.tar.gz.
===>  Refetch for 1 more times files:  freebsd-pkg-1.15.10_GH0.tar.gz
===>  License BSD2CLAUSE accepted by the user
=> freebsd-pkg-1.15.10_GH0.tar.gz doesn't seem to exist in /tmp/distfiles/.
=> Attempting to fetch https://codeload.github.com/freebsd/pkg/tar.gz/1.15.10?dummy=/freebsd-pkg-1.15.10_GH0.tar.gz
fetch: https://codeload.github.com/freebsd/pkg/tar.gz/1.15.10?dummy=/freebsd-pkg-1.15.10_GH0.tar.gz: size unknown
fetch: https://codeload.github.com/freebsd/pkg/tar.gz/1.15.10?dummy=/freebsd-pkg-1.15.10_GH0.tar.gz: size of remote file is not known
freebsd-pkg-1.15.10_GH0.tar.gz                Bad system call (core dumped)
=> Attempting to fetch http://distcache.FreeBSD.org/ports-distfiles/freebsd-pkg-1.15.10_GH0.tar.gz
freebsd-pkg-1.15.10_GH0.tar.gz                Bad system call (core dumped)
=> Couldn't fetch it - please try to retrieve this
=> port manually into /tmp/distfiles/ and try again.
*** Error code 1

Stop.
make[3]: stopped in /usr/ports/ports-mgmt/pkg
*** Error code 1

Stop.

If I manually run the command fetch http://distcache.FreeBSD.org/ports-distfiles/freebsd-pkg-1.15.10_GH0.tar.gz it completes OK and also pkg version 1.15.10 is installed from ports OK.

Can someone advise what magic sauce is needed or the important bit that I am missing in my approach please?

Thank you,
James
 

richardtoohey2

Well-Known Member

Reaction score: 150
Messages: 298

Odd that you are getting a coredump just fetching a file - I've copy & pasted the fetch part on an amd64 NUC and it fetches fine:
Code:
% fetch http://distcache.FreeBSD.org/ports-distfiles/freebsd-pkg-1.15.10_GH0.tar.gz
freebsd-pkg-1.15.10_GH0.tar.gz                        3734 kB  933 kBps    04s

Have you maybe mangled your system before you got to this step?
 
OP
J

JamesElstone

Active Member

Reaction score: 22
Messages: 115

Having read the manual again, I have worked out why this is happening, and my mistake.

While the running a 12.1 kernel as well as source in /usr/src being version 12.1-p10, and that was where the release.sh -c xxx was run from, the release.sh command downloads a separate copy into (by default) /scratch/usr/src from HEAD.

When it comes to run the embedded ports it is doing so in a chroot of /scratch, thus is was calling FreeBSD 13 binaries it had just compiled while the running kernel was 12.1, hence the core dump as the ABI, etc has understandably changed between versions; I was in effect running a version of fetch compiled for FreeBSD 13 on a FreeBSD 12.1 kernel.

By specifying the same FreeBSD version number as the running kernel in the SRCBRANCH variable in the relevant .conf file passed to release.sh, all was well.

I have one further question about Release Engineering of embedded images for general release though:

When building the embedded release images is a multi-step step process employed or I am missing something, e.g. build latest version, reboot into latest version, then build embedded images that require additional ports(7)?

Thanks!
 
Last edited by a moderator:

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,512
Messages: 34,309

I build images for amd64 by hand. I just looked at what the script actually does and only used what I needed. I build these images on a 12-STABLE system, so I already have a completely built world ready to go.

My process is this:
Code:
svn update /usr/src
cd /usr/src
make -j 4 buildworld buildkernel

I do the necessary things to update the machine itself. When that's all completed I continue by building the release(7):
Code:
cd /usr/src/release
make -DNOPORTS -DNODOC -DNOPKGS KERNCONF="GENERIC VBOX" release
make -DNOPORTS -DNODOC -DNOPKGS KERNCONF="GENERIC VBOX" DESTDIR=/storage/release/12-stable install

That gets me everything I need in /storage/release/12-stable/. I don't need ports or packages for my images because I've set up my own repositories.

If you want to know more about the options you should have a look through the various Makefile files in /usr/src/release. You can find a lot of interesting information there too. The release.sh is just a convenient script that does a lot of things automatically.
 
Top