Andreas Strauch

New Member

Reaction score: 1
Messages: 5

I have tried to google and forum-search all of last weekend to solve the following problem: Where do I get base.txz and kernel.txz for my BeagleBone Black?

Specifically, I want to setup some jails on my BBB, but for that I need the DISTRIBUTION files...
Code:
root@beaglebone:~ # ezjail-admin install
fetch: ftp://ftp.freebsd.org/pub/FreeBSD/releases/arm/armv7/13.0-RELEASE/base.txz: File unavailable (e.g., file not found, no access)
fetch: ftp://ftp.freebsd.org/pub/FreeBSD/snapshot/arm/armv7/13.0-RELEASE/base.txz: File unavailable (e.g., file not found, no access)
fetch: ftp://ftp.freebsd.org/pub/FreeBSD/arm/armv7/13.0-RELEASE/base.txz: File unavailable (e.g., file not found, no access)
fetch: ftp://ftp.freebsd.org/releases/arm/armv7/13.0-RELEASE/base.txz: File unavailable (e.g., file not found, no access)
fetch: ftp://ftp.freebsd.org/snapshots/arm/armv7/13.0-RELEASE/base.txz: File unavailable (e.g., file not found, no access)
fetch: ftp://ftp.freebsd.org/pub/FreeBSD-Archive/old-releases/arm/armv7/13.0-RELEASE/base.txz: File unavailable (e.g., file not found, no access)

Could not fetch base from ftp://ftp.freebsd.org.
  Maybe your release (13.0-RELEASE) is specified incorrectly or the host ftp.freebsd.org does not provide that release build.
  Use the -r option to specify an existing release or the -h option to specify an alternative ftp server.
Querying your ftp-server... Warning: I am having problems querying the ftp server you specified (ftp.freebsd.org).

I thought maybe I can get these files if I build my own release - so I did that. I checked out the sources from https://git.freebsd.org/src.git (stable/13) and cross-build the release. Below are the most essential lines of my build:
Code:
...
make buildworld TARGET_ARCH=armv7 UBLDR_LOADADDR=0x88000000 -DWITH_FDT __MAKE_CONF=/dev/null SRCCONF=/dev/null
make buildkernel TARGET_ARCH=armv7 KERNCONF=GENERIC
...
make installworld TARGET_ARCH=armv7 -DWITHOUT_SHAREDOCS -DWITHOUT_EXAMPLES -DWITHOUT_GAMES -DWITHOUT_HTML -DWITHOUT_INFO -DWITHOUT_MAN DESTDIR=/mnt
make distribution TARGET_ARCH=armv7 DESTDIR=/mnt
make installkernel TARGET_ARCH=armv7 KERNCONF=GENERIC DESTDIR=/mnt
...

