© Warren Gay 2018
Warren GayAdvanced Raspberry Pihttps://doi.org/10.1007/978-1-4842-3948-3_17

17. Boot

Warren Gay1 
(1)
St. Catharine’s, Ontario, Canada
 

When the power is first applied to the Raspberry Pi, or it has been reset, a boot sequence is initiated. It is actually the Pi’s GPU that brings up the ARM CPU. Originally, the way that the Raspberry Pi was designed, it had to be booted from firmware found on the SD card. RISC code for the GPU is provided by the Raspberry Pi Foundation in the file bootcode.bin. After the second-stage boot loader was executed, it was possible to load other operating systems or boot loaders, such as U-Boot.

Due to public interest, changes have been introduced along the way to allow a direct boot from USB. This chapter covers the process of booting in its various configuratons.

Booting ARM Linux

The modern boot procedure consists of the following sequence of events:
  1. 1.

    At power-up (or reset), the ARM CPU is offline, but the GPU is powered up.

     
  2. 2.

    A small RISC core in the GPU begins to execute the OTP (one time programmable) ROM code (first-stage boot loader).

     
  3. 3.
    By default, it determines booting from the following priority list:
    1. a.

      SD card boot

       
    2. b.

      USB device boot

       
    3. c.

      GPIO boot mode

       
     

GPIO boot mode is described here:

https://www.raspberrypi.org/documentation/hardware/raspberrypi/bootmodes/bootflow.md

There are several warnings described there including:
  • OTP settings cannot be undone.

  • Do not try to use program_gpio_bootmode unless your firmware is dated Oct. 20, 2017 or later.

The program_gpio_bootmode is perhaps more applicable to the compute module than the regular Pi.

The boot process continues, according to the media type (SD card, USB, or GPIO):
  1. 4.

    The GPU initializes the SD card/USB/GPIO hardware.

     
  2. 5.
    The GPU looks at the FAT (file allocation table) partition(s) in the SD card or USB media. The search continues with FAT partitions until the file bootcode.bin is found. The sequence changes if the OTP settings are modified. Normally:
    1. a.

      The SD card is checked first, which takes up to 5 seconds to fail (when not present).

       
    2. b.

      Then USB mode boot will be tried when enabled by OTP (this requires at least 3 seconds to allow for drive spinup and enumeration).

       
     
  3. 6.

    The second-stage boot-loader firmware named bootcode.bin is loaded into the local 128k cache.

     
  4. 7.

    The GPU control passes to the loaded bootcode.bin firmware and it enables SDRAM.

     
  5. 8.

    The file start.elf is loaded by the GPU into RAM from the same partition and the GPU gives it control.

     
  6. 9.

    The file config.txt is examined for configuration parameters that need to be processed.

     
  7. 10.

    Information found in cmdline.txt is also processed by start.elf.

     
  8. 11.

    The GPU allows the ARM CPU to execute the program start.elf.

     
  9. 12.

    The kernel image is loaded into RAM by the GPU running start.elf.

     
  10. 13.

    Finally, the GPU starts the kernel executing on the ARM CPU.

     

Boot Files

The FAT partition containing the boot files is normally mounted as /boot when Raspbian Linux has come up. Table 17-1 lists the files that apply to the boot process. The text files can be edited to affect new configurations. The binary files can also be replaced by new revisions of the same.
Table 17-1

/boot Files

File Name

Purpose

Format

bootcode.bin

Second-stage boot loader

Binary

config.txt

Configuration parameters

Text

cmdline.txt

Command-line parameters for kernel

Text

fixup*.dat

Partitions the SDRAM between ARM CPU and GPU

Binary

start.elf

ARM CPU code to be launched

Binary

kernel.img

Kernel to be loaded

Binary

 

Name can be overridden with kernel= parameter in config.txt

 

config.txt

Unlike many PCs that contain a BIOS system, the Raspberry Pi uses the config.txt file. This file is optional, so when it is missing, defaults apply. When Raspbian Linux is booted, this file is found in /boot/config.txt.

