What Is Used To Control The Flow Of A Process ARM Linux Booting Process

You are searching about What Is Used To Control The Flow Of A Process, today we will share with you article about What Is Used To Control The Flow Of A Process was compiled and edited by our team from many sources on the internet. Hope this article on the topic What Is Used To Control The Flow Of A Process is useful to you.

ARM Linux Booting Process

This will be a series of articles explaining how the Linux kernel runs on the ARM architecture. This is the first part.

Boot process of ARM Linux:

We will explain the boot process of the AT91RM9200 system-on-chip, built around the ARM920T ARM Thumb processor. Kwickbyte makes an embedded board called the kb9202 based on the AT91RM9200. We will take this board as an example and see how Linux runs on this board.

Before reading this you must read the AT91RM9200 datasheet (specification).

You must also read the ARM Architecture Reference Manual for a better understanding of the boot process.

Components in the Linux boot process:

The Linux boot process includes the following components.


Core image

The root file system

Before we see how the above components work, here’s the Linux kernel boot process call flow for the arm architecture. This gives a big picture of the entire Linux boot process. We use U-boot bootloader.

ARM Linux Boot Process: The Big Picture


_start (cpu/arm920t/start.S)

start_code (cpu/arm920t/start.S)

start_armboot (lib_arm/board.c)

board_init (board/kb9202/kb9202.c)

timer_init (cpu/arm920t/at91/timer.c)

serial_init (drivers/serial/at91rm9200_usart.c)

main_loop (lib_arm/board.c)

U-boot is now running and is in the u-boot prompt ready to accept commands. Assume that the kernel image is loaded into RAM and the bootm command is issued.

do_bootm (common/cmd_bootm.c)

bootm_start (common/cmd_bootm.c)

bootm_load_os (common/cmd_bootm.c)

do_bootm_linux (lib_arm/bootm.c)

stext (linux/arch/arm/kernel/head.S)

Control is given to Linux.

Linux kernel:

text (bow/arm/core/head.S:78)

__lookup_processor_type (arch/arm/kernel/head-common.S:160)

__lookup_machine_type (arch/arm/kernel/head-common.S:211)

__create_page_tables (arch/arm/kernel/head.S:219)

__arm920_setting (bow/arm/mm/proc-arm920.S:389)

__enable_mmu (arch/arm/kernel/head.S:160)


__switch_data (arch/arm/kernel/head-common.S:20)

start_kernel (init/main.c:529)

start_kernel (init/main.c:529)


setup_arch (arch/arm/kernel/setup.c:666)

setup_machine (arch/arm/kernel/setup.c:369)

search_engine_type ( )

setup_command_line (init/main.c:408)

build_all_zonelists (mm/page_alloc.c:3031)

parse_args (kernel/params.c:129)

mm_init (init/main.c:516)

mem_init (arch/arm/mm/init.c:528)

kmem_cache_init (mm/slab.c, mm/slob.c, mm/slub.c)

sched_init (kernel/sched.c)

init_IRQ (arch/arm/kernel/irq.c)

initial_timers (kernel/timer.c:1713)

hrtimers_init (kernel/hrtimer.c:1741)

softirq_init (kernel/softirq.c:674)

console_init (drivers/char/tty_io.c:3084)

vfs_caches_init (fs/dcache.c:2352)

mnt_init (fs/namespace.c:2308)


init_mount_tree (fs/namespace.c:2285)

do_kern_mount (fs/namespace.c:1053)



bdev_cache_init (fs/block_dev.c:465)

chrdev_init (fs/char_dev.c:566)

signals_init (kernel/signal.c:2737)

rest_init (init/main.c:425)

kernel_thread (431, arch/arm/kernel/process.c:388)

kernel_thread() creates a kernel thread and control is given to kernel_init().

kernel_init (431, init/main.c:856)

do_basic_setup (888, init/main.c:787)

init_workqueues (789, kernel/workqueue.c:1204)

driver_init (793, drivers/base/init.c:20)

do_initcalls (796, init/main.c:769) /* Calls all subsystem init functions */

prepare namespace (906, init/do_mounts.c:366)

initrd_load (399, init/do_mounts_initrd.c:107)

rd_load_image (117, init/do_mounts_rd.c:158) /* if given initrd */

