View Single Post
Posts: 915 | Thanked: 3,209 times | Joined on Jan 2011 @ Germany
#3138
Debian Jessie went into freeze on 5th of november and as anounced earlier I took this as a chance to build a first Easy Debian image based on it.
So here it is (reinob kindly uploaded the image to dropbox):
https://www.dropbox.com/s/oxeppgy5n9....img.lzma?dl=0

md5sums:
Code:
$ md5sum debian_jessie0sulu_armhf.img*
75151e78b6837fe983f32fc8bec3d336  debian_jessie0sulu_armhf.img
195bddd1bd7623ba08c8412815d03ae6  debian_jessie0sulu_armhf.img.lzma
user password: user
root password: root

btw I screwed up (again) with the nameserver in /etc/resolv.conf. Please see step 17 on how to fix it if you want to have network access from within the image.
Also, I forgot to set libc6 and libc-bin on hold in this image. Please see step 14 on how to fix that on your own.


For the most part the same instructions I put up for creating a wheezy image [1] still apply. However, there had to be some changes.
I hope this covers the whole process:

1)
As mentioned in [2] we need to patch glibc to accept Fremantle's 2.6.28 kernel. You'll need an armhf/armel system running at least kernel 2.6.32 to do all this, so doing it on the N900 itself is no longer an option.
I did all of this on my Cubieboard2, which took about 6 hours. Once you have an image running you can create new patched glibc packages on the N900 (if the watchdog doesn't kill it).
I would strongly advise against using qemu, at least if you're over 40 and want it done before you retire.
If you need newer glibc packages and can't create them on your own drop me a note and I'll build them. But it may take a week or so.

a)
On a Debian Jessie armhf (or armel) system get the glibc sources
Code:
apt-get source glibc
b)
change into the created folder and apply the following changes:

Code:
Description: decrease min kernel version to 2.6.28 for Fremantle compatibility

--- glibc-2.19.orig/ports/sysdeps/unix/sysv/linux/tile/configure
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/tile/configure
@@ -1,4 +1,4 @@
 # This file is generated from configure.ac by Autoconf.  DO NOT EDIT!
  # Local configure fragment for sysdeps/unix/sysv/linux/tile.

-arch_minimum_kernel=2.6.32
+arch_minimum_kernel=2.6.28
--- glibc-2.19.orig/ports/sysdeps/unix/sysv/linux/tile/configure.ac
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/tile/configure.ac
@@ -1,4 +1,4 @@
 GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Local configure fragment for sysdeps/unix/sysv/linux/tile.

-arch_minimum_kernel=2.6.32
+arch_minimum_kernel=2.6.28
--- debian/debhelper.in/libc.preinst.orig       2017-10-08 11:32:18.123876676 +0200
+++ debian/debhelper.in/libc.preinst    2017-10-08 11:33:07.583800072 +0200
@@ -357,11 +357,11 @@
         # sanity checking for the appropriate kernel on each architecture.
         kernel_ver=`uname -r`
 
-        # The GNU libc requires a >= 2.6.32 kernel, found in squeeze/lucid/RHEL6
-        if linux_compare_versions "$kernel_ver" lt 2.6.32
+        # The GNU libc requires a >= 2.6.28 kernel, found in squeeze/lucid/RHEL6
+        if linux_compare_versions "$kernel_ver" lt 2.6.28
         then
             echo WARNING: this version of the GNU libc requires kernel version
-            echo 2.6.32 or later.  Please upgrade your kernel before installing
+            echo 2.6.28 or later.  Please upgrade your kernel before installing
             echo glibc.
             kernel26_help

--- debian/sysdeps/linux.mk.orig        2017-10-08 11:32:00.903903345 +0200
+++ debian/sysdeps/linux.mk     2017-10-08 11:32:39.073844230 +0200
@@ -1,5 +1,5 @@
 # When changing this, make sure to update debian/debhelper.in/libc.preinst!
-MIN_KERNEL_SUPPORTED := 2.6.32
+MIN_KERNEL_SUPPORTED := 2.6.28
Additionally the testsuite checks have to be ignored during the package generation because some of them will fail:
Code:
# diff -u libc6/glibc-2.19/debian/testsuite-checking/compare.sh.orig libc6/glibc-2.19/debian/testsuite-checking/compare.sh
--- libc6/glibc-2.19/debian/testsuite-checking/compare.sh.orig	2014-11-09 14:43:46.809977508 +0000
+++ libc6/glibc-2.19/debian/testsuite-checking/compare.sh
@@ -41,5 +41,5 @@
 
 rm -f $expected $results
 # This would be a lovely place to exit 0 if you wanted to disable hard failures
-#exit 0
+exit 0
 exit $rv
c)
We need to tell dpkg that we changed the sources:
Code:
dpkg-source --commit
This will ask you to specify a name for the patch (chose whatever you like) and bring up the standard editor to provide a description for it.

d)
Now you can build the packages
Code:
debuild -us -uc

2)
While we're at it we can patch pulseaudio as well since it needs to use an older protocol version to be able to communicate with Fremantle's pulseaudio.

