Bootstrapping pkgng on FreeBSD ARM

There is no official pkgng repo for FreeBSD-arm, yet.  There is an unofficial one, here, however in order to use it, you have to have pkgng installed.  As far as I can tell, the only way to install pkgng on ARM is to builds and install from source.
On the platform I'm using, Wandboard, the mmc device isn't working 100% yet, so I decided to compile on a RAM disk.  I did this to create the RAM disk

mkdir /mnt/tmpdisk
mount -t tmpfs tmpfs /mnt/tmpdisk
cd /mnt/tmpdisk

The second step is:

ftp ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/pkg-1.1.4.tar.xz

Once you have the source, untar it, build and install

tar zxvf pkg-1.1.tar.xz
cd pkg-1.1
make
make install

In my case, "make install" on FreeBSD-Current failed due to lack of certain directories.  This may help:

mkdir /usr/local/lib
mkdir /usr/local/man
mkdir /usr/local/libdata
mkdir /usr/local/sbin
mkdir /usr/local/man/man8

Once you've installed pkgng, you should be able to verify that it's available

root@wandboard:/mnt/tmpfs/pkg-1.1.4 # /usr/local/sbin/pkg -v
1.1.4

From here, there are a couple of options.

  • You can use the unofficial repo provided here.
  • You can download the packages you need from here, and install them.

9 Responses to "Bootstrapping pkgng on FreeBSD ARM"

  • jub
    March 13, 2014 - 10:25 am Reply

    Thank you for the informations about Wandboard and FreeBSD!
    I build the images with the crochet-tool and tried to install rsync with pkg – without success.
    I am receiving this error:
    /usr/lib/libarchive.a: could not read symbols: Malformed archive
    I read on a mailing list, that this also happened to you.
    Which revision do you use for building pkg?

    • tom@khubla.com
      March 13, 2014 - 6:04 pm Reply

      I use r262992 and I didn’t experience the problem this that build.

  • jub
    March 14, 2014 - 4:47 pm Reply

    Thank you for the information.
    There must be another issue, the new error is consistent. I tried other pkg versions, also other FreeBSD revisions. You mentioned a problem with the sd-card, so i copied the files to an usb stick and tried the build from there.

    building shared library libpkg.so.1
    install: symlink libpkg.so.1 -> libpkg.so: Operation not supported
    *** Error code 71

    Stop.
    make[1]: stopped in /media/usb/pkg-1.1.4/libpkg
    *** Error code 1

    • tom@khubla.com
      March 14, 2014 - 7:43 pm Reply

      hm. You’re compiling and installing as root, right?

  • jub
    March 15, 2014 - 3:15 am Reply

    true. The bad thing is, when i build with a user in wheel group, it is the same. You are absolutely right, that the error message indicates a permission thing.
    When i find a solution, i will post it here.

    • jub
      March 15, 2014 - 4:11 am Reply

      notice to myself:
      DO NOT USE fat as a filesystem

      • tom@khubla.com
        March 15, 2014 - 10:06 am Reply

        FYI, the only reason there is a FAT partition used in the Wandboard image is that U-Boot doesn’t support FreeBSD UFS yet. There has been some talk of adding UFS support to U-boot, so hopefully that’ll happen.

    • jub
      March 15, 2014 - 7:16 am Reply

      probably not the preferred method…
      i copied some library files (/usr/lib/libcrypto.a; libssl.a; libc.a; ..) with error message “could not read symbols: Malformed archive” from the actual build directory (e.g. crochet-freebsd/work/obj/arm.armv6/usr/src/lib/libc/libc.a) to the wandboard (/usr/lib/).
      After that, make and make install worked.

      • jub
        March 17, 2014 - 4:22 pm Reply

        just for the record:
        my workaround worked until the next reboot – i mixed libraries from different builds
        I made some stupid mistakes:
        a) i did not rebuild the xdev-tools every time i updated the freebsd sources
        b) i used sometimes “make XDEV=arm XDEV_ARCH=arm xdev” instead armv6

        now pkgng 1.2.6 builds with the sources from r263252.

        thanks for the help!

Leave a Reply