What is supported by vcgencmd in this file can be displayed with:
# vcgencmd get_config int
aphy_params_current=819
arm_freq=1400
audio_pwm_mode=514
config_hdmi_boost=5
core_freq=250
desired_osc_freq=0x33e140
desired_osc_freq_boost=0x3c45b0
disable_commandline_tags=2
disable_l2cache=1
display_hdmi_rotate=-1
display_lcd_rotate=-1
dphy_params_current=547
enable_uart=1
force_eeprom_read=1
force_pwm_open=1
framebuffer_ignore_alpha=1
framebuffer_swap=1
gpu_freq=300
hdmi_force_cec_address=65535
init_uart_clock=0x2dc6c00
lcd_framerate=60
over_voltage_avs=31250
over_voltage_avs_boost=0x200b2
pause_burst_frames=1
program_serial_random=1
sdram_freq=450
For string options use:
# vcgencmd get_config str
device_tree=-
Additionally, there are additional options including the device tree settings:
dtparam=spi=on
and
dtoverlay=mcp23017,gpiopin=4,addr=0x20

Because the support for the original and new options keep changing, with each new model that is released, you can review this resource:

https://elinux.org/RPiconfig

Composite Aspect Ratio

The sdtv_aspect parameter configures the composite video aspect ratio.

sdtv_aspect

Description

1

4:3 (default)

2

14:9

3

16:9

Color Burst

By default, color burst is enabled. This permits the generation of color out of the composite video jack. Setting the video for monochrome may be desirable for a sharper display in some situations.

sdtv_disable_colourburst

Description

0

Color burst enabled (default)

1

Color burst disabled (monochrome)

High-Definition Video

This section covers config.txt settings that affect HDMI operation.

HDMI Safe Mode

The hdmi_safe parameter enables support of automatic HDMI configuration for optimal compatibility.

hdmi_safe

Description

0

Disabled (default)

1

Enabled

When hdmi_safe=1 (enabled), the following settings are implied:
  • hdmi_force_hotplug=1

  • config_hdmi_boost=4

  • hdmi_group=1

  • hdmi_mode=1

  • disable_overscan=0

HDMI Force Hot-Plug

This configuration setting allows you to force a hot-plug signal for the HDMI display, whether the display is connected or not. The NOOBS distribution enables this setting by default.

hdmi_force_hotplug

Description

0

Disabled (non-NOOBS default)

1

Use HDMI mode even when no HDMI monitor is detected (NOOBS default)

HDMI Ignore Hot-Plug

Enabling the hdmi_ignore_hotplug setting causes it to appear to the system that no HDMI display is attached, even if there is. This can help force composite video output, while the HDMI display is plugged in.

hdmi_ignore_hotplug

Description

0

Disabled (default)

1

Use composite video even if an HDMI display is detected

HDMI Drive

This mode allows you to choose between DVI (no sound) and HDMI mode (with sound, when supported).

hdmi_drive

Description

1

Normal DVI mode (no sound)

2

Normal HDMI mode (sound will be sent if supported and enabled)

HDMI Ignore EDID

Enabling this option causes the EDID information from the display to be ignored. Normally, this information is helpful and is used.

hdmi_ignore_edid

Description

Unspecified

Read EDID information

0xa5000080

Ignore EDID information

HDMI EDID File

When hdmi_edid_file is enabled, the EDID information is taken from the file named edid.txt. Otherwise, it is taken from the display, when available.

hdmi_edid_file

Description

0

Read EDID data from device (default)

1

Read EDID data from edid.txt file

HDMI Force EDID Audio

Enabling this option forces the support of all audio formats even if the display does not support them. This permits pass-through of DTS/AC3 when reported as unsupported.

hdmi_force_edid_audio

Description

0

Use EDID-provided values (default)

1

Pretend all audio formats are supported

Avoid EDID Fuzzy Match

Avoid fuzzy matching of modes described in the EDID.

avoid_edid_fuzzy_match

Description

0

Use fuzzy matching (default)

1

Avoid fuzzy matching

HDMI Group

The hdmi_group option defines the HDMI type.

hdmi_group

Description

0

Use the preferred group reported by the EDID (default)

1

CEA

2

DMT

HDMI Mode

This option defines the screen resolution to use in CEA or DMT format (see the parameter hdmi_group in the preceding subsection “HDMI Group”). In Table 17-2, the modifiers shown have the following meanings:
  • H means 16:9 variant of a normally 4:3 mode.

  • 2x means pixel doubled (higher clock rate).

  • 4x means pixel quadrupled (higher clock rate).

  • R means reduced blanking (fewer bytes are used for blanking within the data stream, resulting in lower clock rates).

