Difference between revisions of "Development"

From Maemo Leste Wiki
Jump to navigationJump to search
(deb.debian.org does not have stretch anymore)
 
(24 intermediate revisions by 6 users not shown)
Line 17: Line 17:
== Codename ==
== Codename ==


* Maemo Leste is currently based on Devuan Ascii, which is based on Debian Stretch.
* Maemo Leste is currently based on Devuan Chimaera, which is based on Debian Bullseye.
* Maemo Leste will be rebased (in the near future) to Devuan Beowulf, which is based on Debian Buster.
 


== Guides ==
== Guides ==
Line 27: Line 25:
* [[Development/Modified Software]]
* [[Development/Modified Software]]
* [[Development/Device Bringup]]
* [[Development/Device Bringup]]
* https://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide


== Technical ==
== Technical ==
Line 38: Line 37:


=== Developing on a device ===
=== Developing on a device ===
All development software and tests end up in 'chimaera-devel' apt source. For enabling this edit '/etc/apt/sources.list' and add this line:
deb https://maedevu.maemo.org/leste chimaera-devel main contrib non-free droid4
The exact line might depend on your device; just copy the maemo chimaera line and change chimaera to chimaera-devel - for example, if you're not on a mapphone (droid) device, you probably don't want the droid4 component in the line.


Actual development is mostly done from within Maemo Leste itself. (For Maemo Fremantle developers, this might sound weird, but there is essentially no need for a 'scratchbox' type VM)
Actual development is mostly done from within Maemo Leste itself. (For Maemo Fremantle developers, this might sound weird, but there is essentially no need for a 'scratchbox' type VM)
Line 44: Line 49:
The current developers mostly work in a [[Virtual_Machine|Virtual Machine]] or on a [[Raspberry Pi 2|Raspberry Pi]].
The current developers mostly work in a [[Virtual_Machine|Virtual Machine]] or on a [[Raspberry Pi 2|Raspberry Pi]].


=== Multiarch ===
=== Building a Maemo Leste image ===
 
See https://leste.maemo.org/Image_Builder
 
 
=== List of Programs/Daemon specific to Maemo ===
 
https://leste.maemo.org/Development/Daemons
 
=== Crossbuilding ===


Multiarch is an ability present on modern Debian systems that allows you to develop for Maemo Leste using your PC/Mac/Notebook etc.
Multiarch is an ability present on modern Debian systems that allows you to build native packages for different architectures. This is nice because you can build packages for an ARM based phone using the full power of your x86 based PC/Mac/Notebook or a server.


Here we show how you can easily setup a multiarch environment and build some packages on a Debian system.
Here we show how you can easily setup a multiarch environment and build a native package for Maemo Leste running on Nokia N900. We are going to make a container (chroot) for this job. It's because we don't want to pollute our main system.
This can be adapted to develop on other systems as well. If you have such experience, please feel free to expand this section to help more people be involved in Maemo Leste development.


  # Make a container for our development system
  # Make a container for our development system
  DIR=/var/lib/container/stretch
  DIR=/var/lib/container/stretch
  sudo apt-get install qemu-user-static debootstrap &&
  sudo apt-get install qemu-user-static debootstrap systemd-container &&
  sudo debootstrap stretch $DIR http://deb.debian.org/debian &&
  sudo debootstrap --arch=armhf stretch $DIR http://archive.debian.org/debian &&
  echo "strech_cross" | sudo tee $DIR/etc/debian_chroot &&
  echo "strech_cross" | sudo tee $DIR/etc/debian_chroot &&
  sudo systemd-nspawn --bind /usr/bin/qemu-arm-static -D $DIR
  sudo systemd-nspawn --bind /usr/bin/qemu-arm-static -D $DIR
Line 62: Line 75:
  export PKG_CONFIG_PATH=/usr/lib/pkgconfig
  export PKG_CONFIG_PATH=/usr/lib/pkgconfig
  export CC=arm-linux-gnueabihf-gcc
  export CC=arm-linux-gnueabihf-gcc