a)
get the sources
Code:
apt-get source pulseaudio
b)
change to the folder and apply the patch from [3]:
Code:
Description: decrease protocol version to 15 for Fremantle compatibility

--- pulseaudio-5.0.orig/configure.ac
+++ pulseaudio-5.0/configure.ac
@@ -41,7 +41,7 @@ AC_SUBST(PA_MINOR, pa_minor)
 AC_SUBST(PA_MAJORMINOR, pa_major.pa_minor)

 AC_SUBST(PA_API_VERSION, 12)
-AC_SUBST(PA_PROTOCOL_VERSION, 29)
+AC_SUBST(PA_PROTOCOL_VERSION, 15)

 # The stable ABI for client applications, for the version info x:y:z
 # always will hold y=z
c)
make changes known:
Code:
dpkg-source --commit
d)
build the packages
Code:
debuild -us -uc

3)
Once this is done (or in parallel) we can create our image.

a)
create 2GB image file (adjust size if desired)
Code:
dd if=/dev/zero of=/path/to/image_file bs=1M count=2048
b)
format image file with ext2 (or ext3 etc.)
Code:
mkfs.ext2 /path/to/image_file
c)
mount image
Code:
mount -o loop /path/to/image_file /mountpoint

4)
Then we install Debian via debootstrap

a)
install base system (if you ommit --arch debootstrap will use the host's architecture; chose the Debian mirror closest to your location [4])
Code:
debootstrap --arch=armhf jessie /mountpoint http://ftp.de.debian.org/debian
b)
create /mountpoint/etc/apt/sources.list with this content (again, chose your mirror)
Code:
deb http://ftp.de.debian.org/debian jessie main
c)
(optional) disable default installation of recommended and suggested packages via these entries in /mountpoint/etc/apt/apt.conf
Code:
APT::Install-Recommends "0";
APT::Install-Suggests "0";

5)
So far in the image /var/run is a symlink to /run. For pulseaudio and dbus to work we need this to be swapped (the missing /mountpoint in the last line is not a typo)
Code:
rm -rf /mountpoint/var/run
mkdir /mountpoint/var/run
rm -rf /mountpoint/run
ln -s /var/run /mountpoint/run
we also need directories for pulse and dbus in /var/run
Code:
mkdir /mountpoint/var/pulse
mkdir /mountpoint/var/dbus
So far /var/lock was a symlink to /run/lock. Since we just deleted and recreated /run, this symlink now has no target which means it is treated as a file, not a directory.
For the xserver to start we need this to be a directory again:
Code:
rm /mountpoint/var/lock
mkdir /mountpoint/var/lock