Table 17-2

HDMI Mode Settings

Group

CEA

DMT

Mode

Resolution

Refresh

Modifiers

Resolution

Refresh

Notes

1

VGA

  

640×350

85 Hz

 

2

480 p

60 Hz

 

640×400

85 Hz

 

3

480 p

60 Hz

H

720×400

85 Hz

 

4

720 p

60 Hz

 

640×480

60 Hz

 

5

1080 i

60 Hz

 

640×480

72 Hz

 

6

480 i

60 Hz

 

640×480

75 Hz

 

7

480 i

60 Hz

H

640×480

85 Hz

 

8

240 p

60 Hz

 

800×600

56 Hz

 

9

240 p

60 Hz

H

800×600

60 Hz

 

10

480 i

60 Hz

4x

800×600

72 Hz

 

11

480 i

60 Hz

4x H

800×600

75 Hz

 

12

240 p

60 Hz

4x

800×600

85 Hz

 

13

240 p

60 Hz

4x H

800×600

120 Hz

 

14

480 p

60 Hz

2x

848×480

60 Hz

 

15

480 p

60 Hz

2x H

1024×768

43 Hz

Don’t use

16

1080 p

60 Hz

 

1024×768

60 Hz

 

17

576 p

50 Hz

 

1024×768

70 Hz

 

18

576 p

50 Hz

H

1024×768

75 Hz

 

19

720 p

50 Hz

 

1024×768

85 Hz

 

20

1080 i

50 Hz

 

1024×768

120 Hz

 

21

576 i

50 Hz

 

1152×864

75 Hz

 

22

576 i

50 Hz

H

1280×768

 

R

23

288 p

50 Hz

 

1280×768

60 Hz

 

24

288 p

50 Hz

H

1280×768

75 Hz

 

25

576 i

50 Hz

4x

1280×768

85 Hz

 

26

576 i

50 Hz

4x H

1280×768

120 Hz

R

27

288 p

50 Hz

4x

1280×800

 

R

28

288 p

50 Hz

4x H

1280×800

60 Hz

 

29

576 p

50 Hz

2x

1280×800

75 Hz

 

30

576 p

50 Hz

2x H

1280×800

85 Hz

 

31

1080 p

50 Hz

 

1280×800

120 Hz

R

32

1080 p

24 Hz

 

1280×960

60 Hz

 

33

1080 p

25 Hz

 

1280×960

85 Hz

 

34

1080 p

30 Hz

 

1280×960

120 Hz

R

35

480 p

60 Hz

4x

1280×1024

60 Hz

 

36

480 p

60 Hz

4x H

1280×1024

75 Hz

 

37

576 p

50 Hz

4x

1280×1024

85 Hz

 

38

576 p

50 Hz

4x H

1280×1024

120 Hz

R

39

1080 i

50 Hz

R

1360×768

60 Hz

 

40

1080 i

100 Hz

 

1360×768

120 Hz

R

41

720 p

100 Hz

 

1400×1050

 

R

42

576 p

100 Hz

 

1400×1050

60 Hz

 

43

576 p

100 Hz

H

1400×1050

75 Hz

 

44

576 i

100 Hz

 

1400×1050

85 Hz

 

45

576 i

100 Hz

H

1400×1050

120 Hz

R

46

1080 i

120 Hz

 

1440×900

 

R

47

720 p

120 Hz

 

1440×900

60 Hz

 

48

480 p

120 Hz

 

1440×900

75 Hz

 

49

480 p

120 Hz

H

1440×900

85 Hz

 

50

480 i

120 Hz

 

1440×900

120 Hz

R

51

480 i

120 Hz

H

1600×1200

60 Hz

 

52

576 p

200 Hz

 

1600×1200

65 Hz

 

53

576 p

200 Hz

H

1600×1200

70 Hz

 

54

576 i

200 Hz

 

1600×1200

75 Hz

 

55

576 i

200 Hz

H

1600×1200

85 Hz

 

56

480 p

240 Hz

 

1600×1200

120 Hz

R

57

480 p

240 Hz

H

1680×1050

 

R

58

480 i

240 Hz

 

1680×1050

