Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 May 2016 20:54:58 -0300
From:      =?UTF-8?B?T3RhY8OtbGlv?= <otacilio.neto@bsd.com.br>
To:        freebsd-arm@freebsd.org
Subject:   Re: How do you guys cross compile for Zynq (Cortex A9)?
Message-ID:  <53cdb1c9-8732-eecc-bb17-503a8200fffd@bsd.com.br>
In-Reply-To: <CANC_bnM0Y5QFvU3Cdq6rGo6iNRgYiH9eTyLM_YAwiVO4CAVuxg@mail.gmail.com>
References:  <CANC_bnM0Y5QFvU3Cdq6rGo6iNRgYiH9eTyLM_YAwiVO4CAVuxg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Em 22/05/2016 15:48, Emb Aud escreveu:
> Hi Everyone,
>
>    I've got FreeBSD compiled and running on my Zybo (Xilinx Zynq CPU).
>
>    But I can't figure out how to compile programs to run on it.
>
>    I've gone round and round with teh gcc-arm-embedded-5.2.20151219_1
> package, and also with the arm-none-eabi-gcc* packages.  Nothing seem to
> work and there is almost no documentation on this.
>
>    It also looks like the Cortex A9 is armv7-a, but the FreeBSD compile
> instructions I've found (and that work) are for armv6.
>
>    My first problem was not finding the stdio.h header when I tried to
> compile.  I solved that by switching to the gcc-arm-embedded package.  Now
> when I compile it finds the header but it barfs on libc.a... With errors
> like "undefined reference to `_exit'" and other very basic libc functions.
>
>    Can anyone tell me how you are compiling your Zynq programs?
>
>    Thank you.
> _______________________________________________
> freebsd-arm@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"

Dear

I have a Beaglebone Black and I'm using my i7 to cross compile packages 
for beaglebone. The procedure that I'm using is the follow:

1. Update the FreeBSD cross compiler machine to FreeBSD 11.

2. Install poudriere from ports, so you must enable "QEMU  Add 
qemu-user-static to compile ports for non-x86 architect". Remember to 
start qemu after install and add to /etc/rc.conf

3. The first time that I have installed  qemu I ran the follow line, but 
it not clear for me if this still necessary, but the command is the follow:

|# binmiscctl add armv6 --interpreter "/usr/local/bin/qemu-arm-static" 
--magic 
"\x7f\x45\x4c\x46\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00" 
--mask 
"\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff" 
--size 20 --set-enabled 4. I run uname -a to see the revision of my 
freebsd box and then I run: |
# poudriere jail -x -c -j 110armv6 -a arm.armv6 -m svn -v head@300438

This will take a lot of time. where you can replace 300438 by the revision that you are using. The -x flag is very important to poudriere run native tools (like clang) when available to improve
compiler time. When I update the jail I use -x also.

5. Checkout the ports tree. I do it with:

# poudriere ports -c -f poudriere/ports/110armv6 -p 110armv6 -m svn

So, when I need update the ports tree I run  cd /usr/local/poudriere/ports/110armv6/ and svnlite up -r <REVISION>

6. Edit a file with the ports that you want compile. For example:

sysutils/tmux
sysutils/screen
sysutils/usbutils
net/vnstat
multimedia/webcamd
multimedia/ffmpeg
benchmarks/iperf
devel/git
multimedia/v4l-utils
multimedia/pwcview

and save  bbb-pkg_plist

7. Configure ports options:
# poudriere options -c -f bbb-pkg_plist -j 110armv6

8. Start the build:

# poudriere bulk -j 110armv6 -p 110armv6 -v -f bbb-pkg_plist

9. Poudriere dumps lots of log. You can use a browser to see the build 
work. To this install nginx (/usr/ports/www/nginx). Add this to section 
http of

/usr/local/etc/nginx/nginx.conf . I will show the full http entry. My 
machine name is nostromo:

http {
     include       mime.types;
     default_type  application/octet-stream;

     #log_format  main  '$remote_addr - $remote_user [$time_local] 
"$request" '
     #                  '$status $body_bytes_sent "$http_referer" '
     #                  '"$http_user_agent" "$http_x_forwarded_for"';

     #access_log  logs/access.log  main;

     sendfile        on;
     #tcp_nopush     on;

     #keepalive_timeout  0;
     keepalive_timeout  65;

     #gzip  on;

     server {
         listen       0.0.0.0:8080;
         server_name  nostromo;
         root         /usr/local/share/poudriere/html;
         # Allow caching static resources
         location ~* ^.+\.(jpg|jpeg|gif|png|ico|svg|woff|css|js|html)$ {
                 add_header Cache-Control "public";
                 expires 2d;
         }
         location /data {
                 alias /usr/local/poudriere/data/logs/bulk;
                 # Allow caching dynamic files but ensure they get rechecked
                 location ~* ^.+\.(log|txz|tbz|bz2|gz)$ {
                         add_header Cache-Control "public, 
must-revalidate, proxy-revalidate";
                 }
                 # Don't log json requests as they come in frequently 
and ensure
                 # caching works as expected
                 location ~* ^.+\.(json)$ {
                         add_header Cache-Control "public, 
must-revalidate, proxy-revalidate";
                         access_log off;
                         log_not_found off;
                 }
                 # Allow indexing only in log dirs
                 location ~ /data/?.*/(logs|latest-per-pkg)/ {
                         autoindex on;
                 }
                 break;
         }
         location /repo {
                 alias /usr/local/poudriere/data/packages;
                 autoindex on;
         }
     }
}


10. Edit file /usr/local/etc/nginx/mime.types and to text/plain enter 
add log:

text/plain                            txt log;

11. And start nginx:

# /usr/local/etc/rc.d/nginx start

Now you can follow the build. open in your browser the http://<IP OF 
YOUR BUILD MACHINE>:8080

12. While poudriere compile the ports it is necessary configure 
beaglebone to use your machine like a package repo. I do it  doing two 
things in Beaglebone. First I run this command:

|# mkdir -p /usr/local/etc/pkg/repos # echo "FreeBSD: { enabled: no }" > 
/usr/local/etc/pkg/repos/FreeBSD.conf 13. Then edit ||/usr/local/etc/pkg/repos/nostromo.conf . Remember, nostromo is my cross 
compile machine, replace by yours machine. I Add this lines: ||nostromo: { url: 
"pkg+http://nostromo:8080/repo/110armv6-110armv6/.latest", mirror_type: 
"srv", enabled: yes } 14. Edit /etc/hosts in your beaglebone and add the 
ip of your build machine. When build ends you can install packages with 
pkg install . So all times that I wrote beaglebone you can replace by 
your board :) . I follow this procedure by the first time from this 
link: 
https://www.textplain.net/tutorials/2015/cross-compiling-freebsd-ports-for-the-beaglebone-black/ 
But I have modified some things. |||I hope that this can help you.| []'s -Otacílio |




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53cdb1c9-8732-eecc-bb17-503a8200fffd>