Home Home > 2008 > 09 > 01 > Hackweek Day 3: cross-build with OBS Part 2
Sign up | Login

Deprecation notice: openSUSE Lizards user blog platform is deprecated, and will remain read only for the time being. Learn more...

Hackweek Day 3: cross-build with OBS Part 2

September 1st, 2008 by

This is the second part of my article series about the Hackweek Project “cross-build in the OBS”. The first part can be found here.

Before I come back to our Hackweek project, some information about the qemu emulator. As a preparation to Hackweek, I talked with Uli Hecht and Jan Kiszka. Uli Hecht is the Novell/SUSE Maintainer of the qemu packages in openSUSE:Factory/qemu and maintainer of the OBS project Emulators, where every emulator you can imagine is maintained for a couple of linux distributions. Also I consulted Jan Kiszka, one of the reviewers and maintainers of the qemu upstream project about the status of the qemu in general, “User Mode” and status of important architectures specifily.

We also discussed in our OBS meeting at Hackweek on thursday what performance requirements cross-build has to fullfil in order to get the normal openSUSE:Factory beeing built with cross-build for architectures like arm, sh4 and others used in embedded space. The consensus was that the qemu architectures to start with in the cross-build project are qemu-kvm, including x86 support, and Arm and PowerPC, specifically in the “User Mode”. Ludwig Nussel had already implemented some weeks ago the possibility to use qemu-kvm and uml in addition to Xen inside the OBS workers/local build, and unified the code for the three emulators. The code for all the mentioned features except cross-build itself is already inside the OBS subversion repository in the trunk.