60 Hz

 

59

480 i

240 Hz

H

1680×1050

75 Hz

 

60

   

1680×1050

85 Hz

 

61

   

1680×1050

120 Hz

R

62

   

1792×1344

60 Hz

 

63

   

1792×1344

75 Hz

 

64

   

1792×1344

120 Hz

R

65

 

 

1856×1392

60 Hz

 

66

   

1856×1392

75 Hz

 

67

   

1856×1392

120 Hz

R

68

   

1920×1200

 

R

69

   

1920×1200

60 Hz

 

70

   

1920×1200

75 Hz

 

71

   

1920×1200

85 Hz

 

72

   

1920×1200

120 Hz

R

73

   

1920×1440

60 Hz

 

74

   

1920×1440

75 Hz

 

75

   

1920×1440

120 Hz

R

76

  

2560×1600

 

R

77

   

2560×1600

60 Hz

 

78

   

2560×1600

75 Hz

 

79

   

2560×1600

85 Hz

 

80

   

2560×1600

120 Hz

R

81

   

1366×768

60 Hz

 

82

1080 p

60 Hz

    

83

  

1600×900

 

R

84

   

2048×1152

 

R

85

720 p

60 Hz

    

86

   

1366×768

 

R

HDMI Boost

The config_hdmi_boost parameter allows you to tweak the HDMI signal strength.

config_hdmi_boost

Description

0

Non-NOOBS default

1

 

2

 

3

 

4

Use if you have interference issues (NOOBS default setting)

5

 

6

 

7

Maximum strength

HDMI Ignore CEC Init

When this option is enabled, the CEC initialization is not sent to the device. This avoids bringing the TV out of standby and channel switch when rebooting.

hdmi_ignore_cec_init

Description

0

Normal (default)

1

Don’t send initial active source message

HDMI Ignore CEC

When this option is enabled, the assumption made is that CEC is not supported at all by the HDMI device, even if the device does have support. As a result, no CEC functions will be supported.

hdmi_ignore_cec

Description

0

Normal (default)

1

Disable CEC support

Overscan Video

A few options control the overscan support of the composite video output. When overscan is enabled, a certain number of pixels are skipped at the sides of the screen as configured.

Disable Overscan

The disable_overscan option can disable the overscan feature. It is enabled by default:

disable_overscan

Description

0

Overscan enabled (default)

1

Overscan disabled

Overscan Left, Right, Top, and Bottom

These parameters control the number of pixels to skip at the left, right, top, and bottom of the screen.

Parameter

Pixels to Skip

overscan_left=0

At left

overscan_right=0

At right

overscan_top=0

At top

overscan_bottom=0

At bottom

Frame Buffer Settings

The Linux frame buffer support is configured by a few configuration options described in this section.

Frame Buffer Width

The default is to define the width of the frame buffer as the display’s width minus the overscan pixels.

framebuffer_width

Description

default

Display width overscan

framebuffer_width=n

Set width to n pixels

Frame Buffer Height

The default is to define the height of the frame buffer as the display’s height minus the overscan pixels.

framebuffer_height

Description

default

Display height overscan

framebuffer_height=n

Set height to n pixels

Frame Buffer Depth

This parameter defines the number of bits per pixel.

framebuffer_depth

Description

8

Valid, but default RGB palette makes an unreadable screen

16

Default

24

Looks better but has corruption issues as of 6/15/2012

32

No corruption, but requires framebuffer_ignore_alpha=1, and shows wrong colors as of 6/15/2012

Frame Buffer Ignore Alpha

The alpha channel can be disabled with this option. As of this writing, this option must be used when using a frame buffer depth of 32 bits.

framebuffer_ignore_alpha

Description

0

Alpha channel enabled (default)

1

Alpha channel disabled

General Video Options

The display can be flipped or rotated in different ways, according to the display_rotate option . You should be able to do both a flip and a rotate by adding the flip values to the rotate value.

The 90° and 270° rotations require additional memory on the GPU, so these options won’t work with a 16 MB GPU split.

display_rotate

Description

0

0° (default)

1

90°

2

180°

3

270°

0x1000

Horizontal flip

0x2000

Vertical flip

While the flip options are documented, I was unable to get them to work. The rotations, however, were confirmed as working.

Licensed Codecs