identify_ramdisk_image (179, init/do_mounts_rd.c:53)

handle_initrd (119, init/do_mounts_initrd.c:37) /*if rd_load_image is successful */

mount_block_root (45, init/do_mounts.c:233)

do_mount_root (247, init/do_mounts.:218)

mount_root (417, init/do_mounts.c:334) /* if initrd is not given */

mount_block_root (359, init/do_mounts.c:233)

do_mount_root (247, init/do_mounts.c:218)

init_post (915, init/main.c:816)

run_init_process (847, init/main.c:807)

kernel_execve (810, arch/arm/kernel/sys_arm.c:81)

User space

init() /*userspace /sbin/init */


The bootloader is a small program that will load the kernel image into RAM and boot the kernel image. This is also called bootstrap because it bootstraps the system by loading the operating system. The bootloader starts before any other software starts and initializes the processor and makes the CPU ready to run programs like the operating system. Most processors have a default address from which the first bytes of code are retrieved after power-up or board reset. Hardware designers use this information to store the bootloader code at that address in ROM or flash. Because it should initialize the CPU and should run a program located at an architecture-specific address, bootloaders are very processor- and board-specific. Each embedded board comes with a bootstrap to download a kernel image or standalone application to the board and start executing the kernel image or application. The bootloader will start when power is applied to the processor board. It will basically have some minimal features to load an image and run.

It is also possible to control the system using a hardware debugging interface such as JTAG. This interface can be used to write the system’s boot program to non-volatile boot memory (eg, flash) by instructing the processor core to perform the necessary operations to program the non-volatile memory. It is usually done the first time to download the stock bootloader and for a specific recovery procedure. JTAG is a standard and popular interface offered by many board manufacturers. Some microcontrollers provide special hardware interfaces that cannot be used to take arbitrary control of the system or run code directly, but instead allow boot code to be inserted into non-volatile boot memory (such as flash memory) via simple protocols. Then, in the production phase, such interfaces are used to inject the startup code (and possibly other code) into persistent memory. After a system reset, the microcontroller begins executing the code programmed in its non-volatile memory, just as conventional processors use ROMs to boot. In many cases, such interfaces are implemented with hardwired logic. In other cases, such interfaces can be created by software running in an on-chip boot ROM from the GPIO pins.

There are other third-party bootloaders available that provide a rich feature set and a simple user interface. You can download these third party bootloaders to the board and you can set them as default bootloaders for your board. Generally, bootloaders supplied by board vendors are replaced by these third-party bootloaders. There are quite a few third party bootloaders available and some of them are open source (or free bootloaders) and some are commercial. Some of them are Das U-Boot, Red boot, GRUB (for desktop computers), LILO, Loadlin,, bootsect-loader, SYSLINUX, EtherBoot, ELILO.

We will take U-boot boot loader as our boot loader. U-boot is a widely used boot loader in embedded systems. We will explain the code from the u-boot-2010.03 source. You can download U-boot from the following page. http://www.denx.de/wiki/U-Boot

How the U-boot is built:

Based on the U-boot configuration, all assembly files (.S) and C files (.c) are compiled using a cross-compiler built for a specific architecture and object files (.o) will be generated. All these object files are linked by a linker and an executable file will be created. An object file or executable file is a collection of sections like .text, .data, .bss etc. Object files and executable files have a file format like elf. All object file sections will be arranged into an executable file based on a script called a linker script. This script tells where all the sections should be loaded into memory when it starts. Understanding this script is very important to know how the boot loader and kernel are put together and how different parts of the boot loader or kernel are loaded into memory.

Generally, when a program is started (executed), the loader reads the executable file and loads various sections of the executable file into the specified memory location and starts executing the launch function (entry point) specified in the linker script. But, if you want to run (load) the boot loader, there won’t be any loader to load (mainly to understand the file format) the various sections of the executable into memory. You then need to use a tool called objcopy which will take all the sections from the executable and create a binary file that does not have any file format. This binary can be loaded into memory and executed, or it can be written to ROM at a specific address (architecture specific) to be executed by the CPU when power is applied to the board.

Assume that based on the U-boot configuration, all files are compiled and object files are created. The u-boot makefile uses the following (architecture-specific) linker script to build the executable.

