Thomas Breining


IRC: ThomasBreining, Debian Servers

Debian Activities

Debian on Samsung Galaxy S

I have been trying to understand what is needed to get a pure Debian (without having to chroot and/or use a disk image) working on my Samsung Galaxy S to help with development, testing, packaging or anything else needed.

After a few days of research on the internet, it seems to me that most of the hardware is already supported (except perhaps the modem and other uncommon peripherals).

The Samsung GT-I9000 SoC is called Exynos3 a.k.a. S5PV210, unless I am mistaking, and includes the following hardware:

I'm not sure if the kernel used by Android is the main line one. At least my Cyanogen 10.1 uses a 3.0.76 version in PREEMPT mode which configuration, found in '/proc/config.gz', included the 'CONFIG_PREEMPT' and 'CONFIG_ARCH_S5PV210' parameters set to 'y'. These were the only parameters which seemed relevant to me after quickly browsing the config, I didn't take time to analyze it better and must have missed other important ones though.

This made me think that there shouldn't be much support missing in the kernel for the device and since I am not an expert in these low-level matters, I decided to take a look into what I figured was the next step; the Debian distribution.

/!\ Android never uses mainline kernels (there are a number of Android-specific internal and userland APIs). Added the link to the Replicant version of Linux on the mobile devices -- PaulWise

Thanks for the informations Paul.

The exact version of the kernel I have is 3.0.76-gc0a8d45. The CyanogenMod wiki page for Samsung Galaxy S contains a link to these kernel sources which I think are meant to complete the original Android kernel sources ... Doesn't seem mainline indeed, even though I'm not sure these are the sources corresponding to my kernel.

Anyway, I don't think it will be a big problem to reuse the existing kernel, at least for starters.

I am now trying to understand how to make this kernel initialize a Debian rootfs created with debootstrap or multistrap on the SD card instead of the Android system, like described by PaulWise on this page.

Here is how far I got with debootstrap so far

/!\ The commands described below should be executed with super user rights (either as root or using sudo).

  1. Format your external or internal SD card to ext4 (be warned that once this is done Android won't recognize it and the underlying linux will mount it to /mnt/fuse/[sdcard/emmc] instead of the original /storage/sdcard[0|1]).

  2. Install the debootstrap package if necessary and create a base debian system as follows.

    # debootstrap --foreign --arch=armhf wheezy debian

    This command creates a minimal rootfs of the wheezy suite for the armhf architecture in the debian directory using the mirror.

  3. The previous step only downloaded packages and prepared the root directory structure, it is now necessary to install the packages. There are two options to do this.
    1. Either emulate target architecture and perform bootstrap second stage.
      1. Install the qemu package if necessary and copy the emulator static binary to the target rootfs using the following command.

        # cp /usr/bin/qemu-arm-static debian/usr/bin
      2. Perform bootstrap second stage from the target rootfs using the chroot command as follows.

        # chroot debian /debootstrap/debootstrap --second-stage
    2. Or deploy to target architecture and perform second stage bootstrap.
      1. Copy the debian folder to your ext4 SD card.

        # cp debian /media/<SD card>
        If you have used the device USB storage to make this copy, you will have to turn it off for the next steps.
      2. Connect to the device using adb in root mode.

        # adb root
        # adb shell
      3. Determine your SD card device and mount point using the mount command.

        root@android# mount
        /dev/block/vold/<volume id> /mnt/fuse/[sdcard|emmc] ext4 ...

        Remember the <volume id> and note that the mount options at the end of the line include noexec.

      4. Remount your SD card to allow executing files from it.

        root@android# mount -o remount /dev/block/vold/<volume id> /mnt/fuse/[sdcard|emmc]
      5. Perform bootstrap second stage from the target rootfs using the chroot command as follows.

        root@android# chroot /mnt/fuse/[sdcard|emmc]/debian /bin/bash
        root@android# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
        root@android# /debootstrap/debootstrap --second-stage
  4. Whatever option was chosen for the previous step, the base system can now be configured by going manually through every steps usually taken by the debian installer.
    1. Configure the system's software sources list by editing the /etc/apt/sources.list file.

      # <editor> /etc/apt/sources.list
      deb wheezy main contrib non-free
      deb-src wheezy main contrib non-free

      This will allow to install packages using the apt-get command, note that at this stage the chroot host system's network is used.

    2. Configure the system's time zone by reconfiguring the tzdata package.

      # dpkg-reconfigure tzdata
    3. Configure the system's hostname (/etc/hostname).

      # hostname <hostname>
    4. Configure the system's domainname (/etc/domainname).

      # domainname <domainname>
    5. Configure the system's list of known hosts by editing the /etc/hosts file.

      # <editor> /etc/hosts localhost <hostname>