The following options permit you to configure the purchased license key codes for the codecs they affect.

Option

Notes

decode_MPG2=0x12345678

License key for hardware MPEG-2 decoding

decode_WVC1=0x12345678

License key for hardware VC-1 decoding

Testing

The following test option enables image/sound tests during boot. This is intended for manufacturer testing.

test_mode

Description

0

Disable test mode (default)

1

Enable test mode

Memory

This section summarizes configuration settings pertaining to memory.

Disable GPU L2 Cache

The disable_l2cache option allows the ARM CPU access to the GPU L2 cache to be disabled. This needs the corresponding L2 disabled in the kernel.

disable_l2cache

Description

0

Enable GPU L2 cache access

1

Disable GPU L2 cache access

Boot Options

Several options in this section affect the boot process. Many options pertain to the kernel being started, while others affect file systems and devices.

Command Line

The cmdline option allows you to configure the kernel command-line parameters within the config.txt file, instead of the cmdline.txt file.

cmdline

Description

unspecified

Command line is taken from cmdline.txt

cmdline=“command”

Command line is taken from parameter

Kernel

By default, start.elf loads the kernel from the file named kernel.img or kernel7.img depending on the Raspberry Pi model. This can be overridden to specify a specific image.

Kernel Address

This parameter determines the memory address where the kernel image is loaded into.

kernel_address

Description

0x00000000

Default

RAM File System File

The ramfsfile parameter names the file for the RAM FS file, to be used with the kernel.

ramfsfile

Description

unspecified

No RAM FS file used

ramfsfile=“ramfs.file”

File ramfs.file is used

RAM File System Address

The ramfsaddr parameter specifies where the RAM file system image is to be loaded into memory.

ramfsaddr

Description

0x00000000

Default address

Init RAM File System

This option is a convenience option, which combines the options ramfsfile and ramfsaddr.

initramfs

Arg 1

Arg 2

Description

initramfs

initram.gz

0x00800000

Example

Device Tree Address

The device_tree_address option defines where the device tree address is loaded.

device_tree_address

Description

0x00000000

Default

Init UART Baud

The init_uart_baud option allows the user to reconfigure the serial console to use a baud rate that is different from the default.

init_uart_baud

Description

115200

Default baud rate

Init UART Clock

The init_uart_clock parameter permits the user to reconfigure the UART to use a different clock rate.

init_uart_clock

Description

3000000

Default

Init EMMC Clock

The init_emmc_clock parameter allows the user to tweak the EMMC clock, which can improve the SD card performance.

init_emmc_clock

Description

100000000

Default

Boot Delay

The boot_delay and boot_delay_ms options allow the user to reconfigure the delay used by start.elf prior to loading the kernel. The actual delay time used is computed from the following:
$$ D=1000\times b+m $$
where
  • D is the computed delay in milliseconds.

  • b is the boot_delay value.

  • m is the boot_delay_ms value.

boot_delay (b)

Description

1

Default

The boot_delay_ms augments the boot_delay parameter.

boot_delay_ms (m)

Description

0

Default

Avoid Safe Mode

A jumper or switch can be placed between pins P1-05 (GPIO 1) and P1-06 (ground) to cause start.elf to initiate a safe mode boot. If GPIO 1 is being used for some other I/O function, the safe mode check should be disabled.

avoid_safe_mode

Description

0

Default (check P1-05 for safe mode)

1

Disable safe mode check

cmdline.txt

The cmdline.txt file is used to supply command-line arguments to the kernel. The Raspbian values supplied in the standard image are broken into multiple lines here for easier reading (this sample was for the Raspberry Pi 3 B+):
# cat cmdline.txt
dwc_otg.lpm_enable=0 \
console=tty1 \
console=serial0,115200 \
root=PARTUUID=2383b4bd-02 \
rootfstype=ext4 \
elevator=deadline \
fsck.repair=yes \
rootwait \
quiet \
splash \
plymouth.ignore-serial-consoles

This file is provided as a convenience, since the parameters can be configured in the config.txt file, using the cmdline="text" option. When the config.txt option is provided, it supersedes the cmdline.txt file.

