AVILA getting close!

Nathan Whitehorn nwhitehorn at freebsd.org
Thu Jun 19 23:39:18 UTC 2014


On 06/19/14 11:45, John Hay wrote:
> On Thu, Jun 19, 2014 at 08:05:31AM +0200, John Hay wrote:
>> On Wed, Jun 18, 2014 at 04:14:51PM -0700, John-Mark Gurney wrote:
>>> Nathan Whitehorn wrote this message on Wed, Jun 18, 2014 at 16:09 -0700:
>>>> On 06/18/14 15:58, John-Mark Gurney wrote:
>>>>> So, w/ the recent couple of patches that alc has provided, I no longer
>>>>> receive kernel panics on my AVILA board!
>>>>>
>>>>> $ uname -a
>>>>> FreeBSD avila.funkthat.com 11.0-CURRENT FreeBSD 11.0-CURRENT #27
>>>>> r267333:267349M: Wed Jun 11 09:57:58 PDT 2014
>>>>> jmg at carbon.funkthat.com:/usr/obj/arm.armeb/usr/src.avila/sys/AVILA  arm
>>>>> $ uptime
>>>>> 12:15AM  up 1 day, 15 mins, 2 users, load averages: 0.13, 0.11, 0.08
>>>>>
>>>>> This survived a portsnap extract...  This is all over NFS...
>>>>>
>>>> What happens if you set LD_BIND_NOW=1 in the environment first?
> I'm now trying to build pkg from ports on a nfs booted CAMBRIA. I can
> build the whole pkg, but then when trying to install, I get
> pkg-static: failed to find the version elf note
>
> #############
> root@:/usr/ports/ports-mgmt/pkg # make install
> ===>  Installing for pkg-1.2.7_3
> ===>  Checking if ports-mgmt/pkg already installed
> pkg-static: failed to find the version elf note
> ===>   Registering installation for pkg-1.2.7_3
> pkg-static: failed to find the version elf note
> pkg-static: failed to find the version elf note
> Installing pkg-1.2.7_3...pkg-static: package field incomplete: architecture
> pkg-static: the package is not valid
> pkg-static: sqlite: cannot rollback - no transaction is active
> If you are upgrading from the old package format, first run:
>
>    # pkg2ng
>
> *** Error code 70
>
> Stop.
> make[1]: stopped in /export/ports/ports-mgmt/pkg
> *** Error code 1
>
> Stop.
> make: stopped in /export/ports/ports-mgmt/pkg
> ##############
>
> Is there some bootstrapping that I need to do? My previous arm stuff
> used the old pkg system.
>
> Searching on Google I found these patches, but I'm unsure if they are
> meant to fix that.
>
> http://people.freebsd.org/~nwhitehorn/pkg_bootstrap_machinearch.diff
> http://people.freebsd.org/~nwhitehorn/pkg_machinearch.diff
>
> Regards
>
> John

Those patches are for a different issue, although the first one will 
incidentally fix the pkg bootstrapper.

The problem here is that pkg tries to get the machine architecture by 
parsing the ELF headers of /bin/sh and then trying to extract enough 
information from there to come up with a string to describe the 
architecture. This is, as you've noticed here, potentially error prone. 
The alternative would be looking at the return value of uname -p 
(=sysctl hw.machine_arch), but this prevents use of pkg to cross-install 
packages onto an image for an architecture whose binaries the host 
system can't execute, leading to the ELF-parsing design. I'm not sure 
whether this feature is worth the fragility, especially given that a lot 
of packages try to run binaries in their install scripts, but that's the 
rationale for it anyway.

You could also imagine some hybrid design where it tries to use 
hw.machine_arch first and then falls back on ELF parsing only if 
installing into a different root and uname can't be executed or 
something, which preserves both behaviors. Worth bringing up with the 
pkg people in any case.
-Nathan


More information about the freebsd-arm mailing list