Sachin Patil* and Srikant Patnaik** Article *Linux System Administrator in Indian Institute of Technology, Bombay **Research Assistant, FOSSEE, IIT Bombay

GNU/Linux on Aakash

Introduction suited for those who just want their work community, provided they acknowledge In the January 2013 issue of to be done without knowing what goes the original authors and attach the same Communications of CSI, the article within. In contrast, Aakash is specially GNU license with the code. This is where "Genesis of Aakash" had explained the meant for education: we don't want our Android lags behind Aakash: most of events leading to the creation of Aakash student to stop with playing games; the popular free apps are closed source this has been explained by Moudgalya, nor do we want to restrict them to the in nature. Phatak, Sinha, and Varma. In this development of another `Angry Birds' Moreover, because of the licensing article, we will explain the work that we kind of game. We want them to learn, restrictions, it is not possible for us to undertook to port GNU/Linux in native read, write, and carry experiments on their distribute useful Android Apps with mode on Aakash. device. This device should be considered Aakash, since we have to get permission Android is a great platform, it’s equivalent to any desktop we use today. from the creator of each App individually. free, and easy to learn. Most of us will We aimed to give them a full fl edged Each one may want di erent agreement acknowledge the use of ’s Android device to help, play, and experiment forms to be signed. A bigger problem is on Aakash, but not everyone. The reason without any limitations. that most creators of popular Apps are is that Android is not designed to run di cult to locate and hence, the mails to GNU apps, although it is based on Linux Why GNU/Linux (where them will go unanswered. GNU/Linux, on Kernel. This means that one has to rewrite Android lags) the other hand, is especially designed for all useful apps on a new platform, using Android uses the same Linux kernel such campaigns. only Java programming language. Beside optimized for embedded devices and Porting these restrictions, Android also tracks excellent memory management. Though On exploring the hardware of Aakash user activity, and apps may contain ads it has an easy to use GUI, it is generally tablets: we realized that this relatively which are di cult to manage. not suited for everyone, especially new SoC from All-winner has support The fi rst version of Aakash that we students, as explained above. This serves for GNU/Linux, which although limited, worked on came with the Android Ice- strong motive to port GNU/Linux on was su cient enough to start our work. cream sandwich version. It looked nice Aakash. Although GNU/Linux uses the In pursuit of a development board needed with a visually pleasing user interface. It same Linux kernel, its fi le system di ers to start our work, we looked around and had multiple desktop support, e cient completely. It gives us complete freedom fi nally decided to open the device itself. menu applications, perfectly suited for any to explore every part of software as well We asked the vendor for pin numbers touch based device. On scanning through, as hardware. The best part is, the GNU that were needed to obtain the transmit we came across the picture gallery, applications allow the curious learner to data(Tx) and receive data(Rx) pins out calendar, messaging, contacts, clock, etc. read the code and fi nd out the way the applications work. If one is dissatisfi ed from CPU. This information is required These applications come by default with with the application, one is free to for debugging. With the help of a USB to any Android device. The fi rst question download the source code and modify serial converter, we connected the pins that came to our mind was, 'Is this what it accordingly. He or she can even go on to a computer using an USB port. Our will go to our students? What will they do and share their modifi ed code with the hardware team managed to get those with it?’ Most school going children would be unaware of how to use these apps, and instead would play around with drawing tools, games, and other items, which they are familiar with. Sadly no Android device comes with preinstalled educational applications by default. Furthermore, Android was not intended to serve educational purposes. It was created to serve as a mobile operating system. An operating system with GUI specially designed for calling and messaging, which improved as it evolved. Several applications in Android were written by developers across the world. With time, its user interface was optimized, making it easier to use. Until now, Android was largely used as an entertainment operating system. It is well

