Skip to content
psachin edited this page Dec 13, 2012 · 6 revisions

Introduction

Aakash is a low cost computing device/tablet for students, the project is initiated and funded by MHRD, Govt. of India. Aakash already runs Android 4.0 with many educational apps made by IIT Bombay. Please refer github for some of the apps.

This is the landing page for the Linux on Aakash documentation. To report any bugs please raise issues

Contents

Setting up software tool chain

  • Steps to set up on software side

    1. Get an ubuntu 12.04 machine (any other distro will do, but we have tested on this version of ubuntu)

    2. Download and install Codesourcery cross-compiler from this page, find Download the GNU/Linux Release in ARM processor section, click on link and fill up the form. From link in your email choose the most recent version of toolchain, download the IA32 GNU/Linux Installer version

    3. Download .bin file, make it executable and run it from terminal. Follow the instructions given on the prompt(dash related) and allow GUI installer to copy toolchain to your preferred location. Update the Codesourcery bin directory in your $PATH so that bash can find the binaries

    4. You can alternatively install gcc-arm-linux-gnueabihf instead of Codesourcery cross-compiler, we will use Codesourcery toolchain in rest of this documentation

      sudo apt-get install gcc-arm-linux-gnueabihf
      cpp-arm-linux-gnueabihf
      
    5. Install dependencies for kernel compilation

      apt-get install build-essential dpkg-dev kernel-wedge make
      automake checkinstall git u-boot-tools
      
    6. You may also need adb to extract script.bin from Android's nanda partition and qemu-user-static to install packages in chrooted linux. We will get back to this later. To install adb you can either install entire android-sdk or can you may download binary directly from this link Please make the adb binary executable. And to install qemu-user-static just issue the command

      sudo apt-get install qemu-user-static
      
    7. If you are using x86_64 bit ubuntu then to run adb you must install

      sudo apt-get install ia32-libs-multiarch
      
    8. If you have serial console (Rx, Tx) lines from the board/tablet, then to view console output install minicom (optional)

      sudo apt-get install minicom
      
    9. To setup minicom, connect Aakash's serial port(one which you have soldered out from the board) to your linux machine using suitable level shifter

      sudo minicom -s
      

      and

      • Set the correct serial device(eg. /dev/ttyUSBx)
      • Set BPS to 115200 8N1
      • Hardware flow control to NO
      • Software flow control to NO

      Save the setting as default and exit. From next time when you connect serial console device from Aakash to your ubuntu machine and run

      sudo minicom
      

    N.B: The above serial port setup and minicom are totally optional and will not be discussed later. Please search on web for more details.

Compiling uboot

  • Steps to build uboot

    1. Clone the repository by

      git clone -b sunxi
      https://github.com/androportal/uboot-allwinner.git
      
    2. cd into uboot-allwinner

      cd uboot-allwinner
      
    3. To compile uboot download and install Sourcery CodeBench Lite Edition, then issue:

      make a13_olinuxino CROSS_COMPILE=arm-none-linux-gnueabi-
      
    4. After successful compilation u-boot.bin will be available at root of the directory and sunxi-spl.bin will be in spl directory

  • Installing uboot on SDcard

    1. Insert sdcard in card reader or MMC reader available in laptops/netbooks

    2. Backup all your sdcard data, and issue the following commands carefully, replace X in /dev/sdX with suitable letter(a lower case alphabet) alloted for your sdcard, remember X will never be a if you have a hard disk installed, so keep in mind it must be something like /dev/sdb or /dev/sdc etc. Please check twice and if you are still unsure leave this README right now otherwise you may end up with non bootable machine

      sudo fdisk -u=sectors /dev/sdX
      
    3. Now from same uboot-allwinner directory issue these commands, again replace X with suitable value, now to burn sunxi-spl.bin to sdcard issue

      sudo dd if=spl/sunxi-spl.bin of=/dev/sdX bs=1024 seek=8
      

      Similarly to burn u-boot.in issue

      sudo dd if=u-boot.bin of=/dev/sdX bs=1024 seek=32
      

      At this point we have a bootable sdcard readly. Get kernel and rootfs to make a usuable Linux for your tablet.

