What are bootloaders?

When the computer is first turned on it has a clear state. Meaning there are no programs in it’s memory and it’s incapable of accessing its components (storage ,I/O devices etc)

So the first step that is required is to enable the computer to gain access to them. For this purpose as soon as the computer starts it runs a bootloader that bootstraps the startup process.

Bootloaders initialize the hardware and pass on the control to the kernel which proceeds to initialize the operating system. That’s all they do.

Since bootloaders sit between hardware and software they give booting choices to users. They can let us

  1. Choose from different operating systems

  2. Boot operating system into safe mode for recovery.

  3. Choose different versions of operating systems.

  4. Or boot directly into a program without starting the operating system first. (This is used for example in many game consoles,if you have a game disc inserted when you start the console.it can take you right into the game rather than a welcome screen)

For PCs the ROM contains BIOS (or EFI) that looks for a bootloader at a certain location and execute it [1]

As you might have guessed there are stages to a bootloader. The bootloader is read from a ROM and executed. At the end of this process I/O components and storage components are ready.

The computer has changed its state from passive just a powered in CPU, to active a device can use different parts. It can now use these components.

The last thing that remains for the first stage bootloader to do is find the second stage bootloader so that the control may be passed on to the operating system.

Now most of the times the second stage bootloader is located on a storage within a device itself. Some place in a hard disk. The first stage bootloader knows about this location and hence finds and executes the second stage loader.

From there on the OS kernel is loaded followed by os itself.

As it often happens at the time of a new purchase a hard disk,there may not actually be a boot record for the bootloader. Therefore the first stage bootloader allows the user to specify boot locations. Most modern bootloaders allow you to boot from

  1. CD/DVD

  2. USB stick

  3. Network disk

In case of storage medium like CD and USB, the devices are formatted so that the first stage bootloader can find the boot record on it.

For network booting a boot image is placed on a known location on a server. This image is downloaded and executed on the machine.

Most of the time the interaction with the bootloader is rather minimal. It’s only when you want to install a new operating system. Or want to diagnose problems with your existing ones/use a different os, is the time when you take the trouble of going to the boot menu.

But understanding the boot process is important if you want to learn how computers work.

All electronic devices are turned on in the same way. Whether it’s your mobile, your laptop, your gaming consoles or your PC. They all boot the same way.

But some devices use the concept of a boot image on a flash. In such devices that kernel and the bootloader is packed into a single file and written onto the flash. This approach is quite common in smart phones like Android and in devices like wifi routers. [2]

Packing the kernel and bootloader into a single image does not change the boot process in anyway however. A bootloader still initializes the hardware and then passes the control to the kernel which will initialize the operating system.

However packing the bootloader with the kernel makes it difficult for the user to make changes to the device the way he wants. ROMs need to be packaged in exactly the same way as the device expects it to. And running multiple OS is more difficult because now there is no separation between the kernel and the bootloader.

Switching an Android operating system for instance is not quite as straightforward as switching the os in PC. And impossible if the bootloader is locked (as it is in many phones)

Still because embedded systems have a lot less room than PCs it makes sense to pack things together.

Types of bootloader and UBOOT

Since there are many types of computer architectures and many operating systems it’s natural that the bootloaders are specific to architecture and operating systems. This means that are many, many bootloaders on the market. Often they are proprietary and incompatible with each other. However open source applications like DAS U Boot are standardizing the process.

https://en.m.wikipedia.org/wiki/Das_U-Boot

DAS U BOOT works on almost all the system architectures and provides both first stage and second stage bootloading. It can also be packed into an image consisting both the Linux kernel as well as a bootloader in a package.

References

[1]https://askubuntu.com/questions/173248/where-is-the-bootloader-stored-in-rom-ram-or-elsewhere

[2]https://android.stackexchange.com/questions/29706/can-somebody-explain-the-boot-process-of-an-android-device/29738#29738

[3] A presentation on the boot process

https://www.cs.tau.ac.il/telux/lin-club_files/linux-boot/slide0000.htm

workrockin@gmail.com

How does the internet work?

Internet is not a single technology. Instead it’s a stack. A group of technologies working together. These technologies form what is known as internet protocol suite. Which powers computer networks. Many such computer networks work together to form what we know as the global internet.

[ Please note that the explanation below is by no means an exhaustive guide just an overview that’ll quickly help you understand how different networking technologies work together.]