Once the Raspbian Linux kernel comes up, you can review the command-line options used as follows (this is the same Raspberry Pi 3 B+):
$ cat /proc/cmdline
8250.nr_uarts=1 \
bcm2708_fb.fbwidth=1680 \
bcm2708_fb.fbheight=1050 \
bcm2708_fb.fbswap=1 \
vc_mem.mem_base=0x3ec00000 \
vc_mem.mem_size=0x40000000 \
dwc_otg.lpm_enable=0 \
console=tty1 \
console=ttyS0,115200 \
root=PARTUUID=2383b4bd-02 \
rootfstype=ext4 \
elevator=deadline \
fsck.repair=yes \
rootwait \
quiet \
splash \
plymouth.ignore-serial-consoles

This output is interesting because it shows details that are not present in the cmdline.txt file. Options of the format name.option=values are specific to kernel-loadable modules.

Serial console=

The Linux console parameter specifies to Linux what device to use for a console. In this example, it was:
console=ttyS0,115200

This references the serial device that is made available after boot-up as /dev/ttyS0. The parameter following the device name is the baud rate.

The general form of the serial console option is as follows:
console=ttyDevice,bbbbpnf
The second parameter is the options field:

Zone

Description

Value

Raspbian Notes

bbbb

Baud rate

115200

Can be more than four digits

p

Parity

n

No parity

  

o

Odd parity

  

e

Even parity

n

Number of bits

7

7 data bits

  

8

8 data bits

f

Flow control

r

RTS

  

omitted

No RTS

Virtual console=

Linux supports a virtual console, which is also configurable from the console= parameter. Raspbian Linux specifies the following:
console=tty1
This device is available from /dev/tty1, after the kernel boots up. The tty parameters used for this virtual console can be listed (edited here for readability):
$ sudo −i
# stty −a </dev/tty1
speed 38400 baud ; rows 26; columns 82; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; \
eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>;
start = ^Q; stop = ^S ; susp = ^Z; rprnt = ^R; werase = ^W; \
lnext = ^V; flush = ^O; min = 1; time = 0;
−parenb −parodd cs8 hupcl −cstopb cread −clocal −crtscts
−ignbrk brkint −ignpar −parmrk −inpck −istrip −inlcr \
−igncr icrnl ixon −ixoff −iuclc −ixany imaxbel iutf8
opost −o lcuc −ocrnl onlcr −onocr −onlret −ofill −ofdel \
nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok −echonl −noflsh \
−xcase −tostop −echoprt −echoctl echoke
#

root=

The Linux kernel needs to know what device holds the root file system. The standard Raspbian image supplies the following:
root=PARTUUID=2383b4bd-02
This information can be obtained by the blkid command:
# blkid
/dev/mmcblk0p1: LABEL="boot" UUID="A75B-DC79" TYPE="vfat" PARTUUID="2383b4bd-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="485ec5bf-9c78-45a6-9314-32be1d0dea38" \
                TYPE="ext4" PARTUUID="2383b4bd-02"
/dev/mmcblk0: PTUUID="2383b4bd" PTTYPE="dos"

Reviewing that output confirms that the partition named "rootfs" is being used as the root file system. The partition in this example is specified by the partition UUID (a shortened version of a UUID, which is a universally unique identifier).

The general form of the root= parameter supports the following forms:
  • root=MMmm: Boot from major device MM, minor mm (hexadecimal).

  • root=/dev/nfs: Boot a NFS disk specified by nfsroot (see also nfs-root= and ip=).

  • root=/dev/name: Boot from a device named /dev/name.

  • root=PARTUUID=: Boot from a locally unique partition identified by as shortened UUID.

rootfstype=

In addition to specifying the device holding the root file system, the Linux kernel sometimes needs to know the file system type. This is configured through the rootfstype parameter. The standard Raspbian image supplies the following:
rootfstype=ext4

This example indicates that the root file system is the ext4 type.

The Linux kernel can examine the device given in the root parameter to determine the file system type. But there are scenarios where the kernel cannot resolve the type or gets confused. Otherwise, you may need to force a certain file system type.

elevator=

This option selects the I/O scheduler scheme to be used within the kernel. The standard Raspbian image specifies the following:
elevator=deadline
To find out the I/O scheduler option being used and the other available choices (in your kernel), we can consult the /sys pseudo file system:
$ cat /sys/block/mmcblk0/queue/scheduler
noop [deadline] cfq
$
The name mmcblk0 is the name of the device that your root file system is on (review the example blkid output earlier). The output shows in square brackets that the deadline I/O scheduler is being used. The other choices are noop and cfq. These I/O schedulers are as follows:

