Cannot find kernel command line and uboot commands

I want to dig deeper into the OpenWrt boot process. I have a GL-MT3000:

root@MT3000:~# fw_printenv
Warning: Bad CRC, using default environment
bootcmd=run distro_bootcmd
bootdelay=2
baudrate=115200
loadaddr=0x0
mtdids=
mtdparts=
bootm_size=0x10000000
eth6addr=02:00:11:22:33:47
ethaddr=02:00:11:22:33:44
fdt_addr_r=0xc00000
ipaddr=192.0.2.1
kernel_addr_r=0x1000000
pxefile_addr_r=0x2000
ramdisk_addr_r=0x2000000
scriptaddr=0x1000
stderr=serial,vidconsole
stdin=serial
stdout=serial,vidconsole

Why is the bad CRC?
What is distro_bootcmd and where can I find the boot command for each board?
The /proc/cmdline is empty, does it mean the kernel command is empty? If not, where can I find it?
Does OpenWrt use initramfs like a linux distro and how does it mount the rootfs?

Well, you are accessing it from the OS and not the bootloader console. It also seems incomplete (see below).

It would be another U-Boot variable that doesn't show in your output. It would have the syntax to boot your router from the flash/TFTP/etc.

In the same location (but not sure why it's not displayed) or at the U-Boot console using the printenv command. This may differ for different bootloaders (depending on device/board). You can likely access U-Boot over serial and see the environment.

See: https://openwrt.org/docs/techref/image.format#initramfs

It's not clear what you're asking. In any case, routers are embedded devices, the OS is built to specification of the specific device. U-Boot is not like GRUB or LILO - in the sense you seem to be looking for Kernel command line parameters.

See:

See: https://openwrt.org/docs/techref/preinit_mount

2 Likes

OpenWrt kernels are almost always built with hard-coded cmdline; they ignore any command line passed from the bootloader. The overall philosophy is to not trust the bootloader to do anything other than to uncompress, load and launch the kernel image. This is because many routers have bootloaders that were only developed enough to uncompress, load, and launch the stock firmware-- extra functionality that uboot might promise is often broken.

So as long as your device boots, there is no point mucking around in the bootloader.

2 Likes

Thanks for the info, where can I find the hard coded kernel command line for each router?

This information:

In the bootloader.

Didn’t he mean the command line is configured during kernel config and will ignore the uboot kernel command line env bootargs?

Yes, I also mentioned that.

I was adding:

  • There was no such "Kernel command" on embedded devices
  • If you are seeking the uboot boot command set on devices, where to locate it in the bootloader environment

Since there is indeed a bootloader environment variable/command to boot embeded devices, it wasn't clear what you were inquiring about.