[GSoC 2014: ARM port] Week #1 and #2

Blog post by dnivra on Sun, 2014-05-04 08:52
Hey everyone! Here’s an update on what’s happened so far.

TL;DR - PulkoMandy managed to build the bootstrap image and kallisti5 has made some progress in running the image on the qemu. This is a significant progress since bootstrap image build never succeeded but not quite usable on BBB. I’ve not made much significant contribution. Instructions for building the bootstrap image are at the end. Otherwise, read on.

Sometime in the middle of last week, PulkoMandy managed to successfully built the bootstrap image of ARM with some changes that can’t be committed(yet). This is significant progress since the ARM bootstrap image wouldn’t build successfully 2 weeks ago. I’ve managed to apply those changes and build the bootstrap image successfully. The steps for building have been specified below.

kallisti5 managed to make some progress on the booting the ARM port front but issues with floating point instructions keep coming up which prevent progress. He has been very helpful by providing a lot of information on how to reproduce what he’s done and also listed out what should probably be the next few steps[1].

The next step is to manually create an SD card image from which qemu can boot the haiku kernel. While this may not be realistically possible in one week, I hope to get the bootloader working at least before I have to temporarily pause work on this owing to exams.

Steps to create a bootstrap image

1. Obtain the source files

Download the haiku source and buildtools as outlined in [2].

$ git clone https://git.haiku-os.org/buildtools
$ git clone https://git.haiku-os.org/haiku
Also download the haikuports, haikuporter and haikuports.cross sources.
$ git clone https://bitbucket.org/haikuports/haikuports.git
$ git clone https://bitbucket.org/haikuports/haikuporter.git
$ git clone https://bitbucket.org/haikuports/haikuports.cross.git
2. Specifying existence of few packages which don’t really exist to enable building of ARM port

Apply the following diff to the haiku source tree.

diff --git a/build/jam/repositories/HaikuPorts/arm b/build/jam/repositories/HaikuPorts/arm
index 6cee1a2..f255a36 100644
--- a/build/jam/repositories/HaikuPorts/arm
+++ b/build/jam/repositories/HaikuPorts/arm
@@ -11,7 +11,17 @@ RemotePackageRepository HaikuPorts
        :
        # repository architecture packages
        # primary architecture (arm)
-
+       curl-7.36.0-1
+       curl_devel-7.36.0-1
+       freetype-2.5.2-2
+       freetype_devel-2.5.2-2
+       gawk-4.1.0-2
+       icu-4.8.1.1-4
+       icu_devel-4.8.1.1-4
+       libsolv-0.3.0_haiku_2013_10_01-1
+       libsolv_devel-0.3.0_haiku_2013_10_01-1
+       zlib-1.2.8-4
+       zlib_devel-1.2.8-4
        :
 
        # source packages
3. Applying patches to enable building on Debian based distros

I use Kubuntu and had to apply the changes specified in the commit[3].

4. Building the bootstrap image

Run the following commands within the haiku source tree.

$ mkdir generated.arm
$ cd generated.arm
$ ../configure --build-cross-tools arm ../../buildtools --include-gpl-addons --include-patented-code --use-gcc-pipe -j2 --bootstrap ../../haikuporter/haikuporter ../../haikuports.cross/ ../../haikuports --target-board beagle
$ jam -q @bootstrap-raw

If multiple processors/cores are available, use -qjX for faster compilation. Compilation can fail at times if this option is specified in which case simply drop the option and try again.

  1. http://www.freelists.org/post/haiku-gsoc/Booting-the-bootstrap-image-is-...
  2. http://haiku-os.org/guides/building/get-source-git
  3. http://bb.haikuports.org/haikuports.cross/commits/4287814086470ad7f68691...

Comments

Re: [GSoC 2014: ARM port] Week #1 and #2

Summary: there are very few pkgs that won't compile with SMP. But unpacking the source tarballs and installing the compiled pkgs usually work much better without SMP.

While the following may not translate directly to Haiku, it may provide a little insight into generic build problems.

In my non-Haiku experiences, I've found that reasonably modern versions of the following pkgs just won't compile using more than one CPU:

  • net-tools
  • dev86
  • acpica
  • slang
  • at
    In the past, I'd also had trouble with groff, openssl and snort.

    Make v3.81 has a bug the prevents a couple most modern pkgs from building. Make v3.82 has a bug that must be patched before it will build a couple modern pkgs.

    The other 200-odd pkgs used to construct a Linux-based firewall are happy to compile with 4-8 CPUs.

  • Re: [GSoC 2014: ARM port] Week #1 and #2

    We already handle problems with building packages in our recipes. Packages which have been identified as having trouble don't get the -j flag passed to make.

    The problem here is in building Haiku itself. We use jam, not make. The dependency tracking in jam is mostly automated (it will scan C files to detect which .h they include, for example), but needs to be done manually for some rules. In this case, there is a problem with a file being built before a required package has been downloaded and decompressed. The issue is probably that we detect that a package has been extracted only by the existence of the root directory of the archive extraction. This means if something tests the dependency while the package is being extracted, it will think the operation is already done, because the directory exists ; yet not all the files are already there.

    Re: [GSoC 2014: ARM port] Week #1 and #2

    hi,

    I'm really interested in porting to arm

    I get this message after the command: ../configure --build-cross-tools arm ......

    deffilep.o: In function `main':
    deffilep.c:(.text.startup+0x0): multiple definition of `main'
    ldmain.o:ldmain.c:(.text.startup+0x0): first defined here
    ei386pe.o: In function `gld_i386pe_unrecognized_file':

    have you an idea for this problem ?

    Re: [GSoC 2014: ARM port] Week #1 and #2

    I think you might be using MinGW gcc to compile which might have issues(someone else could confirm since I've not tried). Could you share the following information? It would be really helpful.
    • The OS you are compiling Haiku on.
    • The version of gcc that you are running on the host machine. Sharing complete output of "gcc -v" would be nice.

    Re: [GSoC 2014: ARM port] Week #1 and #2

    hi,

    I'm on Kubuntu 14.04 x86 with gcc 4.8.2

    regards

    Re: [GSoC 2014: ARM port] Week #1 and #2

    Hmmm that is weird. The instructions in the blog post were tested on Kubuntu 14.04 x64 and so I'm not sure what's going wrong. Sorry I can't be more helpful. Maybe someone who knows their way around Haiku sources better could help. You could also drop by the IRC channel and ask for help after sharing the complete output of the configure command.

    Re: [GSoC 2014: ARM port] Week #1 and #2

    Thank you for the update Arvind. I share you pain as I have spent several days trying to bootstrap Haiku for ARM. Thankfully there are guys like PulkoMandy and others that can shed a light on these problems.
    It would be nice to fix to the Python build once for all, so that there is no need to patch it manually.

    Re: [GSoC 2014: ARM port] Week #1 and #2

    Hello pemdp!
    A quick fix is probably to check if host OS is a Debian based OS, simply execute one set of commands and if not, execute another set of commands. A more detailed fix would probably involve fixing the recipe or the patchset I'm guessing.

    Re: [GSoC 2014: ARM port] Week #1 and #2

    I have opened an issue at haikuports.org about the Python problem. I added a link to an article explaining how to cross compile python, complete with patches and everything. Now all we need is an update to our recipe to use the process they provide, and some testing of it on different distros.