export JOBS=$(grep processor /proc/cpuinfo | wc -l)
  EOF
  EOF
  dpkg --add-architecture armhf &&
  dpkg --add-architecture armhf &&
  apt-get -y install --no-install-recommends build-essential crossbuild-essential-armhf ca-certificates &&
  apt-get -y install --no-install-recommends build-essential crossbuild-essential-armhf ca-certificates &&
  cat >> /etc/apt/sources.list << "EOF" &&
  cat >> /etc/apt/sources.list << "EOF" &&
  deb http://maedevu.maemo.org/leste leste main contrib non-free n900
  deb http://maedevu.maemo.org/leste ascii main contrib non-free n900
  deb http://maedevu.maemo.org/leste-devel leste-devel main contrib non-free n900
  deb http://maedevu.maemo.org/leste ascii-devel main contrib non-free n900
   
   
  deb-src http://deb.debian.org/debian stretch main
  deb-src http://deb.debian.org/debian stretch main
  deb-src http://maedevu.maemo.org/leste leste main contrib non-free n900
  deb-src http://maedevu.maemo.org/leste ascii main contrib non-free n900
  deb-src http://maedevu.maemo.org/leste-devel leste-devel main contrib non-free n900
  deb-src http://maedevu.maemo.org/leste ascii-devel main contrib non-free n900
  EOF
  EOF
  wget https://maedevu.maemo.org/testing-key.asc &&
  wget --no-check-certificate https://maedevu.maemo.org/testing-key.asc &&
  apt-key add testing-key.asc &&
  apt-key add testing-key.asc &&
  rm -f testing-key.asc &&
  rm -f testing-key.asc &&
Line 87: Line 101:
  echo -e "# crossbuild fix\n0002-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch" >> debian/patches/series &&
  echo -e "# crossbuild fix\n0002-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch" >> debian/patches/series &&
  apt-get -y build-dep -a armhf . &&
  apt-get -y build-dep -a armhf . &&
  time dpkg-buildpackage -aarmhf -j4 -b &&
  time dpkg-buildpackage -aarmhf -j$JOBS -b &&
  echo OK || echo FAIL
  echo OK || echo FAIL


To login the container later, issue the command:
To login the container later:
  sudo systemd-nspawn --bind /usr/bin/qemu-arm-static -D /var/lib/container/stretch
  sudo systemd-nspawn --bind /usr/bin/qemu-arm-static -D /var/lib/container/stretch
If you wish to remove the container, just delete the directory we created:
 
To remove the container:
  sudo rm -fr /var/lib/container/stretch
  sudo rm -fr /var/lib/container/stretch


Line 144: Line 159:
  $ exit
  $ exit
  $ sudo umount dev/pts dev proc
  $ sudo umount dev/pts dev proc
=== Localization ===
See [[Localization]]





Latest revision as of 11:21, 4 August 2024

Maemo Leste development is split up in a few different places.

Communication and organising

Task Summary

For current (semi) impactful tasks, see

Development/Tasks

Codename

  • Maemo Leste is currently based on Devuan Chimaera, which is based on Debian Bullseye.

Guides

Technical

All our git repositories can be found here: https://github.com/maemo-leste

Jenkins

To aid development and provide "continous integration" we have a build server, which takes a git repository and builds software and packages it, and will automatically make said package end up in Maemo Leste repositories. This is done by Jenkins, and the instance can be found here: https://phoenix.maemo.org/

Developing on a device

All development software and tests end up in 'chimaera-devel' apt source. For enabling this edit '/etc/apt/sources.list' and add this line:

deb https://maedevu.maemo.org/leste chimaera-devel main contrib non-free droid4

The exact line might depend on your device; just copy the maemo chimaera line and change chimaera to chimaera-devel - for example, if you're not on a mapphone (droid) device, you probably don't want the droid4 component in the line.

Actual development is mostly done from within Maemo Leste itself. (For Maemo Fremantle developers, this might sound weird, but there is essentially no need for a 'scratchbox' type VM)


The current developers mostly work in a Virtual Machine or on a Raspberry Pi.

Building a Maemo Leste image

See https://leste.maemo.org/Image_Builder


List of Programs/Daemon specific to Maemo

https://leste.maemo.org/Development/Daemons

Crossbuilding

Multiarch is an ability present on modern Debian systems that allows you to build native packages for different architectures. This is nice because you can build packages for an ARM based phone using the full power of your x86 based PC/Mac/Notebook or a server.

Here we show how you can easily setup a multiarch environment and build a native package for Maemo Leste running on Nokia N900. We are going to make a container (chroot) for this job. It's because we don't want to pollute our main system.

