# Building arm pkgs on amd64



## balanga (Apr 23, 2019)

Is it possible to build arm pkgs on an amd64 release and if so would I need to do this in a jail corresponding to the target release?


----------



## acheron (Apr 23, 2019)

You can do it with poudriere or in a jail (it's more automated with poudriere). qemu-user-static should work for arm https://svnweb.freebsd.org/ports?view=revision&revision=404393


----------



## T-Daemon (Apr 23, 2019)

As acheron adviced, best would be to build those armv5 packages, or any other platform, inside a jail, with ports-mgmt/poudriere.

4.6. Building Packages with Poudriere


> Poudriere is a BSD-licensed utility for creating and testing FreeBSD packages. It uses FreeBSD jails to set up isolated compilation environments. *These jails can be used to build packages for versions of FreeBSD that are different from the system on which it is installed*, and also to build packages for i386 if the host is an amd64 system. Once the packages are built, they are in a layout identical to the official mirrors. These packages are usable by pkg(8) and other package management tools.



For the armv5 platform: Poudriere option `-a armv5` , if build error occures `-a arm.armv5`.


----------



## T-Daemon (Apr 23, 2019)

Building ARMV6 Ports on FreeBSD with Poudriere

It’s an older how to, Poudriere on a FreeBSD 10.1 installation, but it might come handy.


----------



## balanga (Apr 23, 2019)

T-Daemon said:


> Building ARMV6 Ports on FreeBSD with Poudriere
> 
> It’s an older how to, Poudriere on a FreeBSD 10.1 installation, but it might come handy.


I have very little exposure to arm and don't know the difference between armv5 and armv6... is it like the difference between i386 and amd64? I don't suppose armv6 pkgs could run on  armv5...

Another query I have after reading https://wiki.freebsd.org/FreeBSDMarvell  is that there are Big Endian and Little Endian arm modes. How do I tell what I need. From the above link I would guess it was possible to install pkgs, but no repository seems to exist anymore.

I'll crack on with poudriere, but it looks fairly daunting.... initially I only want to build pkg()  and maybe mc() for armv5 rather than 25000 FreeBSD pkgs

My first few attempts at running poudriere just end up  with errors. 
`poudriere jail -c -j 101arm -m svn -a arm.arm -v release/11.0.0`
tells me that I need to install 
`pkg install qemu-user-static`
which I have previously installed and I'm told the most recent version of the package is already installed.


----------



## hukadan (Apr 23, 2019)

balanga said:


> tells me that I need to install


Are you sure this is the entire message ? I would expect the following message :


> You need to install the _qemu_-user-static package or *setup an emulator with binmiscctl(8)*


The binmiscctl(8) step is explained in the blog post given by T-Daemon.

-- Edit --
In the post given below the binmiscctl(8) step is done by *qemu_user_static_enable="YES"*.


----------



## T-Daemon (Apr 23, 2019)

balanga said:


> ... initially I only want to build pkg() and maybe mc() for armv5 rather than 25000 FreeBSD pkgs


You don’t need to. You can select which packages to build. See EXAMPLES section of poudriere(0)

```
[Specify a    list of    ports you want to build]

     Create a flat text    file in    which you put the ports    you want to see    built
     by    poudriere.

       echo    'sysutils/screen' > ~/pkglist
       echo    'editors/vim' >> ~/pkglist
```
or simpler

```
test    a single port
     This second example show how to use poudriere for a single    port.

     Let's take    the example of building    a single port;

       poudriere testport -o category/port -j myjail
```



balanga said:


> tells me that I need to install
> `pkg install qemu-user-static`
> which I have previously installed and I'm told the most recent version of the package is already installed.


This posting might be helpfull.


----------



## balanga (Apr 23, 2019)

T-Daemon said:


> This posting might be helpfull.



This bit was:-
`[LIST=1]
[*]Enable qemu-user-static in rc.conf: qemu_user_static_enable="YES"
[*]Run the startup script to configure your system for building different architectures: /usr/local/etc/rc.d/qemu_user_static start
[/LIST]`


----------



## balanga (Apr 23, 2019)

My first attempt at running poudriere using:-
`poudriere jail -c -j 110arm -m svn -a arm.arm -v release/11.0.0`
resulted in 





> Failed to 'make buildworld'


This was because lint was not found. It has been removed from 12.0.

I did previously manage to build 11.0 for ARM, but that was in an 11.0 jail. Not sure how poudriere is supposed to handle this sort of situation.


----------



## SirDice (Apr 23, 2019)

Never use any of the /release/* tags. Use /releng/11.0 for 11.0-RELEASE.


----------



## balanga (Apr 23, 2019)

SirDice said:


> Never use any of the /release/* tags. Use /releng/11.0 for 11.0-RELEASE.



Using:-
`poudriere jail -c -j 110arm -m svn -a arm.arm -v releng/11.0`

resulted in the same error as above, ie



> Failed to 'make buildworld'



because of a lack of lint in 12.0.


----------



## hukadan (Apr 23, 2019)

Have you any particular reasons to try using *releng/11.0* (EoL since November 30, 2017) instead of *releng/11.2* ?


----------



## balanga (Apr 24, 2019)

hukadan said:


> Have you any particular reasons to try using *releng/11.0* (EoL since November 30, 2017) instead of *releng/11.2* ?


Yes, I can't get 11.2 or 12.0 working on my GoFlexHome unit. I can build both, but get kernel panics as soon as I login, or interrupt storms which make the system unusable, and have no way of diagnosing the problems. Those problems do not appear on 11.0.


----------



## hukadan (Apr 24, 2019)

I see. Here is the commit that allows *releng/11.2* to compile without lint :








						Do not build lint(1) by default on stable-11, add WITH_LINT to enable · freebsd/freebsd-src@5fb1dbc
					

building it.  lint(1) is required on the host build system to build lint(1) libraries, and it is no longer available on FreeBSD 12. This prevents using a 12 or later host to build an 11 or earlier ...




					github.com
				




It seems to me that those modifications could be applied to *releng/11.0* so it could compile using *12-RELEASE*.


----------



## hukadan (Apr 24, 2019)

I managed to compile *releng/11.0* using *12-STABLE* by modifying the share/mk/src.opts.mk and usr.bin/Makefile files as shown in the commit of my previous post. You could edit them by hand (there are just two lines to change), but for convenience here is the patch:








						patch to build FreeBSD releng/11.0 without lint(1)
					

patch to build FreeBSD releng/11.0 without lint(1) - lint.patch




					gist.github.com
				



So basically, to obtain the modified source:
`% svn checkout https://svn.FreeBSD.org/base/releng/11.0 /some/path/freebsd-src
% cd /some/path/freebsd-src`

Then download the patch, place it in /some/path/freebsd-src and apply it:
`% patch -p0 -i lint.patch
% rm lint.patch`

Then, using poudriere(8):
`# poudriere jail -x -m src=/some/path/freebsd-src -b -c -j 110arm -a arm.arm
-- snip --
[00:17:50] Recording filesystem state for clean... done
[00:17:50] Jail 110arm 11.0-RELEASE-p16 1100122 arm is ready to be used`

Do not forget the `-b` option to force building from source.

-- Edit --
`-x` flag added (see this post)


----------