Name

Description

Notes

noop

No special ordering of requests

 

cfq

Completely fair scheduler

Older

deadline

Cyclic scheduler, but requests have deadlines

Newest

The deadline I/O scheduler is the newest implementation, designed for greater efficiency and fairness. The deadline scheduler uses a cyclic elevator, except that it additionally logs a deadline for the request. A cyclic elevator is one where the requests are ordered according to sector numbers and head movement (forward and backward). The deadline scheduler will use the cyclic elevator behavior, but if it looks like the request is about to expire, it is given immediate priority.

rootwait=

This option is used when the device used for the root file system is a device that is started asynchronously with other kernel boot functions. This is usually needed for USB and MMC devices, which may take extra time to initialize. The rootwait option forces the kernel to wait until the root device becomes ready.

Given that the root file system is on the SD card (a MMC device), the Raspbian image uses the following:
rootwait

nfsroot=

The nfsroot option permits you to define a kernel that boots from an NFS mount (assuming that NFS support is compiled into the kernel). The square brackets show placement of optional values:
nfsroot=[server−ip:]root−dir[,nfs−options]

Field

Description

server-ip

NFS server IP number (default uses ip=)

root-dir

Root dir on NFS server. If there is a %s present, the IP address will be inserted there.

nfs-options

NFS options like ro, separated by commas

When unspecified, the default of /tftpboot/client_ip_address will be used. This requires that root=/dev/nfs be specified and optionally ip= may be added.

To test whether you have NFS support in your kernel, you can query the /proc file system when the system has booted:
# cat /proc/filesystems
nodev  sysfs
nodev  rootfs
nodev  ramfs
nodev  bdev
nodev  proc
nodev  cpuset
nodev  cgroup
nodev  cgroup2
nodev  tmpfs
nodev  devtmpfs
nodev  configfs
nodev  debugfs
nodev  tracefs
nodev  sockfs
nodev  pipefs
nodev  rpc_pipefs
nodev  devpts
       ext3
       ext2
       ext4
       vfat
       msdos
nodev  nfs
nodev  nfs4
nodev  autofs
       f2fs
nodev  mqueue
       fuseblk
nodev  fuse
nodev  fusectl

From this example, we see that both the older NFS (nfs) and the newer NFS4 file systems are supported.

ip=

This option permits the user to configure the IP address of a network device, or to specify how the IP number is assigned. See also the root= and nfsroot= options.
ip=client−ip:server−ip:gw−ip:netmask:hostname:device:autoconf
Table 17-3 describes the fields within this option. The autoconf value can appear by itself, without the intervening colons if required. When ip=off or ip=none is given, no autoconfiguration takes place. The autoconfiguration protocols are listed in Table 17-4.
Table 17-3

ip= Kernel Parameter

Field

Description

Default

ip-client

IP address of the client

Autoconfigured

ip-server

IP address of NFS server, required only for NFS root

Autoconfigured

gw-ip

IP address of server if on a separate subnet

Autoconfigured

netmask

Netmask for local IP address

Autoconfigured

hostname

Hostname to provide to DHCP

Client IP address

device

Name of interface to use

When more than one is available, autoconf

autoconf

Autoconfiguration method

Any

Table 17-4

Autoconfiguration Protocols

Protocol

Description

off or none

Don’t autoconfigure

on or any

Use any protocol available (default)

dhcp

Use DHCP

bootp

Use BOOTP

rarp

Use RARP

both

Use BOOTP or RARP but not DHCP

With the kernel exchanged and the configuration restored to safe options, it should now be possible to boot the emergency kernel. Log in and rescue.

To restore your system back to its normal state, you’ll need to follow these steps:
  1. 1.

    Rename kernel.img to kernel_emergency.img (for future rescues).

     
  2. 2.

    Rename kernel.bak to kernel.img (reinstate your normal kernel).

     
  3. 3.

    Restore/alter your config.txt configuration, if necessary.

     
  4. 4.

    Restore/alter your cmdline.txt configuration, if necessary.

     

At this point, you can reboot with your original kernel and configuration.