Compiling kernel

  • Steps to build kernel

    1. Clone the repository by

      git clone https://github.com/androportal/linux-sunxi.git
      
    2. cd into linux-sunxi

      cd linux-sunxi
      
    3. Checkout to desired branch, it this case sunxi-3.0:

      git checkout sunxi-3.0
      
    4. Compile the a13_configuration

      make ARCH=arm a13_defconfig
      
    5. Download the latest .config file from here and keep it in the root of the kernel source code directory (change the downloaded config file back to .config)

    6. A13-OLinuXino customization can be done using(optional)

      make ARCH=arm menuconfig
      
    7. To compile kernel download and install Sourcery CodeBench Lite Edition, then issue

      make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage
      
    8. To make kernel modules

      make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
      INSTALL_MOD_PATH=out modules
      
    9. To install modules in right path

      make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
      INSTALL_MOD_PATH=out modules_install
      
    10. After successful compilation uImage will be available at arch/arm/boot/uImage and also find script.bin in the root of the directory(This section is subject to change), the kernel modules are available at out/lib/modules/3.0.42+/

  • Kernel on SDcard

    1. Insert sdcard in card reader or MMC reader available in laptops/netbooks

    2. Backup all your sdcard data, and issue the following commands carefully, replace X in /dev/sdX with suitable letter(a lower case alphabet) alloted for your sdcard, remember X will never be a if you have a hard disk installed, so keep in mind it must be something like /dev/sdb or /dev/sdc etc. Please check twice and if you are still unsure leave this README right now otherwise you may end up with non bootable machine

      sudo fdisk -u=sectors /dev/sdX
      
    3. Then create partition for kernel and filesystem in your sdcard, from inside fdisk prompt type p to list all partitions

      Command (m for help): p
      
    4. Now press d to delete your partition. If you have multiple partitions use partition number to delete each partition as shown by fdisk utility

      Command (m for help): d
      
    5. Type n for new partion(hit enter) and then mention p for primary partition, hit enter to continue with default starting sector(2048), enter again for last sector and mention +16M, this partition will be later formatted with vfat for kernel

      Command (m for help): n
      Partition type:
       p   primary (0 primary, 0 extended, 4 free)
       e   extended
      Select (default p): p
      Partition number (1-4, default 1):
      Using default value 1
      First sector (2048-7744511, default 2048):
      Using default value 2048
      Last sector, +sectors or +size{K,M,G} (2048-7744511, default 7744511): +16M
      
    6. The sdcard is assumed to be 4gb size, similarly create 2nd primary partition using remaining disk space which will serve as filesystem

      Command (m for help): n
      Partition type:
         p   primary (1 primary, 0 extended, 3 free)
         e   extended
      Select (default p): p
      Partition number (1-4, default 2):
      Using default value 2
      First sector (34816-7744511, default 34816):
      Using default value 34816
      Last sector, +sectors or +size{K,M,G} (34816-7744511, default 7744511):
      Using default value 7744511
      
    7. Now as we have created 2 primary partitions now let's write(w) the changes to disk. For that issue

      Command (m for help): w
      
    8. As partition is completed, we need to format them respectively, the first partition must be vfat so that uboot can read kernel

      sudo mkfs.vfat /dev/sdX1
      

      For rootfs, create ext4 partition

      sudo mkfs.ext4  /dev/sdX2
      
    9. Now mount vfat partition to some mount point(directory)

      sudo mount -t vfat /dev/sdX1 /mnt/boot
      

      copy kernel to /mnt/boot, assuming that you are still in linux-sunxi directory

      sudo cp arch/arm/boot/uImage /mnt/boot
      

      Also copy script.bin to same directory

      sudo cp script.bin /mnt/boot
      

      Now, umount /mnt/boot, before that you may want to sync so that any remaining buffers are written to disks

      sudo sync
      

      Finally unmount:

      sudo umount /mnt/boot
      

      At this point we have a sdcard read with kernel. Burn uboot and copy rootfs to make a usuable Linux for your tablet.