CSI Communications | July 2013 | 28 www.csi-india.org touch screen drivers, of which two work. For an application like ExpEYES (explained below) and Arduino, which uses an USB-to-serial interface for interacting with the hardware, we had to enable kernel support for Communication Device Class(CDC) ExpEYES as ACM device. On the device level, it is detected as Abstract Control Model(ACM) drivers. The Linux kernel detects /dev/ttyACM0. Also for ACM to work, generic USB support should be enabled in the kernel. On the desktop, we can pass arguments to the kernel, ask kernel to load some modules, disable misbehaving modules and so on. Similarly we can pass arguments to kernel on an embedded device using script.bin fi le. On Aakash, pre-customization, module loading for wireless networks, setting display pins out, after which and our development we decided to use the Codesourcery's resolution, loading touch drivers, etc., can device was ready. Without the serial out, cross-compiler tool-chain. We have used be done using script.bin. Although script. it is di cult to track the booting process. these tool-chains in the past. To set up bin is a binary fi le, actual editing can be We had two choices, either to let Codesourcery's tool-chain, one has to done by converting it to fex format. the GNU/Linux boot from its internal register before downloading its binary. memory(NAND fl ash) itself or to let the After downloading, it has to be installed Ubuntu as GNU/Linux Distribution complete OS boot from an external SD- and a custom path to the tool chain has With the Linux kernel in place, now was the card. Fortunately the All-winner chip has to be set in order to compile the kernel. right time to decide upon fi le system . We a facility to boot the OS from the SD-card. We fi rst used the Debian root fi le-system, tried Debian fi rst, but due to lack of hard- Interested learners can boot GNU/Linux which we got online. The script.bin fi le was fl oat support in Debian Squeeze release, from SD-card without touching any part not fully compatible with Aakash. It took we dropped it. We also tried Debian of Android. us some time to extract Aakash's own Wheezy but we were uncertain about of We started compiling the boot loader. script.bin fi le and to change its default pre-release versions. The best choice left The boot-loaders on embedded system parameters to make a running kernel and to us was Ubuntu, which is known for are di erent, and in Aakash the complete root fi le-system. Merely modifying script. being easy to use amongst newcomers OS has to boot from the SD-card. Then bin fi le was not enough, some kernel and advanced developers alike. It has we went on to compile U-boot. It is the modules like WiFi and touch have to be a great package-manager, using which uboot binary fi le on SD-card, which makes auto-loaded while booting. These changes one can install required packages both the SD-card bootable. After successfully have to be made in the fi le-system path / from command line and using graphical loading, the uboot fi nally calls on the kernel etc/modules to make them work. With interface. Hence we agreed to use Ubuntu. to initialize hardware. We used minicom to all those changes, we had basic version We started with Ubuntu-12.10 view all booting processes. The next major running in a week. core arm hard-fl oat distribution. When challenge was the Linux kernel. It is the On Aakash, GNU/Linux boots uncompressed, it consumes around most important part, as all the hardware from micro SD-card and the fi le-system 100MB only. We used the ch-root and applications ultimately depend on it. reside within the SD-card. Both Android environment to confi gure package- If the kernel successfully detects all the and GNU/Linux operating systems are manager, basic network tools, user hardware, then we can proceed further to completely isolated from other. The good applications and a desktop environment. test the fi le system. If not, we need to fi x it part is that we can access all the Android's Before putting the fi le-system to by analyzing Android kernel logs, keeping content from GNU/Linux. actual use, the compiled kernel and its in mind all the hardware and confi guring Enabling touch was a major modules were placed in /lib/modules the same in our present kernel. Thanks challenge, as we have never worked to the open source community, we found on touch before. Initially when tried to forked versions of original Linux kernel interact with the tablet using touch on maintained by All-winner team. Debian, it didn't respond. We had to go We used the default cross-compiler through Android's log-cat and dmesg to as suggested online. It gave compilation identify the touch screen driver, which we errors and the compilation process found out was focal-touch(ft5x_ts). When failed frequently. This is the same cross- it was enabled as a module, it worked but compiler that is readily available in we had to disable the multi-touch feature Ubuntu's repository. After many trial in the fi le. Currently Aakash has three

