LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices



Reply
 
Search this Thread
Old 09-23-2012, 03:14 AM   #1
elico
Member
 
Registered: Dec 2011
Posts: 115

Rep: Reputation: Disabled
BOOT TIME - LINUXSHELL vs BOOTLOADER


Hi all

At boot time of the linux based target
how is it determined which executable will run ?

If I understood there are 2 methods
BOOTLOADER and linux shell .

Can you explain which to chose and how linux shell
is written ?

Thanks
Elico
 
Old 09-23-2012, 04:26 AM   #2
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 16

Rep: Reputation: 233Reputation: 233Reputation: 233
Hmm.. I'm not sure what specifically it is that you want to know, but you could refer to these pages:

http://www.ibm.com/developerworks/li...y/l-linuxboot/
http://en.wikipedia.org/wiki/Linux_startup_process
http://en.wikipedia.org/wiki/Init

And according to one of those pages
Quote:
In a desktop Linux system, the first application started is commonly /sbin/init. But it need not be. Rarely do embedded systems require the extensive initialization provided by init (as configured through /etc/inittab). In many cases, you can invoke a simple shell script that starts the necessary embedded applications.
 
Old 09-23-2012, 04:32 AM   #3
elico
Member
 
Registered: Dec 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
Thnks
Great links.

" invoke a simple shell script that starts the necessary embedded applications "

How this shell is written , where in the on board linux file system
it is loaded ?

Elico
 
Old 09-23-2012, 05:42 AM   #4
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 16

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by elico View Post
How this shell is written , where in the on board linux file system
it is loaded ?
Executed from a file? e.g. /bin/sh or /bin/bash

Or do you mean a real embedded system? I haven't seen one yet but I bet they depend on busybox. Just a guess.
 
Old 09-23-2012, 08:05 AM   #5
elico
Member
 
Registered: Dec 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
I am talking about a LINUX based embedded cared like HAWKBOARF for example.

In that case how the init shell is written ?

What file extenssion ?

Where in the file system is loaded ?

Thanks
Elico
 
Old 09-23-2012, 08:39 AM   #6
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 16

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by elico View Post
I am talking about a LINUX based embedded cared like HAWKBOARF for example.

In that case how the init shell is written ?

What file extenssion ?

Where in the file system is loaded ?

Thanks
Elico
Same as files in a normal desktop system probably. /bin/bash has no extension of course. What I mean here is that busybox is a single static binary file that's included in the system's filesystem in an image, or as a cpio package which is then decompressed to ramdisk, and files like /bin/sh are linked to it (busybox) by symbolic links like sh, cp, ls, etc.

Quote:
Where in the file system is loaded
Depends on how the system's working ROM does it. But Linux as I could always remember is always loaded as an image. That image could just contain the kernel or the whole system already which also includes the filesystem. Where that image is placed, either in a firmware or somewhere, that I can't really tell. ~Try to examine small live CDs, and you might get more idea about it.~ Linux is first loaded in a ramdisk, from an image somewhere then everything starts from there.

Btw, I guess you're not really using Linux right now are you?
 
Old 09-23-2012, 04:45 PM   #7
elico
Member
 
Registered: Dec 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
NO I do not
I want to clarify all issues before dive into this dep waters ..

Elico
 
Old 09-23-2012, 06:29 PM   #8
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 16

Rep: Reputation: 233Reputation: 233Reputation: 233
Well sorry but I think the best way to understand it is to use it. I suggest you try setting up a low-level distro like Slackware or LFS. Being scared, too careful, or conservative about Linux won't help either.
 
Old 09-24-2012, 02:14 AM   #9
elico
Member
 
Registered: Dec 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
Thanks
Elico
 
Old 09-24-2012, 12:10 PM   #10
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
From your question that is asking to distinguish between two completely different things, I think it would be useful to explain what those things are, and what their respective roles are.
A bootloader is the fist piece of code that runs on a newly booted host (except for a BIOS, in some cases). A bootloader is capable of loading an operating system. It may be very simple in nature, such as an MS-DOS bootloader, or complex and full featured such as grub or U-boot. The fact that some bootloaders have an interactive commandline feature makes some people think that they are using a commandline shell, like bash. Such is not the case, however, and in fact when a bootloader runs, there is no underlying OS (because of course, it is the bootloader's job to load the OS).
A shell is a userspace application that runs by the graces of the underlying OS. In Linux, bash is the most common of these. A shell requires an OS to support it's functionality. Indeed, a shell is a way of exposing much of the OS kernel's functionality to the user.
At boot-time, typically three different and distinct bits of code run. In order, the bootloader starts the process of booting, followed by the kernel which is loaded by the bootloader. The bootloader invokes the kernel by loading it into memory, and making a jump to the kernel entry point. The bootloader may set up a RAM-based filesystem for initial use by the kernel. The kernel then pokes around at some hardware and generally configures itself, and prepares to invoke the first userspace process. This first userspace process is called the init process. The name of said process may be hardwired into the kernel, or may be provided to the kernel by the bootloader. It is commonly a dedicated program that reads /etc/inittab, and uses the instruction found there to initialize the rest of the system (including mounting fileystems). It can be any program accessible by the kernel, and having sufficient resources to function on its own (usually meaning it is statically linked). Sometimes, the init process is simply a shell, or shell script. Always, the init process has PID=1, and is therefore the parent of all subsequent processes.

My recommendation for exploring these elements is to set up a virtual machine to load a small simple SO such a TinyCore Linux. Then, you can explore and modify the init system (which I find to be quite elegant and simple), and learn the fundamentals. Doing so will teach you fundamentals that can be applied to both larger, more complex, traditional desktop/server systems, as well as scaled-down embedded systems.

-- rod.
 
Old 09-24-2012, 12:55 PM   #11
elico
Member
 
Registered: Dec 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
Many thanks
Elico
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bootloader time Bller Slackware 9 08-22-2009 08:59 AM
Bootloader Time Limit KissDaFeetOfSean Linux - Newbie 3 06-16-2005 12:54 AM
How to tell GRUB to boot an other bootloader TTL_2 Linux - Newbie 2 06-04-2005 12:32 AM
If the bootloader doesn't work this time I'll lose my mind Mr. Hill *BSD 4 03-12-2005 08:57 PM
First time installation bootloader problems odogg Linux - Newbie 1 11-25-2003 01:48 PM


All times are GMT -5. The time now is 08:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration