{"id":683,"date":"2013-06-04T21:22:27","date_gmt":"2013-06-04T19:22:27","guid":{"rendered":"http:\/\/lallafa.de\/blog\/?p=683"},"modified":"2013-06-14T20:17:14","modified_gmt":"2013-06-14T18:17:14","slug":"building-aros-hosted-for-raspbian","status":"publish","type":"post","link":"https:\/\/lallafa.de\/blog\/2013\/06\/building-aros-hosted-for-raspbian\/","title":{"rendered":"Building AROS hosted for Raspbian"},"content":{"rendered":"<p>The Raspberry Pi platform really looks very suitable for running AROS. I wanted to play with this setup and build a Raspbian (armhf) release from source (so I can hack on if I like to). I chose the Linux hosted version of AROS as it is already available in the source tree and Raspi&#8217;s Linux kernel is a very good hardware abstraction layer for all Raspi peripherals. (The native Raspi AROS version exactly suffers from this: It has to implement all peripheral drivers that are already available in Linux &#8211; and that is a daunting task).<\/p>\n<p>I had a look at the <a href=\"http:\/\/en.wikibooks.org\/wiki\/Aros\/Platforms\/Arm_Raspberry_Pi_support\">AROS Raspberry Pi Docs<\/a>,\u00c2\u00a0but unfortunately the compilation details given there didn&#8217;t work for me. I have a xubuntu 12.04 VM running here on my Mac and it seems that this version does not support the multiarch compile given in the docs not very well&#8230; (I even had a quick check with the fresh release 13.04 but that one does not work either&#8230; so things don&#8217;t look good with this approach): The problem I encountered was that the multiarch setup does not allow to install libpng-dev for i386 and libx11-dev\/libsdl-dev for armhf simulatenously. But both are required for a full compile of AROS&#8230;<\/p>\n<p>I played around with the build process and found an own way to perform the build on my system. This post gives you the details&#8230;<\/p>\n<h3><!--more--><\/h3>\n<h3>Prerequisites<\/h3>\n<ul>\n<li>First prepare an (X)Ubuntu system on your PC or in a VM. I used version 12.04 and tested 13.04, but other debian-based releases should work, too<\/li>\n<li>We&#8217;ll use a working directory typically in your home that is called <strong>$WORKDIR<\/strong> in the following. Make sure this directory exists and is empty:<\/li>\n<\/ul>\n<pre>export WORKDIR=&lt;abs\/path\/to\/your\/work\/dir&gt;<\/pre>\n<h3>1. Install base packages<\/h3>\n<ul>\n<li>You need the following local developer packages installed<\/li>\n<\/ul>\n<pre>&gt; sudo apt-get install build-essential git-core flex bison netpbm autoconf \\\r\n                       debootstrap qemu-user-static schroot sudo python libsdl-dev<\/pre>\n<h3>2. Clone AROS sources<\/h3>\n<ul>\n<li>I cloned the AROS sources from the Git repository as described in the <a href=\"http:\/\/www.evillabs.net\/wiki\/index.php\/AROS_m68k-amiga\">EvilWiki<\/a><\/li>\n<\/ul>\n<pre>&gt;\u00c2\u00a0cd $WORKDIR\r\n&gt; git clone git:\/\/repo.or.cz\/AROS.git<\/pre>\n<h3>3. Get the official Raspi cross-compiler<\/h3>\n<pre>&gt; mkdir $WORKDIR\/raspi\r\n&gt; cd $WORKDIR\/raspi\r\n&gt; git clone https:\/\/github.com\/raspberrypi\/tools.git<\/pre>\n<h3>4. Install root file system of raspbian in Ubuntu<\/h3>\n<pre>&gt; cd $WORKDIR\r\n&gt; sudo qemu-debootstrap --arch armhf wheezy chroot-raspbian-armhf http:\/\/archive.raspbian.org\/raspbian<\/pre>\n<h3>5. Access raspbian root via schroot<\/h3>\n<ul>\n<li>We use a secure chroot to enter the raspbian root file system<\/li>\n<li>This allows us to run an emulated ARM apt there and install\/update packages<\/li>\n<\/ul>\n<pre>&gt; sudo vi \/etc\/schroot\/schroot.conf<\/pre>\n<ul>\n<li>Add the following to schroot config and expand the variables $WORKDIR and $USER!<\/li>\n<\/ul>\n<pre>[raspbian]\r\ntype=directory\r\ndirectory=$WORKDIR\/chroot-raspbian-armhf\r\nusers=$USER\r\nroot-users=$USER\r\naliases=default<\/pre>\n<ul>\n<li>Now you can enter the Raspbian root in a shell with:<\/li>\n<\/ul>\n<pre>&gt; schroot -u root\r\n(raspian)#<\/pre>\n<ul>\n<li>Setup packet management in raspian:<\/li>\n<\/ul>\n<pre>(raspbian)# vi \/etc\/apt\/sources.list\r\ndeb http:\/\/mirrordirector.raspbian.org\/raspbian\/ wheezy main contrib non-free rpi<\/pre>\n<ul>\n<li>Update packet list and install required target packets:<\/li>\n<\/ul>\n<pre>(raspbian)# apt-get update\r\n(raspbian)# apt-get install libx11-dev libsdl-dev\r\n(raspbian)# exit<\/pre>\n<h3>6. Fix &#8220;sysroot&#8221; of cross compiler<\/h3>\n<ul>\n<li>The cross-compiler has its own sysroot. We&#8217;ll use the one of the rapsbian root file system to get all includes and libs installed there for the cross-compiler:<\/li>\n<\/ul>\n<pre>&gt; cd $WORKDIR\/raspi\/tools\/arm-bcm2708\/gcc-linaro-arm-linux-gnueabihf-raspbian\/arm-linux-gnueabihf\r\n&gt; mv libc libc.old\r\n&gt; ln -s $WORKDIR\/chroot-raspbian-armhf libc<\/pre>\n<h3>7. A fix for global \/lib references<\/h3>\n<ul>\n<li>Some build steps refer to \/lib\/arm-linux-gnueabihf so let&#8217;s create this link and point into raspbian root<\/li>\n<\/ul>\n<pre>&gt; cd \/lib\r\n&gt; sudo ln -s $WORKDIR\/chroot-raspbian-armhf\/lib\/arm-linux-gnueabihf<\/pre>\n<h3>8. Convenience Link for Toolchain<\/h3>\n<ul>\n<li>With this link we can use <strong>raspi\/bin<\/strong> to reach all commands of the toolchain<\/li>\n<\/ul>\n<pre>&gt; cd $WORKDIR\/raspi\r\n&gt; ln -s $WORKDIR\/raspi\/tools\/arm-bcm2708\/gcc-linaro-arm-linux-gnueabihf-raspbian\/bin<\/pre>\n<h3>9. Patch AROS<\/h3>\n<ul>\n<li>Current AROS trunk didn&#8217;t build out of box for me. Here is a fix.<\/li>\n<li>Create a file <strong>raspi.patch<\/strong> with the following contents:<\/li>\n<\/ul>\n<pre>diff --git a\/configure.in b\/configure.in\r\nindex 07211d3..cd6fa26 100644\r\n--- a\/configure.in\r\n+++ b\/configure.in\r\n@@ -1954,7 +1954,8 @@ AC_HELP_STRING([--enable-includes=dir],[Alternative system include directory]),\r\n\r\n if test \"$aros_kernel_includes\" = \"\"; then\r\n     if test \"x-$aros_flavour\" = \"x-emulation\" -o \"x-$aros_flavour\" = \"x-emulcompat\" ; then\r\n-        aros_kernel_includes=\"-isystem $aros_target_incl\"\r\n+\tkernel_tool_prefix_no_dash=`echo \"$kernel_tool_prefix\" | sed -e 's\/-$\/\/g'`\r\n+\taros_kernel_includes=\"-isystem $aros_target_incl -isystem $aros_target_incl\/$kernel_tool_prefix_no_dash\"\r\n     fi\r\n fi\r\n\r\n@@ -1971,10 +1972,6 @@ if test \"$aros_kernel_includes\" != \"\" ; then\r\n             if test -d \"$aros_kernel_cc_includes\"-fixed; then\r\n                 aros_kernel_cc_includes+=\" -isystem $aros_kernel_cc_includes\"-fixed\r\n             fi\r\n-            # Check for specific includes directory. Neede for Ubuntu 11.10\r\n-            if test -d \"\/usr\/include\/i386-linux-gnu\"; then\r\n-                aros_kernel_cc_includes+=\" -isystem \/usr\/include\/i386-linux-gnu\"\r\n-            fi\r\n         else\r\n             # The directory doesn't exist, we need to do some more work.\r\n             aros_kernel_cc_includes=${PWD}\/${aros_gendir}\/cc_include<\/pre>\n<ul>\n<li> Now you can apply this patch to the source tree and regenerate the configure script:<\/li>\n<\/ul>\n<pre>&gt; cd $WORKDIR\/AROS\r\n&gt; patch -p1 &lt; raspi.patch\r\n&gt; autoconf  # remake configure<\/pre>\n<h3>10. Configure AROS Build<\/h3>\n<ul>\n<li>Configure the build system<\/li>\n<\/ul>\n<pre>&gt; mkdir $WORKDIR\/build\r\n&gt; cd $WORKDIR\/build\r\n&gt; export PATH=$WORKDIR\/raspi\/bin:$PATH\r\n&gt; RASPBIAN_ROOT=$WORKDIR\/chroot-raspbian-armhf\r\n&gt; ..\/AROS\/configure --target=linux-armhf \\\r\n\u00c2\u00a0 \u00c2\u00a0 \u00c2\u00a0 --with-cpu=armv6 --with-fpu=vfp --with-float=hard \\\r\n\u00c2\u00a0 \u00c2\u00a0 \u00c2\u00a0 --x-includes=$RASPBIAN_ROOT\/usr\/include --enable-x11-hidd \\\r\n      --x-libraries=$RASPBIAN_ROOT\/usr\/lib\/arm-linux-gnueabihf \\\r\n      --enable-includes=$RASPBIAN_ROOT\/usr\/include \\\r\n      --with-resolution=800x600x16<\/pre>\n<ul>\n<li>The resolution entry matches my Raspi desktop size. So adjust this value if yours differ<\/li>\n<\/ul>\n<h3>11. Build<\/h3>\n<ul>\n<li>If configure went well then let&#8217;s run the build<\/li>\n<\/ul>\n<pre>&gt; cd $WORKDIR\/build\r\n&gt; make<\/pre>\n<h3>12. Install on your Raspi<\/h3>\n<ul>\n<li>The resulting AROS directory now contains all files needed on the target<\/li>\n<li>I copy all files with rsync to my raspi directly into the $HOME directory<\/li>\n<\/ul>\n<pre>&gt; cd $WORKDIR\/build\/bin\/linux-arm\r\n&gt; rsync -av AROS pi@raspberrypi:<\/pre>\n<h3>13. Run on Raspi<\/h3>\n<ul>\n<li>First make sure X11 is running<\/li>\n<li>Then you can launch AROS with the bootstrap loader<\/li>\n<\/ul>\n<pre>raspi&gt; startx\r\nraspi&gt; export DISPLAY=:0.0\r\nraspi&gt; cd AROS\r\nraspi&gt; boot\/AROSbootstrap -v<\/pre>\n<ul>\n<li>That&#8217;s it. Enjoy AROS!<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>The Raspberry Pi platform really looks very suitable for running AROS. I wanted to play with this setup and build a Raspbian (armhf) release from source (so I can hack on if I like to). I chose the Linux hosted &hellip; <a href=\"https:\/\/lallafa.de\/blog\/2013\/06\/building-aros-hosted-for-raspbian\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[11,16,9],"tags":[],"class_list":["post-683","post","type-post","status-publish","format-standard","hentry","category-amiga","category-raspberry-pi","category-software"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/piBMF-b1","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/posts\/683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/comments?post=683"}],"version-history":[{"count":17,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/posts\/683\/revisions"}],"predecessor-version":[{"id":699,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/posts\/683\/revisions\/699"}],"wp:attachment":[{"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/media?parent=683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/categories?post=683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lallafa.de\/blog\/wp-json\/wp\/v2\/tags?post=683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}