CSI Communications | July 2013 | 29 OSCAD is another open source EDA tool, acronym as Open Source Computer Aided Design. It has been developed using several open source tools like KiCad, Ngspice, and Scilab at IIT Bombay. Python- TKinter is used to program its front-end. Since tools such as KiCad, Ngspice, and Scilab already run on Aakash, OSCAD's installation procedure was similar to any other desktop running GNU/linux. Aakash's capability to run Electronic design tools is demonstrated by the fact that OSCAD runs on it. We also installed iPython-notebook for scientifi c computing, and Mayavi2 for 3D visualization of data. Conclusion After these customization process, we now have Ubuntu 12.10 with Linux directory of the fi le-system, where all Scilab-5.3.3 was also installed and tested. kernel version 3.0.57 working on kernel modules reside. Both numerical and graphical calculations Aakash. It is suitable for educational The next challenge was the Desktop are executed much faster than on as well as entertainment purposes. environment. We tried Unity, KDE Android(https://github.com/androportal/ For programming and development Plasma, XFCE, MATE, enlightenment APL-apk). More than 150 Scilab textbook one can attach an external keyboard (e17), and Gnome-3, all of which need companions (http://scilab.in) are now and mouse, if one is not comfortable around 120 MB RAM with some hardware available in our latest builds. A Scilab with virtual keyboard. One can see acceleration, except e17. After considering textbook companion is a listing of code all the features and application of a the options we fi nally decided to go with that implements worked out examples typical desktop computer on Aakash. LXDE(not Lubuntu). in standard textbooks. Arduino, an open With ExpEYES and Arduino working, The Ubuntu-core fi le-system includes source hardware with Gnoduino IDE, has one can perform hardware interfacing only basic utilities and a package-manager also been tested and included. with any other hardware. GNU/Linux (apt-get). Comparing with a Desktop ExpEYES is a hardware and software on Aakash provides opportunities to version, it does not even have a basic tool for learning and exploring science experiment on a portable device. With networking tools like ping or root user experiments. It supports 50 experiments 1 GHz processor and 512MB memory, it utilities, such as sudo. Ubuntu Boot-splash for high-school and above. For interacting has the potential to run any other GNU screen, Desktop-Environment, screen with the hardware, we have a Debian applications. Currently we have image savers, UbuntuOne sync, daemons, etc., package called ExpEYES Junior. This is targeted for 8GB SD-card of which consume a lot of memory. We compared a tablet version alternative for ExpEYES first 16M FAT partition is dedicated memory consumption of each process in desktop. to bootloader(uboot.bin) and script. before installing one in core fi le-system. For example, Ubuntu's default Desktop- Environment(Unity) consumed much more memory than LXDE. By discarding these overheads, we fi nally managed to boot Ubuntu in less than 50MB RAM. We also made a few customizations on open- box and gtk2.0 to make it touch friendly. Applications We focused largely on educational applications. With repositories in the path, one can easily install any application of one's choice. We pre-installed some popular and useful applications. The fi rst application we installed was Onboard, to serve as the virtual keyboard. Next we installed the LibreO ce pack. Although it’s a bit heavier than AbiWord, its features make it worth installing.

CSI Communications | July 2013 | 30 www.csi-india.org bin file. 1GB is used as swap file- of CSI, we had announced a competition Traditionally all applications running system in case if the actual RAM gets based on Aakash, for both Android and on GNU/linux desktop should also run used up. The entire file-system along GNU/Linux operating systems. on GNU/linux on Aakash. But one must with install applications and other This competition aimed to encourage ensure that the application is touch utilities consumes around 3GB space. students and individuals across the country friendly and consumes minimum RAM. Approximately 3.5 GB is left free for to come up with innovative applications The Aakash team at IIT Bombay is willing storage and other installation to user. that could be used on Aakash. The source to help the participants: for example, The capacity of the SD-card can be code of each application will be released as the participants: for example, the expanded up to 32GB. free and open source. The Application can participants can send their application to Contributing to Project be Android or GNU/linux based. us for testing. More that 1600 participants We look forward to seeing GNU/Linux We still have many open issues on registered for the Aakash application enthusiasts contribute to this project. GNU/linux port. Before contributing, development competition. These Please visit our github page for detailed we expect the participants of the participants are from various engineering documentation on porting of Aakash. competition to go through our GNU/ colleges and universities across India. We There are many open issues, such as, linux porting documentation on github asked those participants to re-group in brightness control, sleep mode, touch page http://androportal.github.io/linux- drivers, etc. We have documented our teams consisting of maximum 5 people, and re-submit their project proposal. On on-aakash/. work at http://androportal.github.com/ We are in need of developers who linux-on-aakash/. the basis of project description, we have shortlisted 140 teams, whose work will be are interested in GNU/Linux system. They Aakash Application Development developed further. Any updates related must have sound knowledge of Linux Competition to competition will be posted on http:// kernel and working of various GNU/linux In January 2013 issue of Communications aakashlabs.org/compete. distributions. n

Srikant Patnaik He is a developer, teacher and motivator. His fi rst contribution to FOSS came as a simple 8051 Programmer for Linux, available at sourceforge. He served as a Lecturer at Loyola academy, Hyderabad. Later joined IIT Bombay as a Research Assistant in FOSSEE project. He contributed in Porting of GNU/Linux on Aakash and also associated with Android app to run Scilab and other programming languages. His interests include blogging, designing circuits, bridging software and hardware.

Sachin Patil is currently working as a Linux System Administrator in Indian Institute of Technology, Bombay. Apart from System Administration, he has also gained some experience in Android and embedded systems. He, along with Srikant Patnaik, has ported Scilab — a software for Numerical Computation on ‘Aakash’, a low cost access device project funded by NMEICT, Govt. of India. He is also interested in customising GNU/linux distributions. Beside Ubuntu, his other favourite GNU/linux distro is Slackware, which he likes to work on because of its simplicity and robustness. About the Authors

CSI Communications | July 2013 | 31