Modifying kernel command line parameters

How do I modify the parameter list passed to the kernel command line when booting from an SD card?

I thought simply updating /boot/grub/grub.cfg with the modifications would work, but the output of /proc/cmdline does not change before and after the grub.cfg update.

So that makes me think that /boot/grub/grub.cfg isn’t being used during bootup. Is there another place where the kernel command line parameters are specified? Perhaps in an already-compiled image?

Below is some possibly relevant output from the bootup process. Note in particular the EFI stub error, and the lack of EFI parameters from FDT.

UEFI firmware (version PreAlpha built at 10:50:05 on Nov 28 2015) EFI stub: Booting Linux Kernel... Failed to open file: initrd.img EFI stub: ERROR: Failed initrd from command line! [ 0.000000] Initializing cgroup subsys cpuset [ 0.000000] Initializing cgroup subsys cpu [ 0.000000] Initializing cgroup subsys cpuacct [ 0.000000] Linux version 3.18.0-linaro-hikey (m@cris-t540p) (gcc version 5.3.1 20160113 (Linaro GCC 5.3-2016.02) ) #1 SMP PREEMPT Tue Jul 5 13:48:24 EDT 2016 [ 0.000000] CPU: AArch64 Processor [410fd033] revision 3 [ 0.000000] Detected VIPT I-cache on CPU0 [ 0.000000] Early serial console at I/O port 0x0 (options '') [ 0.000000] bootconsole [uart0] enabled [ 0.000000] efi: Getting EFI parameters from FDT: [ 0.000000] EFI v2.40 by Linaro HiKey EFI Nov 28 2015 10:50:07 [ 0.000000] efi: [ 0.000000] cma: Reserved 128 MiB at 0x0000000071800000 [ 0.000000] psci: probing for conduit method from DT. [ 0.000000] psci: PSCIv1.0 detected in firmware. [ 0.000000] psci: Using standard PSCI v0.2 function IDs [ 0.000000] PERCPU: Embedded 14 pages/cpu @ffffffc07f70f000 s18496 r8192 d30656 u57344 [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 508430 [ 0.000000] Kernel command line: dtb=hi6220-hikey.dtb console=ttyAMA3,115200 earlycon=pl011,0xf7113000 root=/dev/mmcblk1p2 rw rootwait initrd=initrd.img efi=noruntime

For reference, here is the contents of my /boot:

linaro@linaro-alip:~$ ls /boot
Image System.map-3.18.0-linaro-hikey efi hi6220-hikey.dtb initrd.img-3.18.0-linaro-hikey
Image-3.18.0-linaro-hikey config-3.18.0-linaro-hikey grub initrd.img

I can see /boot/initrd.img is there, so I’m not sure why the EFI stub fails to open it. Perhaps it is looking in a different location?

Any help is appreciated.

Thanks,
Marc

Hi Marc,

Does your grub.cfg look something like this?

[jramirez@calypso tmp]$ cat grub/grub.cfg 
set default="0"
set timeout=1

menuentry 'Debian GNU/Linux (eMMC)' {
    linux /Image console=tty0 console=ttyAMA3,115200 root=/dev/disk/by-partlabel/system rootwait ro quiet efi=noruntime
    initrd /initrd.img
    devicetree /hi6220-hikey.dtb
}

menuentry 'Debian GNU/Linux (SD card)' {
    linux /Image console=tty0 console=ttyAMA3,115200 root=/dev/mmcblk1p2 rootwait ro quiet efi=noruntime
    initrd /initrd.img
    devicetree /hi6220-hikey.dtb
}

Hi jro,

This is my grub.cfg. Note the additional kernel param I’m trying to pass (isolcpus). Looks like my grub.cfg points to /boot/* whereas the one you posted doesn’t. Hmmm

linaro@linaro-alip:~$ cat /boot/grub/grub.cfg
set default="0"
set timeout=1

menuentry 'Debian GNU/Linux (eMMC)' {
    search.fs_label rootfs root
    set root=($root)
    linux /boot/Image console=tty0 console=ttyAMA3,115200 root=/dev/disk/by-partlabel/system rootwait rw quiet efi=noruntime isolcpus=0-1
    initrd /boot/initrd.img
    devicetree /boot/hi6220-hikey.dtb
}

menuentry 'Debian GNU/Linux (SD card)' {
    search.fs_label rootfs root
    set root=($root)
    linux /boot/Image console=tty0 console=ttyAMA3,115200 root=/dev/mmcblk1p2 rootwait rw quiet efi=noruntime isolcpus=0-1
    initrd /boot/initrd.img
    devicetree /boot/hi6220-hikey.dtb
}

menuentry 'Fastboot' {
    search.fs_label boot root
    chainloader ($root)/EFI/BOOT/fastboot.efi
}

I’m facing exactly the same problem, anyone was able to figure this out ?
Is there any documentation describing how this board boot ?

I found that for Linaro Developer Debian images mount is done by /dev/disk/by-partlabel/boot which is not always true, because eMMC card can also have partition labeled boot. I changed that to correct partition with Image, dtb and initrd, but it doesn’t help. Always getting:

EFI stub: Booting Linux Kernel...
Failed to open file: initrd.img
EFI stub: ERROR: Failed initrd from command line!

And old kernel booting. Do I need any modification to edk2 ? What is boot procedure that cause this behavior ?

Unfortunately I wasn’t able to resolve this problem.

Good luck,
Marc

Hello,

I have followed the process to install aosp here using the factory image method :
\BoardRecovery for HiKey - 96Boards

As a result when I power on the board, the boot is blocked and the following line appears on the UART:

EFI stub: Booting Linux Kernel…
EFI stub: EFI_RNG_PROTOCOL unavailable, no randomness supplied
EFI stub: Using DTB from configuration table
Failed to handle fs_proto
EFI stub: ERROR: Failed initrd from command line!
EFI stub: Exiting boot services and installing virtual address

Is someone able to debug this please?
Regards

Hello,

I have followed the process to install aosp here using the factory image method :
\BoardRecovery for HiKey - 96Boards

As a result when I power on the board, the boot is blocked and the following line appears on the UART:

EFI stub: Booting Linux Kernel…
EFI stub: EFI_RNG_PROTOCOL unavailable, no randomness supplied
EFI stub: Using DTB from configuration table
Failed to handle fs_proto
EFI stub: ERROR: Failed initrd from command line!
EFI stub: Exiting boot services and installing virtual address

Is someone able to debug this please?

Do the AOSP install instructions work? I confess I haven’t run them in a
long time but looking at them I think the “Installing initial fastboot and
ptable” section of the instructions are effectively a board recovery
(but one that doesn’t install the bootloader used for Debian).

See Using Reference Boards  |  Android Open Source Project .