Results of the discussions were:

  • qemu needed further fixing at all, even compared to the very new version in Emulators/qemu, to run OBS cross-build
  • qemu system emulation was considered too slow, specifically when bootstrapping openSUSE:Factory
  • qemu KVM will get a spin later, as a Xen replacement. It is prepared inside OBS workers/osc build
  • qemu PowerPC is generally in bad shape, specifically the “User Mode”, so openSUSE:11.0/ppc cannot run. Inside the gcc/glibc uses the features futexes, pthreads with NTPL and compiler support for TLS, which are not yet implemented
  • qemu Arm, specifically “User Mode”, is in the best possible shape, so Debian:Etch/Arm can run. It does not yet use futexes, pthreads with NTPL and compiler support for TLS, specifically on Arm
  • So much for the theory. Now, I show you how to run build jobs for Debian:Etch/Arm, using normal unmodified Debian type packages. I have prepared for you inside build.opensuse.org/openSUSE:Tools:Unstable and openSUSE:Tools:Devel the required packages for installation. To keep modifications small, and to make sure cross-build can be used also with the official OBS on build.opensuse.org, we decided to first implement cross-build for use with “osc build” local build.

    If you are running a local OBS, you should already be familiar with the installation instructions for it, and I assume you had already successfully installed a local OBS in the past, and also migrated from version to version.

    Update your local OBS for cross-build

    This can be skipped, should Adrian provide Debian:Etch packages for Arm in the official OBS. You need to be root to install the packages. I assume you have ca. 55 GB harddisk space free, and you need to download ca. 36 GB via the internet. The example is for a openSUSE 11.0 machine with an x86_64 processor.

    # mkdir -p /tmp/obs-packages && cd /tmp/obs-packages
    # wget -q -c http://download.opensuse.org/repositories/openSUSE:/Tools:/Unstable/openSUSE_11.0/x86_64/obs-api-
    # wget -q -c http://download.opensuse.org/repositories/openSUSE:/Tools:/Unstable/openSUSE_11.0/x86_64/obs-server-
    # wget -q -c http://download.opensuse.org/repositories/openSUSE:/Tools:/Unstable/openSUSE_11.0/x86_64/obs-worker-

    Now, first save your old /etc/sysconfig/obs-server

    # mv /etc/sysconfig/obs-server /etc/sysconfig/obs-server.old

    Then install the new OBS Packages:

    # rpm -Uhv {obs-api,obs-server,obs-worker}*4791M*.rpm

    Now, edit the new /etc/sysconfig/obs-server file, and comment in the line with arm inside. You have some possibilities. Normally, you would also run the OBS scheduler for x86_64 and i586, so you choose the line with armv4l inside in addition:

    ## Path:        Applications/OBS
    ## Description: define for which architectures the packages should get build
    ## Type:        stringlist
    ## Default:     "i586"
    ## Config:      OBS
    # This needs to be a space seperated list of all supported architectures
    OBS_SCHEDULER_ARCHITECTURES="i586 x86_64 armv4l"

    Now your OBS is ready to be started again. Start everything except the scheduler.

    Now depending on you local OBS setup, you either modify or add a new project with the name Debian:Etch. Once done, add an updated architecture record to it, with the new architecture armv4l added:

    # osc -A api.opensuse.org meta prj Debian:Etch >de.xml

    Now edit file “de.xml” with you favorite editor of you choice and add change the architecture block:

      <repository name="standard">

    Now save the changed file in your local OBS.

    Next copy the meta prjconf from the api.opensuse.org to you local OBS:

    # osc -A api.opensuse.org meta prjconf Debian:Etch >de.conf
    # osc -A <your local ip> meta prjconf -F de.conf Debian:Etch

    To complete the installation, you now finally install the x86_64, i586 as a copy from the official OBS (downloads ca. 22 GB and takes a while):

    # obs_mirror_project Debian:Etch standard i586
    # obs_mirror_project Debian:Etch standard x86_64

    After this, the appropriate directories “/srv/obs/build/Debian:Etch/standard/i586/:full” and “/srv/obs/build/Debian:Etch/standard/x86_64/:full” should have been created and filled with lots of .deb files.

    Then you also need the Debian:Etch binaries for Arm, found on 3 full DVDs. Download them (another ca. 13 GB):

    # wget -c -q ftp://ftp.tu-chemnitz.de/pub/linux/debian/debian-cd/4.0_r4a/arm/iso-dvd/MD5SUMS
    # wget -c -q ftp://ftp.tu-chemnitz.de/pub/linux/debian/debian-cd/4.0_r4a/arm/iso-dvd/debian-40r4a-arm-DVD-1.iso
    # wget -c -q ftp://ftp.tu-chemnitz.de/pub/linux/debian/debian-cd/4.0_r4a/arm/iso-dvd/debian-40r4a-arm-DVD-2.iso
    # wget -c -q ftp://ftp.tu-chemnitz.de/pub/linux/debian/debian-cd/4.0_r4a/arm/iso-dvd/debian-40r4a-arm-DVD-3.iso

    Then check that the MD5SUMS so the downloads were all ok. Mount the images with:

    # mkdir ./mnt
    # mount -o,ro -t iso9660 ./debian-40r4a-arm-DVD-1.iso ./mnt -o loop=/dev/loop3

    Then copy all files with name “*.deb” inside all the 3 DVDs to “/srv/obs/build/Debian:Etch/standard/armv4l/:full”. Finally, chown all correctly to the obsrun user:

    # chown -R obsrun.obsrun /srv/obs/build/Debian:Etch/standard

    Now youre done on the server and can start the scheduler again. It should show up with a line: “armv4l: running for about …” on the OBS monitor webpage, indicating all is done correctly on your local OBS server. The scheduler now needs a while to start up and rescan the new binaries.

    Updates for “qemu”, “build” and “osc” for cross-build

    First, download and install a specifically fixed qemu on your local machine where you want to run “osc build” local build:

    # wget -q -c http://download.opensuse.org/repositories/openSUSE:/Tools:/Unstable/openSUSE_11.0/x86_64/qemu-0.9.2svn20080824.5081-12.1.x86_64.rpm
    # rpm -Uhv qemu-0.9.2svn20080824*.rpm
    # sh /usr/sbin/qemu-binfmt-conf.sh
    # wget -q -c http://download.opensuse.org/repositories/openSUSE:/Tools:/Devel/openSUSE_11.0/noarch/build-cross-2008.08.31.4831M-1.1.noarch.rpm
    # wget -q -c http://download.opensuse.org/repositories/openSUSE:/Tools:/Devel/openSUSE_11.0/x86_64/osc-cross-0.108.4831M-2.1.x86_64.rpm
    # rpm -Uhv {osc-cross,build-cross}*4831M*.rpm

    Now we are ready to run the first “osc build” command for cross-build. To do that, you need a package able to build for Debian:Etch targets. I suggest you to copy e.g. openSUSE:Tools/lzma to your local OBS. Then switch off building for armv4l targets for it inside the meta prj data, and switch on a arm target for the package lzma inside:

    <disable arch='armv4l'/>
    <disable arch='armv4l'/>
      <repository name="Debian_Etch">
        <path repository="Debian_Etch" project="openSUSE:Tools"/>

    Now, checkout the package and try your first cross-build:

    $ cd <goto some local dir>
    $ osc -A <local obs ip> co openSUSE:Tools/lzma
    $ cd  openSUSE:Tools/lzma
    $ osc -A <local obs ip> build --userootforbuild --clean Debian_Etch armv4l lzma.dsc
    Building lzma.dsc for Debian_Etch/armv4l
    Getting buildinfo from server
    Updating cache of required packages
    Writing build configuration
    Getting buildconfig from server
    Running build
      sudo /usr/bin/build --root=/var/tmp/oscbuild-root/martin/Debian_Etch/armv4l --rpmlist=/tmp/rpmlist.gpIne8 --dist=/tmp/buildconfig.8xD3vp lzma.dsc --clean
    --changelog --arch=armv4l
    logging output to /var/tmp/oscbuild-root/martin/Debian_Etch/armv4l/.build.log...
    Memory limit set to 5418004KB
    Using BUILD_ROOT=/var/tmp/oscbuild-root/martin/Debian_Etch/armv4l
    Using BUILD_ARCH=armv4l
    jupiter started "build lzma.dsc" at Mon Sep  1 01:42:01 CEST 2008.
    processing specfile /tmp/obs-update/tmp/openSUSE:Tools/lzma/lzma.dsc...
    running changelog2spec --target debian --file /tmp/obs-update/tmp/openSUSE:Tools/lzma/lzma.dsc
    ...............cut off in the middle.................
    dpkg-gencontrol: warning: unknown substitution variable ${misc:Depends}
    dpkg-deb: building package `lzma' in `../lzma_4.32-6_arm.deb'.
    dpkg-genchanges: including full source code in upload
    dpkg-buildpackage: full upload; Debian-native package (full source is included)

    And cheers, you got it.

    You can experiment with the resulting chroot environment inside the buildroot:

    $ sudo chroot /var/tmp/oscbuild-root/martin/Debian_Etch/armv4l/
    root's password:
    # uname -a
    Linux jupiter #1 SMP 2008-07-13 20:48:28 +0200 armv5tel GNU/Linux
    # file /bin/bash
    /bin/bash: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), for GNU/Linux 2.4.1, stripped
    # ldd /bin/bash
            libncurses.so.5 => /lib/libncurses.so.5 (0x42084000)
            libdl.so.2 => /lib/libdl.so.2 (0x420cf000)
            libc.so.6 => /lib/libc.so.6 (0x420db000)
            /lib/ld-linux.so.2 (0x40081000)

    We have a nice new toy now to play with! Keep happy hacking.

    This finishes the current part of the article series. The next part will be about the next steps in the development, a roadmap, what can we do with it and “when will it be inside build.opensuse.org”.

    Both comments and pings are currently closed.

    Comments are closed.