Let’s quickly go through the internet protocol suite (or TCP/IP stack as it’s commonly known)

It consists of 4 layers

  1. The link layer

  2. The internet layer

  3. The transport layer

  4. The application layer

The link layer provides the foundation for communication within a network. This may consist of physical wires like ethernet/fiber optics. Or wireless medium like wifi. Besides providing the physical medium it’s also responsible for giving access to the channel.

This is the layer that is responsible for implementing MAC address required to transmit information between two devices.

The internet layer is responsible for providing communication between networks. It is at this layer internet protocol is implemented. The process of moving data between networks is called routing.

  1. Each host on the network is identified by an IP address.

  2. Data packets are sent from source by passing them from one router to another until they reach their destination.

The transmission of data through the internet layer is unreliable. It provides no guarantee that the source packet will reach the destination.

[This is because it is difficult to know beforehand what path data will take as it’s routed to destination. ]

[ It may be said that the Internet protocol is stateless. All of the effort is spent in forwarding if packets. None is spent on verifying whether the individual packet was successfully delivered. And due to this property it’s able to address billions of hosts.

And this type of communication is known as connection less communication. ]

The transport layer implements the transmission control protocol (or TCP).

The actual data packets that are transmitted by the internetworking layer over the link layer are generated here. Here they are called segments. Once generated segments are forwarded to internet layer where they are assembled into a packet and stamped with IP address.

TCP layer defines the communication channel using ports. It is at these ports that applications and services are running.

Client devices can connect to these applications using the link layer as defined above. The TCP facilitates communication between the client and the application server over network ports.

TCP is a reliable and connection oriented protocol.

While the internet layer provides routing. TCP layer manages the communication process. Making sure it’s reliable, efficient and standardized.

—-

Application layer is the is the place where the services (that a client uses) are running.

Services like

  1. Domain name system

  2. Dynamic host configuration protocol

  3. Simple mail transfer protocol

  4. HTTP servers

run on application layer.

These protocols are used for process to process communication. A client device having a web browser can access the website using http protocol.

An email client like an Android app can access emails using SMTP protocol.

Data encoded by the application layer is passed on to the transport layer where it’s assembled into segments.

Application layer is the one using which we interact with the internet. It’s also the one with which most people are familiar with. We don’t need to know about any other underlying layers. As far as we’re concerned it may not even exist.

But it does.

And this illustrates the core principle of the internet stack. The abstraction of layers. A layer does not need to concern itself with how the other layers perform or work. It only has to make sure that it’s protocol is fulfilled.

——-

That is the gist of how the network works. If you want more specific details into the protocols involved please check out this Wikipedia index

https://en.m.wikipedia.org/wiki/Outline_of_the_Internet

[It’s important to note that the internet is more than just the web. There are many other services running on it that are defined by their own protocols.]

[ Finally TCP/IP and OSI are conceptual models to help understand how things work. In real world layers are not stacked as neatly as the model expects. But it’s much simpler nevertheless]

How it all comes together?

To best understand the internet consider a wireless router in your home connected to the internet via your service provider.

When your router is on and connected to the internet

  1. It gets an IP address by your ISP.

  2. It assigns a local IP address to each one of your connected devices using DHCP

  3. On request of client it establishes a connection with a service provider. Like a web server or an email server.

  4. It then routes the client request using the internet layer to a service provider. The web server processes the request and sends the response to the router.

  5. The router sends the response to the device that requested it using the IP address it assigned.

Application

Practically speaking the logical components TCP/IP model are coded into the operating system. Like Debian. So if you buy an appropriate hardware like PC with a network card and some Ethernet cables you can create your own data center.

There is a huge demand for local services that the internet is not able to satisfy. Applications that don’t need global internet to work. That can run offline so to speak.

These services are critical to digitization of processes. Both business and administrative. They don’t require to be available anywhere. But are context sensitive.

Wireless data centers running in colleges, and public places can fulfill this demand. Localized social networks, e-commerce, document management systems that are only needed where they are. Eg in a hospital or a court. To reduce the administrative burden. To improve the information flow.

Such portable data centers present a new opportunity to entrepreneurs, researchers and individuals to create rich and efficient local networks.

workrockin@gmail.com

References

https://en.m.wikipedia.org/wiki/Internet

https://en.m.wikipedia.org/wiki/Outline_of_the_Internet

OSI and TCP video explanation

https://youtu.be/3b_TAYtzuho

Design a site like this with WordPress.com
Get started