I was hoping that base.txz and kernel.txz would be created along the line of my build, but that did not happen :(

My attempt to find any .txz file did not yield any success.
Code:
find /mnt -type f -name '*.txz'

Regardless, I put my build onto an SD-Card and booted my BBB with it. At least that was a success. However, still no base.txz and kernel.txz anywhere :confused:

Obviously, I am missing something! Most likely it will be something very simple, but I can't figure out what. Does anybody know what I am missing? How can I build base.txz and kernel.txz for my BeagleBone Black?
 

kpedersen

Son of Beastie

Reaction score: 1,849
Messages: 2,724

The BBB, is that armv7?

Could you not grab the files you need from the .img here?

It is under ISO-IMAGES so presumably it is an installer image rather than an expandable hard drive?
 
OP
Andreas Strauch

Andreas Strauch

New Member

Reaction score: 1
Messages: 5

Thanks for the tip regarding release.sh, which helped to get things running very conveniently. Still, for arm/armv7 it doesn't give me the distribution files. I installed a fresh FreeBSD-13 VM with no packages (other than git(1) and tmux(1)) and ran the following commands:

Code:
cd /usr/src/release/
sh release.sh -c arm/GENERICSD.conf

Around 4.5h later the build completed and I found the completed image under the /scratch/R directory.
Code:
root@buildhost2:~ # ls -lah /scratch/R/
total 391952
drwxr-xr-x   2 root  wheel   512B Jun 13 15:13 .
drwxr-xr-x  19 root  wheel   512B Jun 13 15:09 ..
-rw-r--r--   1 root  wheel   124B Jun 13 15:13 CHECKSUM.SHA256
-rw-r--r--   1 root  wheel   188B Jun 13 15:13 CHECKSUM.SHA512
-rw-r--r--   1 root  wheel   383M Jun 13 15:09 FreeBSD-13.0-CURRENT-arm-armv7-GENERICSD.img.xz

It seems somehow I am still missing that last step to create the *.txz files?
Code:
root@buildhost2:~ # find /scratch -type f -name '*.txz'
root@buildhost2:~ #

Does anybody know what that last step (that I am obviously missing) is?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,560
Messages: 37,878

Look in the image file. It contains everything to 'burn' that installer to a USB stick. If you want the separate files then building an FTP install directory is probably easier to use.
 

acheron

Aspiring Daemon
Developer

Reaction score: 318
Messages: 768

Try this in /usr/src/release (assuming you've already built the world): make TARGET=arm TARGET_ARCH=armv7 base.txz
 
OP
Andreas Strauch

Andreas Strauch

New Member

Reaction score: 1
Messages: 5

Uh... this feels like getting closer. It doesn't work yet, but I think this could be the right track...

Code:
root@buildhost2:/usr/src/release # make TARGET=arm TARGET_ARCH=armv7 base.txz
[Creating objdir /usr/obj/usr/src/arm.armv7/release...]
mkdir -p dist
cd /usr/src/release/.. && make TARGET_ARCH=armv7 TARGET=arm distributeworld DISTDIR=/usr/obj/usr/src/arm.armv7/release/dist
make[2]: "/usr/src/Makefile.inc1" line 105: A build is required first.  You may have the wrong MAKEOBJDIRPREFIX set.

make[2]: stopped in /usr/src
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src/release

It looks almost as release.sh is a nice "one-stop-shop" but it doesn't play well with the "more manual" build commands. I might need to find out what to set MAKEOBJDIRPREFIX to after a release.sh build and continue the trail from there. I will keep you posted...
 

mtu

Active Member

Reaction score: 101
Messages: 157

You have manually command to build the world first, then you can pack it all up into base.txz:
Code:
make -C /usr/src/ SRCCONF=/my/src.conf -j7 buildworld
make -C /usr/src/release SRCCONF=/my/src.conf base.txz
… is how I have done it.
 

T-Daemon

Daemon

Reaction score: 783
Messages: 1,613

It's more likely MAKEOBJDIRPREFIX is /scratch/tmp/obj.

From post #6
Code:
sh release.sh -c arm/GENERICSD.conf

/usr/src/release/release.sh
Code:
     57         # The directory within which the release will be built.
     58         CHROOTDIR="/scratch"
     ...
    211         CHROOT_MAKEENV="${CHROOT_MAKEENV} \
    212                 MAKEOBJDIRPREFIX=${CHROOTDIR}/tmp/obj"
 
OP
Andreas Strauch

Andreas Strauch

New Member

Reaction score: 1
Messages: 5

T-Daemon, I tried what you suggested in post #12 but no success yet:
Code:
root@buildhost2:/usr/src/release # sh release.sh -c arm/GENERICSD.conf

...

root@buildhost2:/usr/src/release # setenv MAKEOBJDIRPREFIX /scratch/tmp/obj
root@buildhost2:/usr/src/release # make TARGET=arm TARGET_ARCH=armv7 base.txz
[Creating objdir /scratch/tmp/obj/usr/src/arm.armv7/release...]
mkdir -p dist
cd /usr/src/release/.. && make TARGET_ARCH=armv7 TARGET=arm distributeworld DISTDIR=/scratch/tmp/obj/usr/src/arm.armv7/release/dist
make[2]: "/usr/src/Makefile.inc1" line 105: A build is required first.  You may have the wrong MAKEOBJDIRPREFIX set.

make[2]: stopped in /usr/src
*** Error code 1

Stop.
make[1]: stopped in /usr/src
*** Error code 1

Stop.
make: stopped in /usr/src/release

Also, setting the MAKEOBJDIRPREFIX to /usr/obj as acheron suggested in post #10 doesn't work (yields the same error as listed above).

I need a little more time (probably tonight) to try what mtu has suggested in post #11.
 
OP
Andreas Strauch

Andreas Strauch

New Member

Reaction score: 1
Messages: 5

o.k. - I found 2 solutions how to get to base.txz. The first modifies release.sh and the second does it all from the command line.

1st option:

I have tried to manually build base.txz after a successful run of release.sh, but never succeeded. It seems that I was either missing environment variables or did not chroot into the right location. Eventually I simply added a line into the chroot_arm_build_release() subroutine of release.sh:
Code:
371    chroot_arm_build_release() {
372        load_target_env
...
386        export MAKE_FLAGS="${MAKE_FLAGS} ${CONF_FILES}"
387        eval chroot ${CHROOTDIR} env WITH_UNIFIED_OBJDIR=1 make ${MAKE_FLAGS} -C /usr/src/release obj
>>>
+++        eval chroot ${CHROOTDIR} env WITH_UNIFIED_OBJDIR=1 make ${MAKE_FLAGS} -C /usr/src/release base.txz
<<<
388        export WORLDDIR="$(eval chroot ${CHROOTDIR} make ${MAKE_FLAGS} -C /usr/src/release -V WORLDDIR)"
...
415        return 0
416    } # chroot_arm_build_release()
While it ain't pretty, it does the trick and puts base.txz into the /scratch/scratch/tmp/obj/usr/src/arm.armv7/release/ directory during a release.

2nd option:

Basically building world and then building base.txz directly after.
Code:
export MAKEOBJDIRPREFIX=/scratch/obj
mkdir -p /scratch/usr/src && mkdir $MAKEOBJDIRPREFIX
git clone -b stable/13 --depth 1 https://git.freebsd.org/src.git /scratch/usr/src
make -C /scratch/usr/src -j16 TARGET_ARCH=armv7 UBLDR_LOADADDR=0x88000000 -DWITH_FDT __MAKE_CONF=/dev/null SRCCONF=/dev/null buildworld
make -C /scratch/usr/src/release TARGET=arm TARGET_ARCH=armv7 base.txz

The base.txz file will be located under the /scratch/obj/scratch/usr/src/arm.armv7/release/ directory.
 
Top