Getting filesystem ready

  • Step to make file system

    As of now we have uboot and kernel ready for Aakash, the next step is to run few apps, to do so we need Linux file system. One can use any distribuition from here after. We will use ubuntu 12.04 LTS. Just for the record we have also tried Debian wheezy which also works well.

    The main war is between different desktop enviroments. With lot of testing and real world examples we finally decided to go with LXDE. There is lot of scope for customization with LXDE and moreover its almost 50% lighter & twice as faster than any other desktop enviroment.

    1. Insert sdcard again, download the core ubuntu 12.04.1 image from this link and save it in say /tmp directory. Extract the tar file in your sdcard's ext4 partition

      cd /media/<ext4 partition of sdcard>
      

      Now extract core ubuntu file system

      sudo tar -xvpzhf /tmp/ubuntu-core-12.04.1-core-armhf.tar.gz
      
    2. Copy the static qemu binary to mount arm fs in x86 architecture without invoking actual qemu emulator

      sudo cp /usr/bin/qemu-arm-static /media/<ext4 partion of sdcard>/usr/bin/
      
    3. Open /media/<ext4 partition of sdcard>/etc/apt/sources.list in text editor and add universe & multiverse. A sample content is shown

      deb http://ports.ubuntu.com/ubuntu-ports/ precise main universe multiverse restricted
      deb-src http://ports.ubuntu.com/ubuntu-ports/ precise main  universe multiverse restricted
      
    4. Now set up chroot environment

      sudo mount -t proc /proc /media/<ext4 partion of sdcard>/proc
      
      sudo mount -t sysfs /sys /media/<ext4 partion of sdcard>/sys
      
      sudo mount -o bind /dev /media/<ext4 partion of sdcard>/dev
      
      sudo mount -o bind /dev/pts /media/<ext4 partion of sdcard>/dev/pts
      
    5. chroot into the file system

      sudo chroot /media/<ext4 partition of sdcard>/
      
    6. The above two steps can be combined together as a script say, ch-mount.sh. From here after we will call this script to mount and un-mount fs. Please read this script to get any further help

      sudo ch-mount.sh -m /media/<ext4 partition of sdcard>/
      
    7. Now we have a chroot environment with all proc, dev, sys, dev/pts mounted, so run update to fetch repository informations (as chroot has root prompt so no need to write sudo anymore)

      apt-get update
      
    8. Now install english language pack to avoid locale related errors

      apt-get install language-pack-en-base
      
    9. Now install minimal X environment to test our setup

      apt-get install vim.tiny sudo ssh net-tools ethtool \
      wireless-tools lxde lxappearence lxsession lxdm xinit xorg\
      python-gi-cairo onboard utouch rsyslog alsa-utils gnome-mplayer\
      
    10. Add user and set permissions

      # adduser aakash
      
      # addgroup aakash adm
      
      # addgroup aakash sudo
      
      # addgroup aakash audio
      
    11. Open /etc/hostname file in vim.tiny editor and give a hostname, for example write aakash-arm

    12. Similarly open /etc/hosts and remove its content and add these two lines

      127.0.0.1    localhost.localdomain localhost
      127.0.1.1    aakash-arm
      
    13. Open /etc/modules file and add gt818_ts in a new line

    14. Open /etc/lxdm/lxdm.conf and modify it for autologin. Change the autologin section in the top of the file to this

      ## uncomment and set autologin username to enable autologin
      autologin=aakash
      
    15. Now open a new tab in your host Linux machine's terminal and copy /<path to linux kernel>/linux-sunxi/out/lib/modules/3.0.42+/ to your arm ubuntu setup

      sudo cp -r /<path to linux
      kernel>/linux-sunxi/out/lib/modules/3.0.42+/ /media/<ext4
      partition of sdcard>/lib/modules/
      
    16. Download rtl8192cufw.bin from this page, and create a directory as /lib/firmware/rtlwifi in ubuntu chroot, copy rtl8192cufw.bin inside rtlwifi directory

    17. By now we have basic elements set to give a trial run to our OS. Type exit in chroot environment to get back to Ubuntu x86 host prompt, now run un-mount script

      sudo ch-mount.sh -u /media/<ext4 partition of sdcard>/
      

      unmount both the partitions (fat32 and ext4) from your machine, confirm with mount command to check nothing from sdcard is mounted

    18. Remove the sdcard and insert it in your tablet, power on to get ubuntu 12.04 lxde desktop

Tablet tweaks

FAQs

TODO

References

Clone this wiki locally