File: cpu/arm920t/u-boot.lds

32 OUTPUT_FORMAT(“elf32-littlearm”, “elf32-littlearm”, “elf32-littlearm”)


34 INPUT(_start)



37. = 0x00000000;


39. = ALIGN(4);

40. text:


42 cpu/arm920t/start.o (.text)

43 *(.text)


4546. = ALIGN(4);

47.rodata: *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))


49. = ALIGN(4);

50.data: *(.data)


52. = ALIGN(4);

53.got: *(.got)


55. =.;

56 __u_boot_cmd_start =.;

57.u_boot_cmd: *(.u_boot_cmd)

58 __u_boot_cmd_end =.;


60. = ALIGN(4);

61 __bss_start =.;

62.bss (NOLOAD): *(.bss). = ALIGN(4);

63 _end =.;


OUTPUT_FORMAT in line #32 specify the file format of the executable file. Here the executable format is elf32 and endianness is little endian. OUTPUT_ARCH on line # 33 specify the architecture on which this code is running. ENTRY in line #34 specifies the starting function (entry point) of the u-boot program. Here the entry point is _start.

SECTIONS on line #35 defines how the various sections are mapped in the executable. The loader uses the addresses specified in this section to load different sections of the program into memory.

‘.’ on line #37 specifies the starting address where the following sections should be loaded. In this case the starting address is 0x00000000. After this in line #39 the memory is aligned by 4 bytes and section.text follows in line #40.

40. text:


42 cpu/arm920t/start.o (.text)

43 *(.text)


On ‘.’ the position (0x00000000) code in cpu/arm920t/start.o is mapped and follows the code found there in the text sections of all other object (.o) files. cpu/arm920t/start.o contains the function _start() (in assembly language) which is the entry point of this program.

Now ‘.’ it will be at 0x00000000 + sizeof (.text). Again the memory is aligned with 4 bytes and the .rodata section follows in line #47.

. = ALIGN(4);

47.rodata: *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))

.rodata sections from all object files are mapped to this address. Followed by sections.data and.git.

49. = ALIGN(4);

50.data: *(.data)


52. = ALIGN(4);

53.got: *(.got)

Each U-boot command is an object of type ‘cmd_tbl_t’ containing the name of the command, a helper string and a pointer to the function that will be executed when this command is run. All these command objects are placed in memory one after the other. Each of these command objects is built into a U-boot defined section named.u_boot_cmd in the object file. These all.u_boot_cmd sections are placed in memory after the above sections (.data and.git).

. =.;

56 __u_boot_cmd_start =.;

57.u_boot_cmd: *(.u_boot_cmd)

58 __u_boot_cmd_end =.;

__u_boot_cmd_start contains the start of command objects and __u_boot_cmd_end contains the end of command objects.

Then there are the .bss (uninitialized global variables) sections.

60. = ALIGN(4);

61 __bss_start =.;

62.bss (NOLOAD): *(.bss). = ALIGN(4);

63 _end =.;

__bss_start points to the starting address of .bss, and _end contains the end of all sections.

Using this linker script the linker will generate an executable file called u-boot. The Objcopy tool is used to generate a binary file from the u-boot executable.

u-boot.bin: u-boot


Video about What Is Used To Control The Flow Of A Process

You can see more content about What Is Used To Control The Flow Of A Process on our youtube channel: Click Here

Question about What Is Used To Control The Flow Of A Process

If you have any questions about What Is Used To Control The Flow Of A Process, please let us know, all your questions or suggestions will help us improve in the following articles!

The article What Is Used To Control The Flow Of A Process was compiled by me and my team from many sources. If you find the article What Is Used To Control The Flow Of A Process helpful to you, please support the team Like or Share!

Rate Articles What Is Used To Control The Flow Of A Process

Rate: 4-5 stars
Ratings: 7102
Views: 54344605

Search keywords What Is Used To Control The Flow Of A Process

What Is Used To Control The Flow Of A Process
way What Is Used To Control The Flow Of A Process
tutorial What Is Used To Control The Flow Of A Process
What Is Used To Control The Flow Of A Process free
#ARM #Linux #Booting #Process

Source: https://ezinearticles.com/?ARM-Linux-Booting-Process&id=4774950

Related Posts