6)
replace the standard keyboard layout in the chroot with the N900 keyboard
I usually do this by mounting my N900 to say /mnt/n900 and copying the whole directory directly from the device
Code:
rm -rf /mountpoint/usr/share/X11/xkb/*
cp -r /mnt/n900/usr/share/X11/xkb/* /mountpoint/usr/share/X11/xkb/

7)
copy the self-built glibc and pulseaudio packages somewhere into the image. Usually you won't need all of them. In any case you'll need the libc6 package itself and the libc-bin package (in my case: libc6_2.19-12_armhf.deb and libc-bin_2.19-12_armhf.deb) and the pulseaudio and libpulse0 packages (pulseaudio_5.0-13_armhf.deb and libpulse0_5.0-13_armhf.deb).
Everything else can either be taken from Debian directly or I didn't need it for my basic setup. You can also find all the binaries I created or used in this [5] binary archive.
In earlier Easy Debian images we also installed libgtkstylus for tap&hold for right click support. This package isn't available in Jessie anymore but the Wheezy package [6] still works. So download it and put it where you put the self-compiled glibc and pulseaudio packages.
There's another way of adressing this tap&hold issue via evdev that wicket used for DebiaN900 [7]. It's advantage is that it doesn't need deprecated packages and that it works for all applications, not only those written in Gtk+. It's downside is a lot of additional Xorg-related packages that would have to be installed. And I haven't fully understood how it works yet, mainly how to find out which devices have to be defined. Any assistance with this would be appreciated.


8)
extra binaries

a)
you'll need these binaries for keyboard focus in the chroot (take them from the provided archive [5], an existing image you have, or compile them on your own; sources are here [8][9])
Code:
/sbin/qobi-wmhint-fix
/usr/bin/set-focus
b)
if you use the provided armel binaries on a armhf image you'll need this symlink (see [10])
Code:
ln -s /lib/ld-linux-armhf.so.3 /mountpoint/lib/ld-linux.so.3
c)
additionally you'll need a script /usr/bin/startlxde1 that starts lxde on $DISPLAY :1 with this content:
Code:
[ "x$GTK_MODULES" != x ] || export GTK_MODULES=libgtkstylus.so
DISPLAY=:1 startlxde
Make sure this script is executable for the user.

If you prefer (and installed) another desktop you can replace startlxde in the 2nd line (e.g. with startxfce4), this script however has to keep its name startlxde1
You can find this script in the binary archive at [5] as well.


9)
chroot into the image
Code:
mount -o bind /proc /mountpoint/proc
mount -o bind /sys /mountpoint/sys
mount -o bind /dev/pts /mountpoint/dev/pts
chroot /mountpoint

10)
update apt and install additional required packages (add any packages you like)
Code:
apt-get update
apt-get install locales lxde-core dbus-x11 roxterm-gtk2 lxde-icon-theme xserver-xephyr bash-completion pulseaudio menu alsa-base alsa-utils jack

11)
fix this locales warning we just received (adjust the locale if you wish; info from here [11])
Code:
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen en_US.UTF-8
dpkg-reconfigure locales

12)
Up until Wheezy lxpolkit was a seperate package and it wasn't included in Easy Debian by default. With the switch to systemd in Jessie lxpolkit was moved into the lxsession package.
Since we have no systemd in Easy Debian (and we can't get it running with this old kernel) lxpolkit will start, but bring up an annoying message box complaining about a missing PID every time we start Easy Debian.
The easiest way of getting rid of this is to delete these files:
Code:
/mountpoint/etc/xdg/autostart/lxpolkit.desktop
/mountpoint/usr/bin/lxpolkit

13)
go to the folder you copied the packages to and replace Debian's glibc and pulseaudio packages with recompiled ones (either from the provided archive or your own ones) and install libgtkstylus
Code:
dpkg -i libc6_2.19-12_armhf.deb libc-bin_2.19-12_armhf.deb pulseaudio_5.0-13_armhf.deb libpulse0_5.0-13_armhf.deb libgtkstylus_0.3-2_armhf.deb

14)
make sure they won't be overwritten by future Debian updates (note: if you use synaptic you have to hold them there as well because synaptic doesn't care for what dpkg says)
Code:
echo libc6 hold |dpkg --set-selections
echo libc-bin hold |dpkg --set-selections
echo pulseaudio hold |dpkg --set-selections
echo libpulse0:armhf hold |dpkg --set-selections

15)
also hold xkb-data (this is where the keyboard layout comes from)
Code:
echo xkb-data hold |dpkg --set-selections
holding lxsession might be wise as well, although it's not critical if it's updated. You'll just have to live with the annoying lxpolkit message or repeat step 12)
Code:
echo lxsession hold |dpkg --set-selections

16)
create a user account. Fremantle's "user" has the UID 29999, but Debian starts creating users by default with a UID of 1000. So we have to specify the UID explicitly. But before we do this we should make sure that the "users" group has the right GID as well. By default it has the GID 100 and is already created but we want it to be GID 29999. So altogether it looks like this
Code:
delgroup users
addgroup -gid 29999 users
adduser -uid 29999 -gid 29999 user

17)
Up to now your image most likely contains an /etc/resolv.conf with an entry like this, which under normal circumstances will prevent any network access from within the image:
Code:
nameserver 192.168.1.254
Change it to look like this:
Code:
nameserver 127.0.0.1

Finally I did some basic tests with the image.

What works:

I) gparted works (at least it doesn't crash right away)

II) audacity works, but it needs some tweaking. On the N900 in Maemo you'll find these files:
Code:
/sbin/ezchroot
/sbin/qchroot
They contain lines like these:
Code:
mount -o bind /dev "$CHROOT/dev"
mount -o bind /proc "$CHROOT/proc"
mount -o bind /tmp "$CHROOT/tmp"
mount -o bind /var/tmp "$CHROOT/var/tmp"
mount -o bind /dev/shm "$CHROOT/dev/shm"
mount -o bind /sys "$CHROOT/sys"
Add this line:
Code:
mount -o bind /dev/snd "$CHROOT/dev/snd"
Then audacity will start (although it will still spill some warnings in the terminal about missing devices) and you'll actually be able to record audio.


What does not work:

I) It's the return of the gimp text tool crash that occured in Wheezy/armel but not armhf. With Jessie we have it in armhf too (I haven't checked Jessie/armel so far). If I start gimp from the image on my Cubieboard 2 it works.

II) Everything udev-related won't work as udev now relies on systemd. I can't estimate what that means right now.



[1] http://talk.maemo.org/showpost.php?p...postcount=3053
[2] http://talk.maemo.org/showpost.php?p...postcount=3030
[3] http://talk.maemo.org/showpost.php?p...6&postcount=34
[4] http://debgen.simplylinux.ch/
[5] http://www58.zippyshare.com/v/Bqm1uBWR/file.html (md5sum: d7e6f0bb49c3371fe2a5cc411b856322)
[6] https://packages.debian.org/wheezy/libgtkstylus
[7] http://talk.maemo.org/showthread.php?t=93878
[8] http://talk.maemo.org/showpost.php?p...4&postcount=23
[9] http://talk.maemo.org/showpost.php?p=425218&postcount=7
[10] http://talk.maemo.org/showpost.php?p...postcount=3040
[11] http://www.thomas-krenn.com/de/wiki/...d_unter_Debian

Last edited by sulu; 2017-10-09 at 13:03. Reason: added glibc patches not recorded by dpkg-source as hinted by @klausade
 

The Following 19 Users Say Thank You to sulu For This Useful Post: