We're no longer updating This wiki!!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en:debainandroid [2014/07/01 14:02]
ruppi created
en:debainandroid [2014/07/01 14:02] (current)
ruppi created
Line 1: Line 1:
 +===== Preface =====
 +This page will explain how to build and manage Debian for Odroid. ​ The initial stage is just to "get it working"​ (achieved), whilst the secondary goal is to create a Debian-Installer (adapted netboot) image where Debian packages of the user's own choice can be installed.
 +
 + ​Current status: working pre-built rootfs
 +
 +===== Prerequisites =====
 +
 +A factory-supplied odroid is required. ​ The instructions below assume that the default u-boot and default kernel are still in the T-Flash card.
 +
 +===== Build root file system =====
 +
 +There are several ways to get an armel debian root filesystem: one way is to use QEMU, and then, after installation under qemu, copy the files out.  As this takes quite some time, a pre-prepared rootfs can be found here: http://​lkcl.net/​arm_systems/​CT-PC89E/​rootfs.small.tgz. ​ If you prefer, you can use the rootfs.emdebian.tgz instead: http://​lkcl.net/​arm_systems/​CT-PC89E/​rootfs.emdebian.tgz
 +
 +If you wish to prepare your own rootfs using QEMU, you can follow the instructions here: http://​wiki.lkcl.net/​ArmelQemu
 +
 +Under QEMU, you can literally install absolutely anything that you wish, but it is recommended that you keep it to a minimum: even on a 2ghz Pentium 4, QEMU is dog-slow and it will take you several hours to get past the basic installer.
 +
 +Please bear in mind that if you use the T-Flash card, you only have around 1.5gb of free space (and these instructions assume that you will be using the 2gb T-Flash card). ​ The above rootfs.small.tgz therefore fits into 350mb when unpacked.
 +
 +Also if you would like to use the wireless, make sure that you locate sd8686.bin and sd8686_helper.bin on the T-Flash and copy them off, ready to place BACK onto the root file system in /​lib/​firmware.
 +
 +To copy the files out of QEMU, there are two ways.  If you know what you are doing, shut down QEMU and then you should follow the standard methods for mounting a QEMU drive under the host OS; you will then be able to simply copy the files onto the T-Flash card.
 +
 +Alternatively,​ if you have networking of any kind going (host, bridge, user - it doesn'​t matter which), you can install rsync in the QEMU image and then rsync the filesystem out to the host (!).  Inside qemu, execute this command as root:
 +
 +<​code>​
 +rsync --exclude=/​dev/​* --exclude=/​sys/​* --exclude=/​selinux/​* \
 +      --exclude=/​proc/​* -HPavz / \
 +       ​{hostsystemipaddress}:/​{somewhere}/​armel_rootfs/​
 +</​code>​
 +
 +===== Build root file system - updated =====
 +
 +I have tried in vain to build debian, ubuntu, or any other kinds' root file system following the steps described above for several reasons.
 +
 +Firstly, the links mentioned are not found any longer.
 +
 +Secondly, the closest pre-prepared rootfs found at http://​lkcl.net/​arm_systems/​CT-PC89E/​ct-pc89e-firmware.tgz does not work as well as one would hope.
 +
 +Thirdly, ​ it is not easy to prepare your own rootfs using QEMU, either.
 +
 +Anyways, I have recently built emdebian rootfs for odroid platform thanks to the next web site http://​www.modbus.pl/​S3C2440FS.html
 +
 +What I did is as follows.
 +
 +On the host system,
 +
 +<​code>​
 +$ cd /​{location_of_the_parent_directory}
 +$ mkdir debootstrap
 +$ cd debootstrap
 +$ sudo debootstrap --arch=armel --foreign stable grip/ http://​ftp.uk.debian.org/​emdebian/​grip/​
 +$ cd grip
 +$ tar -jcvf ../​emdebian-grip.tar.bz2 .
 +</​code>​
 +
 +With the Micro-SD card ready,
 +
 +<​code>​
 +$ cd /​{location_where_sd_card_is_mounted_on_host}
 +$ sudo tar -xjvf /​{location_of_the_parent_directory}/​debootstrap/​emdebian-grip.tar.bz2
 +$ sync
 +$ echo "proc /proc proc none 0 0" >>​etc/​fstab
 +$ echo "​odroid"​ >​etc/​hostname
 +</​code>​
 +Insert the Micro-SD card into the odroid platform.
 +Set the bootargs to change from "​init=/​init"​ to /​init=/​bin/​sh"​ temporarily.
 +Boot the board.
 +Eventually, you should arrive at a naked shell prompt - sh-3.2#
 +
 +<​code>​
 +sh# mount /proc /proc -t proc
 +sh# export PATH=/​usr/​local/​sbin:/​usr/​local/​bin:/​usr/​sbin:/​usr/​bin:/​sbin:/​bin
 +sh# /​debootstrap/​debootstrap --second-stage
 +</​code>​
 +
 +It will take quite a while. Patience is a virtue.
 +
 +Set a new password for root
 +
 +<​code>​
 +sh# passwd
 +sh# echo ttySAC0 >>​etc/​securetty
 +</​code>​
 +
 +Follow the instructions below.
 +
 +
 +===== Copy root file system to T-Flash or SDHC =====
 +
 +On the odroid device supplied, the SDHC failed entirely to be recognised (most likely due to a hardware fault). ​ There was therefore no option but to use the 2gb T-Flash. ​ This meant that CAREFUL preparation and formatting of the 2gb T-Flash Micro-SD card was required, so as not to destroy the top 64mb (where u-boot, kernel and other information are placed).
 +
 +Also, if you wish to avoid changing the u-boot parameters, create a single small partition (of absolute minimum size: 16mb). ​ So, first: delete both existing partitions, then create a single small partition, then create a second partition of around 950 blocks. ​ MAKE SURE that the total number of blocks used DOES NOT exceed the total number of blocks originally used.
 +
 +Format the filesystem as ext3 so that you don't have to change the u-boot parameters (rootfstype=ext3). ​ Then, copy the root filesystem DIRECTLY to the new partition: DO NOT copy the subdirectory /​{somewhere}/​armel_rootfs onto the partition! ​ copy the CONTENTS of the subdirectory!
 +
 +===== Small modifications required to rootfs =====
 +
 +You now have an SD-card containing a root filesystem, but it was suited to qemu not to an odroid with a Samsung S5PC100. ​ Firstly: edit the etc/inittab file, and locate the "​Example how to put a getty on a serial line". uncomment it and change ttyS0 9600 to ttySAC0 115200.
 +
 +<​code>​
 +T0:​23:​respawn:/​sbin/​getty -L ttySAC0 115200 vt100
 +</​code>​
 +
 +Secondly: ttySAC0 doesn'​t exist in /dev as far as debian is concerned, at startup. ​ As a workaround, modify /​etc/​udev/​links.conf to include the major and minor numbers for ttySAC0 as the console, instead of tty1 (which is the default). ​ If you leave the console line as it is, then the console output will appear on the main odroid screen (which may be what you want, but this is unlikely). ​ However, you should definitely add the ttySAC0 line.
 +
 +<​code>​
 +M null      c   1 3
 +M console ​  ​c ​  204 64
 +
 +M ttySAC0 ​  c 204 64
 +</​code>​
 +
 +Also, again: to avoid having to change the u-boot parameters, make a symlink from init to sbin/​init. ​ The command as follows looks very strange, but it IS correct. ​ Remember that soft symlinks are simply "​names"​ NOT direct links, and when the odroid boots up on the T-Flash micro SDcard, the symlink will be named "/​init"​ and it will contain the text "/​sbin/​init"​ which of course now points to the correct location... on the T-Flash card.
 +
 +<​code>​
 +cd /​{location_where_sd_card_is_mounted_on_host}
 +ln -s /sbin/init init
 +</​code>​
 +
 +Also, you should modify the etc/fstab file so that the rootfs matches. ​ If you followed the recommended advice, that's going to be mmcblk0p2, but if you failed to follow the recommended advice in creating the tiny partition, that will be mmcblk0p1
 +
 +<​code>​
 +/​dev/​mmcblk0p2 /               ​ext3 ​   errors=remount-ro 0       1
 +</​code>​
 +
 +Also, you may wish to place the sd8686_fw.bin and sd8686_helper.bin into /​lib/​firmware,​ should you wish to use the proprietary wireless chipset.
 +
 +Also, you may wish to place the sd8686_fw.bin and sd8686_helper.bin into /​lib/​firmware,​ should you wish to use the proprietary wireless chipset.
 +
 +Remember to sync and umount the SD card before removing it from the host system.
 +
 +All of the above, and more, has been carried out already, resulting in http://​lkcl.net/​arm_systems/​CT-PC89E/​rootfs.small.tgz which you can simply unpack directly onto the SD card without requiring to make the above modifications.
 +
 +===== Change u-boot parameters =====
 +
 +Depending on whether you decided to follow the advice above or not, you may have one partition or you may have two.  If you have only one, you will need to change the u-boot bootargs parameter to:
 +
 +root=/​dev/​mmcblk1p0 rw rootfstype=ext3 mem=384m init=/​sbin/​init ​ console=ttySAC0,​115200
 +
 +You can avoid having to do this by simply creating one small 16mb partition on the T-Flash card, the result of which is that the root will be /​dev/​mmcblk0p1,​ which exactly matches the existing u-boot parameters: in this way, by following this advice, you would not need to make any changes to the u-boot parameters at all (not even at boot time).
 +
 +===== Run and test =====
 +
 +If you followed the advice above, you can simply switch on the odroid: debian will boot up, and you will be able to log in at the console on the debug board. ​ If you used the rootfs.small.tgz example, that has been set up to auto-login to a matchbox window manager.
 +
 +If you failed to follow the advice above, you may need to enter the u-boot console and modify the bootargs manually:
 +
 +setenv bootargs root=/​dev/​mmcblk1p0 rw rootfstype=ext3 mem=384m init=/​sbin/​init ​ console=ttySAC0,​115200
 +
 +===== Others =====
 +
 +Once you have booted and got a console, log in (there is no root password) and there are a couple of things you might want to do.  One of them is to run "​depmod -a"​. ​ You may need to mkdir /​lib/​modules/​{current_kernel_version}
 +
 +The other thing that you might want to do is to recompile the odroid kernel to use g_ether (USB Networking). ​ On the device supplied, the proprietary wireless has proved unreliable: USB networking is therefore the only way to connect to the outside world. ​ However, other devices may have working wifi: on the rootfs.small.tgz,​ the wireless-tools package was installed, so if you used that, you should be able to simply edit /​etc/​network/​interfaces as normal.
 +
 +Also, on the rootfs.small.tgz,​ a "​standard"​ Xorg was installed (not kdrive or xfbdev). ​ This was a damn sight easier than messing about with xserver-xfbdev,​ especially given that xserver-xfbdev now gets its configuration from daft XML files thanks to HAL.
 +
 +====== Recommendation to use emdebian "​grip"​ =====
 +
 +It is STRONGLY recommended that you use emdebian "​grip"​ in order to save space. ​ Either add this line in the QEMU session or, after copying and booting from rootfs.small.tgz and booting up the odroid and getting networking successfully working, add it then:
 +
 +<​code>​
 +deb http://​emdebian.org/​grip/​ lenny main
 +</​code>​
 +
 +Then, perform an "​apt-get update"​ followed by an "​apt-get upgrade"​. ​ If you run into difficulties with coreutils not upgrading due to an error related to /​usr/​share/​info or something like that, edit /​usr/​bin/​update-info and put "exit 0;" at the top, then do "​apt-get -f install"​ and then "​apt-get upgrade"​ again.
 +
 +===== Future plan =====
 +
 + * Provide information on how to configure HAL, for use with xserver-xfbdev
 + * Configure Xorg to use the HDMI out, for monitor use
 + * Reconfigure the USB-OTG with a kernel recompile to be USB-HOST, so that a High-speed USB hub can be connected and thus other devices (USB keyboard, mice, hard drives, DVD etc.)
 + * Set up a smaller root filesystem containing debian-installer,​ so that people can boot from that.
 +
 +===== references =====
 +
  
en/debainandroid.txt ยท Last modified: 2014/07/01 14:02 by ruppi
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0