User:NicolasD
Désolé de pourrir les 'recents changes' :)
Contents
Truc utile
Marre de perdre GRUB lors de la réinstallation de Windows ou de perdre l'accès à Windows après à installer Linux (c'est mon cas)
ou tout simplement rendre inaccessible la partition Linux sur votre machine, voici un truc pour installer que GRUB sur une clé USB
Attention, l'ordre des actions est important
- Formatter la cle USB en fat32 (gparted)
- Récuperer la liste des disques monter ainsi que leur ID
$ sudo blkid /dev/sda1: UUID="CC5C86435C862872" TYPE="ntfs" /dev/sda5: UUID="aad30bf1-d620-4244-9fb5-42f4a38075fb" TYPE="ext3" /dev/sda6: TYPE="swap" UUID="e3163bab-1fcc-4bcd-844d-7dcabc35015c" /dev/sdb1: UUID="4C9D-547F" TYPE="vfat"
- installer Grub sur la cle USB
$ grub-install --no-floppy --root-directory=/media/disk /dev/sdb1 (remplacer sdb1 par la valeur récupérée avec la commande précédente)
- demonter le disque USB
$ sudo umount /media/disk
- Installer le MBR
$ sudo install-mbr /dev/sdb1
- Mettre le flag boot sur la cle USB (gparted)
Banc à sable
Prerequisites for Linux installation
Install needed software packages
For build kernel image for the apf27 Armadeus plateform, we should install uboot-mkimage program
$ sudo apt-get install uboot-mkimage
Update the environment variables
Theses environment variables install the Android and Armadeus folder in our home directory, but of course, it can be placed anywhere! export ANDROID_SOURCE=~/apf27droid export ANDROID_SDK=~/android-sdk-linux_x86-1.5_r3 export ARMADEUS=~/armadeus-3.1 export PATH=${PATH}:${ANDROID_SDK}/tools:${ANDROID_SOURCE}/bin
Download Android source
The getting Android source document describes how to set up our local work environment.
Follow theses instructions until Installing Repo.
$ mkdir ANDROID_SOURCE $ cd $ANDROID_SOURCE $ mkdir bin $ curl http://android.git.kernel.org/repo >$ANDROID_SOURCE/bin/repo $ chmod a+x $ANDROID_SOURCE/bin/repo $ repo init -u git://android.git.kernel.org/platform/manifest.git -b android-sdk-1.5_r3 $ repo sync
Since android-sdk-1.5_r3 branch, the Linux kernel isn't with the Android source, We can download it in a compress archive (tar.gz) file with this android-kernel-2.6.29 (about (70Mib) or with git repository (more 300Mib)
$ mkdir $ANDROID_SOURCE/kernel cd $ANDROID_SOURCE/kernel git clone git://android.git.kernel.org/kernel/common.git android-2.6.29
- /home/rennes/dev/armadeus-3.1/downloads/
./patch-kernel.sh /home/rennes/dev/android-source/kernel . patch-2.6.29.4.bz2
- /home/rennes/dev/armadeus-3.1/buildroot/toolchain/kernel-headers
./patch-kernel.sh /home/rennes/dev/android-source/kernel ./kernel-headers linux-2.6.29.4-\*.patch{,.gz,.bz2}
- /home/rennes/dev/armadeus-3.1/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29.4
./patch-kernel.sh /home/rennes/dev/android-source/kernel ./2.6.29 \*.patch{,.gz,.bz2} mkdir /home/rennes/dev/android-source/kernel/drivers/armadeus cp -r /home/rennes/dev/armadeus-3.1/target/linux/modules/* /home/rennes/dev/android-source/kernel/drivers/armadeus
make ARCH=arm CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi- uImage cp ./arch/arm/boot/uImage /tftpboot/apf27-linux.bin
- modifier les arguments pour le démarage du noyau
setenv bootargs console=ttySMX0,115200 mtdparts=mxc_nand.0:640k(U-boot)ro,384k(U-boot_env),512k(firmware),5M(kernel),-(rootfs) root=/dev/mtdblock4 rootfstype=jffs2 ip=192.168.1.24:192.168.1.189:192.168.1.1:255.255.255.0:apf27::off setenv mmcroot '/dev/mmcblk0p2 rw' setenv addmmcargs 'setenv bootargs ${bootargs} root=${mmcroot} rootfstype=${mmcrootfstype} init=\init androidboot.console=ttyS0'
- installer MTD Utilies
sudo apt-get install mtd-utils mkfs.jffs2 -r ./android-source/out/target/product/generic/system -n -o /tftpboot/apf27-rootfs.arm.jffs2a
- installer les bibliothèques pour lancer make gconfig
sudo apt-get install libgtk2.0-dev libglib2.0-dev libglade2-dev
- modifier le fichier d'init.
/home/rennes/dev/android-source/out/target/product/generic/root/init.rc
$ cd $YOUR_PATH $ mkdir rootfs $ cd rootfs $ rm -rf * $ cp -Rfp ../android-source/out/target/product/generic/root/* . $ cp -Rfp ../android-source/out/target/product/generic/system/ . $ cp -Rfp ../android-source/out/target/product/generic/data/ . $ tar cfvz ../apf27-rootfs-android.tar.gz ./ $ cd .. $ sudo blkid $ sudo mkfs.ext2 /dev/sdd1 (replace X with your MMC reader drive letter, if your Laptop has an integrated MMC reader then use mmcblk0p1 instead of sdX1) $ sudo mkdir -p /media/mmc $ sudo mount /dev/sdd1 /media/mmc $ sudo tar xvf apf27-rootfs-android.tar.gz -C /media/mmc $ sudo chmod -R 777 /media/mmc/*
Sur l'APF27
- mount /dev/mmcblk0p2 /mnt/mmc
- strace -f -ff -tt -s 200 chroot /mnt/mmc /init androidboot.console=ttyS0
- strace chroot /mnt/mmc /init androidboot.console=ttyS0
- tester android avec l'emulateur
$ make ARCH=arm goldfish_defconfig $ make ARCH=arm CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin/arm-eabi
- créer des AVD (Android Virtual Device)
$ ~/dev/android-sdk-linux_x86-1.5_r3/tools/android create avd -n APF27-H -t 2 -s 272x480 $ ~/dev/android-sdk-linux_x86-1.5_r3/tools/android create avd -n APF27-L -t 2 -s 480x272
$ $ANDROID/out/host/linux-x86/bin/emulator -avd APF27-H -sysdir $ANDROID/out/target/product/generic/ -kernel $ANDROID/kernel/arch/arm/boot/zImage -data $ANDROID/out/target/product/generic/userdata.img -ramdisk $ANDROID/out/target/product/generic/ramdisk.img -system $ANDROID/out/target/product/generic/system.img
Android Root File system ¶
Android emulator has 3 basic images on tools/lib/images directory.
* ramdisk.img * system.img * userdata.img
ramdisk.img is gziped cpio archive. ramdisk image is very small and contains configuration files, and some executable files such as init and recovery. The init file is not a regular system V init. It is made just for the Android and do special things to start up the Android system.
system.img and userdata.img are VMS Alpha executable. system.img and userdata.img have the contents of /system and /data directory on root file system. They are mapped on NAND devices with yaffs2 file system. /dev/block/mtdblock0 for /system and /dev/block/mtdblock1 for /data.
/system directory has libraries and default system packages (*.apk). /data directory has timezone, cache, and ApiDemos.apk package.
The main services are zygote(/system/bin/app_process), runtime(/system/bin/runtime), and dbus(/system/bin/dbus-daemon). You can see the /etc/init.rc file on the Android ramdisk image.
... zygote {
exec /system/bin/app_process args { 0 -Xzygote 1 /system/bin 2 --zygote } autostart 1
} runtime {
exec /system/bin/runtime autostart 1
} ... dbus {
exec /system/bin/dbus-daemon args.0 --system args.1 --nofork autostart 1
} ...
Questions on ramdisk, userdata, and system img files
ramdisk.img is a small partition image that is mounted read-only by the kernel at boot time. It only contains /init and a few config files. It is used to start init which will mount the rest of the system images properly and run the init procedure. A Ramdisk is a standard Linux feature.
system.img is a partition image that will be mounted as / and thus contains all system binaries userdata.img is a partition image that can be mounted as /data and thus contains all application-specific and user-specific data.
The build system generates these files, which can later be flashed to a real device, however the emulator uses them in a different way:
* system.img is copied into a temporary file, which is used by the emulator session. So any change you make to / as root in the emulator are lost when the program exits
* userdata.img is only used when you use -wipe-data. Instead, it uses ~/.android/userdata-qemu.img (on Unix) as the persistent /data partition image. Using -wipe-data simply copes the content of userdata.img into userdata-qemu.img