# Make a container for our development system
DIR=/var/lib/container/stretch
sudo apt-get install qemu-user-static debootstrap systemd-container &&
sudo debootstrap --arch=armhf stretch $DIR http://archive.debian.org/debian &&
echo "strech_cross" | sudo tee $DIR/etc/debian_chroot &&
sudo systemd-nspawn --bind /usr/bin/qemu-arm-static -D $DIR

# Setup build environment inside the container
cat >> ~/.bashrc << EOF &&
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
export CC=arm-linux-gnueabihf-gcc
export JOBS=$(grep processor /proc/cpuinfo | wc -l)
EOF
dpkg --add-architecture armhf &&
apt-get -y install --no-install-recommends build-essential crossbuild-essential-armhf ca-certificates &&
cat >> /etc/apt/sources.list << "EOF" &&
deb http://maedevu.maemo.org/leste ascii main contrib non-free n900
deb http://maedevu.maemo.org/leste ascii-devel main contrib non-free n900

deb-src http://deb.debian.org/debian stretch main
deb-src http://maedevu.maemo.org/leste ascii main contrib non-free n900
deb-src http://maedevu.maemo.org/leste ascii-devel main contrib non-free n900
EOF
wget --no-check-certificate https://maedevu.maemo.org/testing-key.asc &&
apt-key add testing-key.asc &&
rm -f testing-key.asc &&
rm -f /var/cache/apt/archives/*.deb &&
apt-get update &&
exec bash

# Build Xorg for Nokia N900
apt-get source xserver-xorg-core &&
cd xorg-server-1.19.2 &&
wget https://raw.githubusercontent.com/buildroot/buildroot/88e0f214dcb7c2a99a4425a70673d2aa5f48d720/package/x11r7/xserver_xorg-server/1.20.4/0002-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch &&
mv -v 0002-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch debian/patches &&
echo -e "# crossbuild fix\n0002-configure.ac-Fix-check-for-CLOCK_MONOTONIC.patch" >> debian/patches/series &&
apt-get -y build-dep -a armhf . &&
time dpkg-buildpackage -aarmhf -j$JOBS -b &&
echo OK || echo FAIL

To login the container later:

sudo systemd-nspawn --bind /usr/bin/qemu-arm-static -D /var/lib/container/stretch

To remove the container:

sudo rm -fr /var/lib/container/stretch

Cross-distro solution for development inside an ARM/ARM64 chroot on a PC

It's possible to set up an emulated chroot development environment for ARM on x86/amd64 that will work on almost any Linux distro with just a few simple steps. This will work for systemd-less distros including Devuan and even Maemo Leste on x86/amd64. This guide provides an example for how to set up a generic ARM64 development chroot on a Debian-based distro. This method can similarly be used with images (tarballs) for other devices.

1. Install the QEMU full system emulation static binaries and support for foreign binaries:

$ sudo apt-get install qemu-user-static binfmt-support

The installation should register ARM binaries for automatic execution via QEMU. You can verify this with update-binfmts:

$ sudo update-binfmts --display qemu-arm
qemu-arm (enabled):
     package = qemu-user-static
        type = magic
      offset = 0
       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
 interpreter = /usr/bin/qemu-arm-static
    detector =

2. Find the latest Maemo Leste ARM64 tarball and download and extract it:

$ mkdir leste-arm64
$ cd leste-arm64
$ curl http://maedevu.maemo.org/images/arm64-generic/20190226/maemo-leste-1.0-arm64-generic-20190226.tar.gz | gunzip -c | sudo tar xvf -

3. From the same directory, configure the chroot with a few resources from your host system:

$ sudo mount -t proc proc proc
$ sudo mount -o bind /dev dev
$ sudo mount -o bind /dev/pts dev/pts

4. From the same directory, create a symlink for the mount table:

$ sudo ln -s /proc/mounts etc/mtab

5. From the same directory, set the locale, enter the chroot and switch to the unprivileged user:

$ sudo LC_ALL=C chroot . /bin/su - user

You'll now be ready to use your Maemo Leste ARM64 development environment:

$ uname -m
aarch64

Once you have finished with it, you can exit and unmount the resources you previously mounted:

$ exit
$ sudo umount dev/pts dev proc

Localization

See Localization


TODO

  • Discuss where people look to pick up issues (clear answer is the bugtracker, but still)
  • How people can make changes and how to send them in