Differences between revisions 21 and 22
Revision 21 as of 2013-07-20 09:47:58
Size: 6922
Comment:
Revision 22 as of 2015-03-29 19:14:22
Size: 1965
Comment:
Deletions are marked like this. Additions are marked like this.
Line 18: Line 18:
== Debian Activities == ##== Debian Activities ==
Line 24: Line 24:
=== Debian on Samsung Galaxy S === ##=== Debian on Nexus 10 (a.k.a. manta) ===
Line 26: Line 26:
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. ##I am having another try at getting a ''pure'' Debian user space working on an android device (I initially tried on Samsung Galaxy S a.k.a. GT-I9000 but never got further than chrooting into a minimal debian rootfs).
Line 28: Line 28:
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). ##I managed to generate a usable rootfs using multistrap as described in [[https://wiki.debian.org/EmDebian/CrossDebootstrap|CrossDebootstrap]].
Line 30: Line 30:
The Samsung GT-I9000 SoC is called Exynos3 a.k.a. S5PV210, unless I am mistaking, and includes the following hardware:
 * Processor: ARM Cortex A8 (armv7 architecture called armhf in debian)
 * Graphics: PowerVR SGX540
 * Memory: 512MB DDR2
 * Storage: 2GB NAND Flash
##I could also compile the android kernel using the cross toolchains mentionned in [[https://wiki.debian.org/CrossToolchains|CrossToolchains]].
##{{{
##git clone https://android.googlesource.com/kernel/exynos.git
##cd exynos
##git checkout remotes/origin/android-exynos-manta-3.4-lollipop-release
##export ARCH=arm
##export SUBARCH=armhf
##export CROSS_COMPILE=arm-linux-gnueabihf-
##make manta_defconfig
##make -j$(nproc)
##}}}
##This is all pretty straightforward when looking at [[http://source.android.com/source/building-kernels.html|Building Android Kernels]]
Line 36: Line 43:
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|mobile devices]] -- PaulWise

Thanks for the informations Paul.

The exact version of the kernel I have is {{{3.0.76-gc0a8d45}}}. The [[http://wiki.cyanogenmod.org/w/Galaxysmtd_Info|CyanogenMod wiki page for Samsung Galaxy S]] contains a link to these [[https://github.com/cyanogenmod/android_kernel_samsung_aries|kernel sources]] which I think are meant to complete the original [[http://source.android.com/source/building-kernels.html|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 [[http://bonedaddy.net/pabs3/log/2012/12/03/debian-mobile/|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}}}).

 I. 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]}}}).

 I. Install the {{{debootstrap}}} package if necessary and create a base debian system as follows. {{{
# debootstrap --foreign --arch=armhf wheezy debian http://ftp.debian.org/debian
}}} This command creates a minimal {{{rootfs}}} of the {{{wheezy}}} suite for the {{{armhf}}} architecture in the {{{debian}}} directory using the {{{http://ftp.debian.org/debian}}} mirror.

 I. 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.

  I. Either emulate target architecture and perform bootstrap second stage.

   I. 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
}}}

   I. Perform bootstrap second stage from the target {{{rootfs}}} using the {{{chroot}}} command as follows. {{{
# chroot debian /debootstrap/debootstrap --second-stage
}}}

  I. Or deploy to target architecture and perform second stage bootstrap.

   I. 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.

   I. Connect to the device using {{{adb}}} in root mode. {{{
# adb root
# adb shell
}}}

   I. 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}}}.

   I. Remount your SD card to allow executing files from it. {{{
root@android# mount -o remount /dev/block/vold/<volume id> /mnt/fuse/[sdcard|emmc]
}}}

   I. 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
}}}

 I. 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.

  I. Configure the system's software sources list by editing the {{{/etc/apt/sources.list}}} file. {{{
# <editor> /etc/apt/sources.list
deb http://ftp.debian.org/debian wheezy main contrib non-free
deb-src http://ftp.debian.org/debian 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.

  I. Configure the system's time zone by reconfiguring the {{{tzdata}}} package. {{{
# dpkg-reconfigure tzdata
}}}

  I. Configure the system's hostname ({{{/etc/hostname}}}). {{{
# hostname <hostname>
}}}

  I. Configure the system's domainname ({{{/etc/domainname}}}). {{{
# domainname <domainname>
}}}

  I. Configure the system's list of known hosts by editing the {{{/etc/hosts}}} file. {{{
# <editor> /etc/hosts
127.0.0.1 localhost
127.0.1.1 <hostname>
}}}
##I am currently trying to gather which bootloader is used on my device and how it loads the kernel. Once I know that, I think I'll be able able to generate a system image to flash the device with and start trying to tweak the default Debian init scripts.

Thomas Breining

Email: thomas.breining@gmail.com

IRC: ThomasBreining, Debian Servers


CategoryHomepage