Вы находитесь на странице: 1из 4

GNU/Linux Shell Access Through a Web-Browser for an

Embedded Linux E-Learning System

Suchakrapani Datt Sharma, D.N Sonawane, Tanushri Chakravorty, Tushar Patil


e-mail: suchakra@gmail.com, dns.instru@coep.ac.in, tanushri.c@gmail.com, tusharjpatil@hotmail.com
Department of Instrumentation & Control Engineering,
College of Engineering, Pune- 411 005
Maharashtra, India

Abstract—The internet has grown rapidly and has a more sound knowledge and understand about embedded Linux, its
impact on the education sector than it had before. This paper architecture and the ways in which it is incorporated in
aims at describing a novel way of extending the e-Learning devices. However it should be noted that, Linux on devices
techniques used to the area of embedded Linux education. For have a varied structure but still a generic idea pertaining to
these techniques, Open Source Software (OSS) technologies most of the devices used is presented. Fig. 1 describes how
[viz. AJAX, PHP, Apache] have been used in an innovative the embedded Linux operating system is arranged on a
way to impart embedded Linux education just by use of Single Board Computer (SBC). There are three specific and
normal web-browsers which make the learning system as easy distinguishable components in a generic embedded Linux
as checking a mail. In this paper, ways of enabling the
system [2] as can be seen from Fig. 1.
embedded device’s Linux shell access through a web-browser
is explained, which is a key feature of the system. The novelty
in the idea lies in its scalability and accessibility for multiple
users.

Keywords - e-learning; embedded systems; embedded Linux;


AJAX; web technologies;

I. INTRODUCTION
The advent of the internet and e-Learning era has given
birth to newer ways of imparting education. As embedded
Linux has become the buzz word in embedded devices
industry, the training has also moved on from specialization
courses to getting included in main curriculum of many
institutes globally. The main hurdle in embedded Linux
training is that expertise in this field is not easily available. Figure 1. Generic embedded Linux structure on a SBC flash memory
This can be overcome through web-based systems through
which students/developers can get access to these devices in The typical arrangement of the bootloader, the kernel
real-time. Reference [1] defines E-learning as having three (along with the device drivers) and the root file system image
fundamental criteria: an E-learning system is networked, on the Flash memory can be seen.
which makes it capable of instant updating, storage/retrieval,
distribution and sharing of instruction or information; It is 1) Bootloader: The primary responsibilty of the
delivered to the end-user via a computer using standard bootloader in such a system is to get the processor
Internet technology; It focuses on the broadest view of initialized. Usually the kernel in an embedded system is
learning solutions that go beyond the traditional paradigms stored on a different location in flash memory (or may be
of training. The same strategy has been applied to embedded fetched from a remote address on the network) At power-up,
Linux training while using Open Source Software (OSS) the CPU starts execution at a specific adderess. A part of the
technologies such as AJAX, PHP, Apache web-server and
memory is mapped to this address and the bootloader
some small Open Source utilities such as
Ajaxterm/PHPTerm. resides at this address. So when the bootloader starts, it
performs some low level initializations by taking control of
II. KEY CONCEPTS the hardware from power on and then copys the kernel
(from flash or a network location) or a user defined program
A. Embedded Linux Architecture from the flash to the ram and starts its execution [2][3].
Before we dive any further deep into understanding the
work done and its impact on education, we should gather
___________________________________
978-1-4244 -8679-3/11/$26.00 ©2011 IEEE

