Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing Bootargs via Chosen node in Device Tree not working for Beaglebone Black

As per my understanding chosen node is used to send boot arguments to the kernel. The following is the chosen node of the existing device code (am335x-bone-common.dtsi).

chosen {
  stdout-path = &uart0;
  };

So, I have modified chosen node to pass kernel arguments.

chosen {
        bootargs = "console=ttyO0,115200 root=/dev/mmcblk0p2 rootfstype=ext3 rw rootwait";
        stdout-path = &uart0;
    };

While bringing up the board I encountered KERNEL PANIC, Here is the log {https://pastebin.com/XHyrsmfG}

FYI: These are the u-boot commands issued on serial console(minicom) inorder to port kernel and devicetree using SDcard.

fatload mmc 0:1 0x81000000 zImage
fatload mmc 0:1 0x82000000 am335x-boneblack.dtb
bootz 0x81000000 - 0x82000000 
like image 376
E V Ravi Avatar asked Feb 15 '18 07:02

E V Ravi


People also ask

How do I enable device tree overlay?

All you have to do is load the main Device Tree Binary for a board (DTB), and then load and apply Device Tree Overlay Binaries (DTBO).

How are the command line arguments passed to Linux kernel by the U Boot bootloader )?

You can pass the u-boot parameters by command "setenv bootargs <your argumets>" from u-boot terminal. After boot the kernel you can read it by "cat /proc/cmdline". The official images for i. MX6/7 support device tree and bootargs in default for all new kernels.

What is a device overlay?

A device tree overlay (DTO) enables a central device tree blob (DTB) to be overlaid on the device tree. A bootloader using DTO can maintain the system-on-chip (SoC) DT and dynamically overlay a device-specific DT, adding nodes to the tree and making changes to properties in the existing tree.

What are Bootargs?

From The iPhone Wiki. These are boot arguments that the iOS kernel accepts. These can be booted with a patched iBoot; untethered BootROM jailbreaks such as redsn0w and checkra1n do this when you set custom boot-args.


1 Answers

As per my understanding chosen node is used to send boot arguments to the kernel.

Your understanding is incomplete.
As already mentioned in another answer, the kernel command line provided by the bootloader (i.e. U-Boot) is the actual list of parameters currently used when you boot the board.

For ARM Linux the default kernel configuration gives precedence to the bootloader's command line over the default kernel command string and the bootargs in the chosen node in the Device Tree.
The rationale according to U-Boot author/maintainer Wolfgang Denk seems to be that any hardcoded, built-in bootargs are inferior to bootargs that can be easily customized and supplied by a bootloader. This is exactly what you are seeing.

There are actually three possible ARM kernel boot configuration choices:

Kernel command line type:
  (X) Use bootloader kernel arguments if available  
  ( ) Extend bootloader kernel arguments
  ( ) Always use the default kernel command string

If you want to always ignore the command line in U-Boot's bootargs variable (and the command line from the DT), but exclusively use the default kernel command string as defined in CONFIG_CMDLINE, then the kernel should be configured for the third choice (CONFIG_CMDLINE_FORCE) on that list.
Note that this list of choices is only available when CONFIG_ATAGS is enabled ("Support for the traditional ATAGS boot data passing").

The scheme that selects the DT bootargs is to use the existing kernel configuration, but simply delete that U-Boot environment variable (i.e. setenv bootargs).
If you change U-Boot's bootargs variable to an empty string as mentioned in another answer, the kernel will use its default kernel command string (CONFIG_CMDLINE) rather than the DT.

Also see How to set Linux kernel command line on ARM?

like image 158
sawdust Avatar answered Oct 26 '22 23:10

sawdust