Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

triple-dash on linux kernel command line switches

I'm trying to add a switch to send linux kernel log to the serial console on XenServer6.

The kernel command options can be edited on the EXTLinux config file ( /boot/extlinux.conf ).

Here is an excerpt:

serial 1 115200
default xe
prompt 1
timeout 50

label xe
  # XenServer
  kernel mboot.c32
  append /boot/xen.gz mem=1024G dom0_max_vcpus=4 dom0_mem=752M lowmem_emergency_pool=1M crashkernel=64M@32M console= vga=mode-0x0311 --- /boot/vmlinuz-2.6-xen root=LABEL=root-tfnnfzfp ro xencons=hvc com2=115200,8n1 console=com2 console=hvc0 console=tty0 quiet vga=785 splash --- /boot/initrd-2.6-xen.img

label xe-serial
  # XenServer (Serial)
  kernel mboot.c32
  append /boot/xen.gz com1=115200,8n1 console=com1,vga mem=1024G dom0_max_vcpus=4 dom0_mem=752M lowmem_emergency_pool=1M crashkernel=64M@32M --- /boot/vmlinuz-2.6-xen root=LABEL=root-tfnnfzfp ro console=tty0 xencons=hvc console=hvc0 --- /boot/initrd-2.6-xen.img

What is the meaning of the triple dashes ( --- )on the command line?

Is it loading 3 boot files?

like image 705
Ovesh Avatar asked Jul 19 '12 02:07

Ovesh


People also ask

How do I change kernel boot parameters?

Reboot your system and hold the Shift key as its first booting up, and you will be brough into the GRUB boot menu. Highlight the kernel you want to edit (probably the first selection in the menu) and press e on your keyboard to temporarily edit the boot parameters.

How do I change the kernel parameters in Linux Arch?

Kernel parameters can be set either temporarily by editing the boot entry in the boot loader's boot selection menu, or permanently by modifying the boot loader's configuration file. The following examples add the quiet and splash parameters to Syslinux, systemd-boot, GRUB, GRUB Legacy, LILO, and rEFInd.

What is the command to view all the kernel parameters?

The sysctl command allows you to view and change Linux kernel parameters.


1 Answers

TL;DR Yes, it is. ExtLinux must load both Xen and the Linux kernel. It uses mboot.c32 to do this. --- separates the Xen image path and its command line from the Linux image path and its command line.

This is just the way that ExtLinux (indeed, all boot loaders in the SysLinux family) implement multiboot, which is necessary to load Xen.

Most simple boot configurations will load just a kernel. There's a way that the boot loader writes the command line where you would expect it. In Syslinux style:

label Simple
    kernel linux.c32
    append <linux kernel filename> <linux command line>

Or in Grub:

title Simple Boot
    root (hd0,0)
    kernel <linux kernel filename> <linux command line>

More complex boot configurations might load boot Xen and the kernel. These use a system called "multiboot", which loads both and gives them each their own command line. That allows you to pass Xen its commands and Linux its commands. You can even pass in another stage to load something else, like an initial ramdisk. In SysLinux style:

label Complex
    kernel mboot.32
    append <xen kernel filename> <xen command line> --- <linux kernel filename> <kernel command line> --- <initrd filename>

Or in Grub:

label Complex Boot
kernel <xen kernel filename> <xen command line>
module <linux kernel filename> <linux command line>
module <initrd filename>

If you were using grub, it actually specifies these in their own stanzas. Grub acts as sort of a super-bootloader in that it can have tons of little modules loaded into it for functionality such as multiboot (or different filesystems, etc). In that case, Grub does most of it magically without you knowing.

Syslinux and family divide labor differently. Rather than having one giant boot loader that must handle all situations, they have two layers that have many different pieces. On the top, they have the core boot loader that knows the system its booting (i.e. syslinux knows BIOS booting with files on FAT filesystem, pxelinux knows loading things over then network, isolinux knows loading files from a CD-ROM, etc.). Extlinux is just the one that knows how to boot off of an Ext2, Ext3, Ext4, or BTRFS filesystem.

Other common functionality is implemented as "comboot" modules, which can plug into any of the boot loaders. For example:

  • multiboot (mboot.c32)
  • directly loading a Linux kernel (linux.c32)
  • menu support (menu.c32)
  • Lua Interpreter (lua.c32)
  • hardware detection tool (hdt.c32)
  • alternate boot based on CPU flags (ifcpu.c32)

In the case of multiboot, they load the mboot.c32 module, which implements multiboot. Unlike Grub and family (which know about the multiple command lines), syslinux must include all of the modules and their commandlines in a single commandline. Since -- is often used as an argument separator in other programs, they chose to use --- to delimit the modules.

In this case, Xen requires multiboot, which is requiring that syntax to separate the command lines for the Xen Hypervisor Kernel and the Linux Kernel that runs as its initial privileged guest.

like image 141
Jayson Avatar answered Oct 08 '22 03:10

Jayson