livebox:beagleboneporting

This is an old revision of the document!


Beagle bone notes

Notes on porting the HAH for the beagle bone. These notes really aren't for consumption by anybody but me as reminders for things I did whilst playing around on the Beagle Bone.

Mounting NFS to get back to the BB development x86 box where the cross compiling happens.

busybox mount -t nfs -o nolock,soft,timeo=5,retry=5 bb-dev:/home/brett /home/brett

Setting up /usr/local where the xAP distribution is compiled and setup pointing to our NFS development box.

ln -s /home/brett/svn/trunk/targets/bb.src /usr/local
root@beaglebone:/usr# ls -l /usr
total 116
drwxr-xr-x  3 root root  4096 Sep 11  2012 arm-angstrom-linux-gnueabi
drwxr-xr-x  8 root root 32768 Jan 11  2000 bin
drwxr-xr-x  3 root root  4096 Sep 11  2012 etc
drwxr-xr-x  2 root root  4096 Aug 26  2012 games
drwxr-xr-x 96 root root 12288 Sep 11  2012 include
drwxr-xr-x 66 root root 40960 Jan 11  2000 lib
drwxr-xr-x 11 root root  4096 Jan 11  2000 libexec
lrwxrwxrwx  1 root root    36 Jan 23 09:40 local -> /home/brett/svn/trunk/targets/bb.src
drwxr-xr-x  2 root root  4096 Jan 11  2000 sbin
drwxr-xr-x 99 root root  4096 Apr 19  2012 share
drwxr-xr-x  3 root root  4096 Sep 11  2012 src

Append/Create a library search path, and rebuild the link cache.

echo "/usr/local/lib" >>/etc/ld.so.conf
ldconfig

Fire something up to test this is working.

root@beaglebone:/usr/local/usr/bin# ./xap-hub --help
xAP HUB
Copyright (C) DBzoo, 2008-2010

./xap-hub: [options]
  -i, --interface IF     Default eth0
  -d, --debug            0-7
  -h, --help

COOL - now we can build/run/debug on x86 and have everything available on the BB.

Lets check out LUA.

root@beaglebone:/usr/local/usr/bin# ./lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
"TERMCAP", line 20, col 1, terminal 'SC': Missing separator
> require "pl"
stdin:1: module 'pl' not found:
        no field package.preload['pl']
        no file './pl.lua'
        no file '/usr/share/lua/5.1/pl.lua'
        no file '/usr/share/lua/5.1/pl/init.lua'
        no file '/usr/lib/lua/5.1/pl.lua'
        no file '/usr/lib/lua/5.1/pl/init.lua'
        no file './pl.so'
        no file '/usr/lib/lua/5.1/pl.so'
        no file '/usr/lib/lua/5.1/loadall.so'
stack traceback:
        [C]: in function 'require'
        stdin:1: in main chunk
        [C]: ?

Its going to look in these paths by default and not/usr/local/usr/share/…

We can workaround that with a small shell script wrapper

# Use for local running
# Once on the HAH the paths will all be fine.
LOCAL=/usr/local/usr
export LUA_CPATH="$LOCAL/lib/lua/5.1/?.so;$LOCAL/lib/lua/5.1/?/core.so"
export LUA_PATH="?.lua;luaxap/?.lua;$LOCAL/share/lua/5.1/?.lua;$LOCAL/share/lua/5.1/?/init.lua;$LOCAL/share/lua/5.1/?/?.lua"
export LD_LIBRARY_PATH=$LOCAL/lib:/usr/local/lib
export _PROMPT2="2>"
$LOCAL/bin/lua $*

Launching with our wrapper.

root@beaglebone:/usr/local# ~/lua.sh
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
"TERMCAP", line 20, col 1, terminal 'SC': Missing separator
> require "socket"
> require "pl"
>

First get an ipkg to play with.

wget http://feeds.angstrom-distribution.org/feeds/v2012.05/ipk/eglibc/armv7a/base/busybox_1.19.4-r6_armv7a.ipk

What does the file magic say about it.

[brett@bb-dev ~]$ file busybox_1.19.4-r6_armv7a.ipk
busybox_1.19.4-r6_armv7a.ipk: Debian binary package (format 2.0)

That means its just an 'ar' file format file.

[brett@bb-dev ~]$ ar tv busybox_1.19.4-r6_armv7a.ipk
rw-r--r-- 0/0      4 Apr 28 06:02 2012 debian-binary
rw-r--r-- 0/0 287119 Apr 28 06:02 2012 data.tar.gz
rw-r--r-- 0/0   1602 Apr 28 06:02 2012 control.tar.gz

Note the USER and GROUP are both set to 0 (root/root)

Using the opkg-utils we can unpack this file. I suspect doing this as a non-root user is going to munge permissions.

[brett@bb-dev ~]$ ./opkg-utils/opkg-unbuild busybox_1.19.4-r6_armv7a.ipk

This will create

[brett@bb-dev ~]$ tree -A busybox_1.19.4-r6_armv7a
busybox_1.19.4-r6_armv7a
├── bin
│   ├── busybox
│   └── sh -> busybox
├── CONTROL
│   ├── control
│   ├── postinst
│   └── prerm
└── etc
    ├── busybox.links
    ├── default
    │   └── busybox-syslog
    └── init.d
        └── hwclock.sh

5 directories, 8 files

And forward engineering to turn this directory structure back into an .ipk

[brett@bb-dev ~]$ ./opkg-utils/opkg-build busybox_1.19.4-r6_armv7a /tmp
*** Warning: The following files have a UID greater than 99.
You probably want to chown these to a system user:
drwxr-xr-x. 5 brett brett   4096 Jan 23 21:35 .
drwxr-xr-x. 2 brett brett   4096 Apr 28  2012 ./bin
-rwxr-xr-x. 1 brett brett 519160 Apr 28  2012 ./bin/busybox
lrwxrwxrwx. 1 brett brett      7 Jan 23 21:35 ./bin/sh -> busybox
drwxr-xr-x. 2 brett brett   4096 Apr 28  2012 ./CONTROL
-rw-r--r--. 1 brett brett   1649 Apr 28  2012 ./CONTROL/control
-rwxr-xr-x. 1 brett brett    834 Apr 28  2012 ./CONTROL/postinst
-rwxr-xr-x. 1 brett brett   1001 Apr 28  2012 ./CONTROL/prerm
drwxr-xr-x. 4 brett brett   4096 Apr 28  2012 ./etc
-rw-r--r--. 1 brett brett   2113 Apr 28  2012 ./etc/busybox.links
drwxr-xr-x. 2 brett brett   4096 Apr 28  2012 ./etc/default
-rw-r--r--. 1 brett brett     15 Apr 28  2012 ./etc/default/busybox-syslog
drwxr-xr-x. 2 brett brett   4096 Apr 28  2012 ./etc/init.d
-rwxr-xr-x. 1 brett brett   2445 Apr 28  2012 ./etc/init.d/hwclock.sh

Packaged contents of busybox_1.19.4-r6_armv7a into /tmp/busybox_1.19.4-r6_armv7a.ipk

There is going to be a requirement here that the packages are built as root or at least their permissions and ownerships are setup by root prior to building.

Setting up a development package feed

root@beaglebone:/etc/opkg# cat hah.conf
src/gz hah http://bb-dev.local/feeds/eglibc/ipkg/armv7a/hah

Setup feed location on bb-dev

# mkdir -p /var/www/html/feeds/eglibc/ipkg/armv7a/hah
  • livebox/beagleboneporting.1390521005.txt.gz
  • Last modified: 2014/01/23 23:50
  • by brett