335
2) Linux Kernel: The Linux kernel is the core of a full Now, for an education oriented scenario, we are much
fledged running operating system. It acts like an abstraction interested in having a development setup in which the kernel
between the real hardware and the user-space applications. and the filesystem can be fetched globally through the
In embedded devices, the significance of the Linux kernel internet. This of course is a trivial task as explained in [4]
lies mostly due to the fact that there are too many resources and can be achieved easily as seen clearly in Fig. 3 by the
available in the processors and the SBCs available today and use of tools like Secure Shell (ssh) to access the shell of a
have to be managed well. There is, therefore, no other way remote server connected to the embedded Linux target.
in which this can be achieved in an elegant and cost-
HOST
effective manner than to have a Linux kernel on our device.
The other major factor for using this kernel is of course the
Open Source nature and the portability to numerous
architectures including the leading one, ARM.
3) Root File System : A file system is a way of
representing a hierarchical collection of directories, where
each directory can contain either more directories or files.
This hierarchy is a tree structure in which the files are
always leaf nodes and directories are internal nodes when
they contain something and leaf nodes otherwise. As the top
node in a tree structure is the root node in Linux, so file
system mounted at the top node is aptly called the root file Figure 3. Accessing embedded Linux on a remote host through SSH
system. It contains all the required libraries and the user-
applications arranged in a heirarchial manner. The root file The remote workstation in this setup connects to the host
system can also either be located on the ROM/flash memory and the TFTP/NFS server through the ssh [6] utility and
mostly as a YAFFS2, JFFS2 or a CRAMFS type filesystem provides the host shell to user. The user then is able to
or can be fetched over a network as a Network File System access the board shell by the use of an OSS tool for serial
(NFS) port communication such as minicom [7]. Although, such
an implementation of a development environment through
B. Embedded Linux Development Setup the web has been tested and used during collaborative
In case the kernel and the filesystem are to be fetched development of devices running Linux, it has yet to be
remotely using Trivial File Transfer Protocol (TFTP) and extended in e-learning scenarios.
NFS method, the development environment resembles The above methodology is fine and works well, but has
something like the one in Fig. 2. The bootloader on some shortcomings when the learning/teaching factor is
embedded device fetches the kernel and the filesystem from involved. Some of these are listed below
the host (or another machine) by ethernet using TFTP and • It becomes difficult if the remote workstation is
NFS respectively and loads it to the target’s RAM. In case, changed (as in accessing the remote host trough an
the kernel and filesystem are present on the target’s flash internet café or a different machine on another
memory itself, then the network connection is not necessary network) as it involves reinstalling the client
during boot. Once the system has booted up, the Linux shell software to access the machine.
on embedded device is accessed using the direct serial link • The E-learning strategy as defined in the second
and serial port communication applications point of [1] i.e. “It is delivered to the end-user via a
computer using standard Internet technology” is not
fulfilled in such scenarios as it requires a client
DEVELOPMENT
HOST
software to be installed on the workstation. A setup
which is self sufficient viz. a machine with just a
standard internet browser is much desired.
• The learning material (manuals, online tutorials,
audio-video presentations) are better if integrated
with the actual experimentation rather than being
provided through separate websites and/or private
circulation.
III. SHELL ACCESS THROUGH A WEB BROWSER
The challenge arising next is to enable the remote
development host’s shell to be viewed directly through the
web-browser. There are two small Open Source utilities
Figure 2. Embedded Linux development environment setup
which make this task easier.

336
A. PHPTerm IV. LINUX SHELL ON SBC THROUGH A WEB BROWSER
This small utility was written almost completely as a The majority of the core work in design of the learning
PHP script to have a shell access through a web-browser. system is over once you have the shell of the remote host
When the script is run on the remote host through a web running in the web browser, however the idea has to be
browser, it provides an interface to the user which resembles extended in a presentable manner to access the Linux shell
the XTerm shell emulator in some way. The user can enter on the embedded target through the browser and integrate it
shell commands in it, which according to the specified together to create a learning system. For making such a
permissions in the PHP file, get executed. There is minimal system we have written a few scripts and made two major
security in such an implementation along with other modifications.
limitations that after each query, the script can only display The web page meant to act as the virtual experimentation
something on the screen and can’t wait for user inputs. It page (aptly named COEP vLab Terminal) is served using the
renders this approach to access a shell in the web browser Apache web-server and has two sections which individually
useless in situations where some remote program debugging present two web based terminals on the page:
is performed with tools like gdb and kgdb (kernel debugger) 1) Host Shell : The first terminal in the page executes
or simply some text has to be written using vi command line /bin/login during the page load and provides a command
editor. line based login in the web browser (Fig. 5) The user logins
B. Ajaxterm from here into the server system using the ‘student’
Ajaxterm is a web based terminal. This utility is a more credentials provided to him. The system, which is already
elegant way of having shell access through a web browser configured as an embedded Linux development host for
[8]. It was totally inspired and works almost exactly like specific SBCs (cross-compilers, patched kernels and
Anyterm. As can be seen from Fig. 4, Ajaxterm consists of debugging utilities have been pre-configured) can then be
some Javascript on a web page, an XmlHttpRequest channel used to cross-compile or debug the target using remote
on standard ports back to the server implemented using workstation.
Sarrisa library, an HTTP proxy such as Apache's
mod_proxy and the Anyterm daemon. The daemon uses a
pseudo-terminal to communicate with a shell or other
application, and includes terminal emulation. Key presses
are picked up by the Javscript and saved as session state.
The current state and previous state is checked and the
keystrokes are polled too (the polling time increases
exponentially if the screen difference is not present). The
script sends them to the daemon; changes to the emulated
screen are sent from the daemon to the Javascript which
updates its display using innerHTML on client side [9].

Figure 5. Host and the Board shell accessed in a web browser

2) Board Shell and Multile User Access : The second


terminal on the page provides the shell interface of the
embedded Linux on the Olimex SAM9L9260 SBC that we
Figure 4. Working of Ajaxterm
have used [10]. This is made possible by accessing
On a broadband connection, the performance is /usr/bin/minicom on the remote host and displaying it on the
satisfactory with soft real-time response. The security is also web based terminal when the page loads. However, as
enhanced as SSL can be used to secure the connection. minicom accesses the serial device ttys0 on the host and
Based on these observations and advantages of this only a single user should access it at a time, so a special
approach the system is then modified to make it a complete script is written which manages the simultaneous users
embedded Linux shell access system. trying to access the SBC. The script keeps track of the user
token by using a small custom made scheduler
‘ping_minicom’ written in C to manage multiple users. So

337
when more than one user tries to access minicom, it
searches for an already currently running minicom process
and if found, puts the user in a queue according to the token
value. See Fig. 6 for reference.

SBC access request

Execute ping.sh script. Get ‘token’ value

$token = 0?

Grant SBC shell


Store access
‘token’
value to Figure 7. User queue on the board shell
‘var’
V. CONCLUSION
Print “You are number $var in queue”
In this paper a novel approach to an E-learning system
for embedded Linux was discussed in-depth, starting from
idea of imparting the training to providing a complete web
Read $token again
based online platform in which embedded Linux running on
an actual hardware, the SAM9-L9260 SBC was accessed
remotely using just a web browser for performing
Figure 6. Flowchart for the queuing script
experimentation and learning. The proposed scheme
however, has a limitation that it depends entirely on the
Also, the value of token is decremented once another user
browser being used at the client side.
releases the control of the board (Fig. 7). When the number
reaches zero, control of the board is granted to the user. REFERENCES
Therefore, now the user has the host as well as the target’s [1] Marc J.Rosenberg, E-Iearing-strategies for delivering knowledge in
shell right in the web browser from where he can cross- the digital age, Columbus, USA: McGraw-Hill, 2001.
compile on the host, then transfer and debug applications on [2] Gene Sally, Pro Linux Embedded Systems: Apress, 2010, pp.11-12
the target SBC right from his web browser. [3] Christopher Hallinan, Embedded Linux Primer: A Practical, Real-
World Approach: Prentice-Hall, 2006
[4] Ian McLoughlin, Anton Aendenroomer, “Linux as a Teaching Aid for
Embedded Systems” , Proc. International Conference on Parallel and
Distributed Systems, IEEE Press, Dec. 2007, pp. 1-5, doi:
10.1109/ICPADS.2007.4447797.
[5] Chun-yue Bi, Yun-peng Liu, Ren-fang Wang, “Research of Key
Technologies for Embedded Linux Based on ARM”, Proc. 2010
International Confrence on Computer Application and System
Modeling (ICCASM 2010), IEEE Press, Oct. 2010, pp. V8-373-V8-
378, doi: 10.1109/ICCASM.2010.5620611.
[6] Open SSH – Linux man page : http://linux.die.net/man/1/ssh
[7] Minicom – Linux man page : http://linux.die.net/man/1/minicom
[8] Ajaxterm - http://antony.lesuisse.org/software/ajaxterm/
[9] Anyterm - http://anyterm.org/index.html
[10] SAM9-L9260 Board - http://www.olimex.com/dev/sam9-L9260.html
[11] B Kjell, “The rise of embedded processing and the opportunity for
open standards”, Technology and Society Magazine, IEEE, vol. 23,
Issue 2, Summer 2004, pp 4, doi: 10.1109/MTAS.2004.1304352

338

Вам также может понравиться