Set bootargs in a PetaLinux 2019.1 Build



This post shows how PetaLinux Tools 2019.1 lays out device tree files and how to edit bootargs.



Assumptions

You've installed PetaLinux Tools 2019.1 and you've built xilinx-zcu102-v2019.1-final.bsp in ~/plxprjs/xilinx-zcu102-2019.1



From a PetaLinux build directory:


cd ~/plxprjs/xilinx-zcu102-2019.1

cat ./components/plnx_workspace/device-tree/device-tree/system-top.dts


/*

* CAUTION: This file is automatically generated by Xilinx.

* Version:

* Today is: Thu Nov 26 07:38:12 2020

*/



/dts-v1/;

#include "zynqmp.dtsi"

/* ./components/plnx_workspace/device-tree/device-tree/zynqmp.dtsi */

#include "zynqmp-clk-ccf.dtsi"

/* ./components/plnx_workspace/device-tree/device-tree/zynqmp-clk-ccf.dtsi */

#include "zcu102-rev1.0.dtsi"

/* ./components/plnx_workspace/device-tree/device-tree/zcu102-rev1.0.dtsi */

#include "pl.dtsi"

/* ./components/plnx_workspace/device-tree/device-tree/pl.dtsi */

#include "pcw.dtsi"

/* ./components/plnx_workspace/device-tree/device-tree/pcw.dtsi */

/ {

chosen {

bootargs = "earlycon clk_ignore_unused";

stdout-path = "serial0:115200n8";

};

aliases {

ethernet0 = &gem3;

i2c0 = &i2c0;

i2c1 = &i2c1;

serial0 = &uart0;

serial1 = &uart1;

spi0 = &qspi;

};

memory {

device_type = "memory";

reg = <0x0 0x0 0x0 0x7ff00000>, <0x00000008 0x00000000 0x0 0x80000000>;

};

};

#include "system-user.dtsi"

/* ./project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi */



Find 'chosen':


Note: Output slightly cleaned up. Some output omitted for clarity.


find . -name "*.dtsi" -type f -not -path "./build*" -print0 | xargs --null grep chosen -A5

./components/plnx_workspace/device-tree/device-tree/system-conf.dtsi:

chosen {

bootargs = "earlycon console=ttyPS0,115200 clk_ignore_unused";

stdout-path = "serial0:115200n8";

};


./components/plnx_workspace/device-tree/device-tree/zcu102-rev1.0.dtsi:

chosen {

xlnx,eeprom = &eeprom;

};



From a booted build:


ls /proc/device-tree/chosen/

bootargs name stdout-path xlnx,eeprom

cat /proc/device-tree/chosen/bootargs

earlycon console=ttyPS0,115200 clk_ignore_unused



Set cpuidle.off=1 in bootargs


Note: add the lines in light blue


cd ~/plxprjs/xilinx-zcu102-2019.1


vi ./project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi

# Add

/include/ "system-conf.dtsi":

/include/ "system-user-1.dtsi"


vi ./project-spec/meta-user/recipes-bsp/device-tree/device-tree.bbappend

# Add

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"


SRC_URI += "file://system-user.dtsi"

SRC_URI += "file://system-user-1.dtsi"


vi ./project-spec/meta-user/recipes-bsp/device-tree/files/system-user-1.dtsi

/{

chosen {

bootargs = "earlycon console=ttyPS0,115200 clk_ignore_unused cpuidle.off=1";

};

};



Rebuild


cd ~/plxprjs/xilinx-zcu102-2019.1

source ~/petalinux/2019.1/settings.sh

petalinux-build -c device-tree


You should see something like:

[INFO] building device-tree
[INFO] sourcing bitbake
[INFO] generating user layers
INFO: bitbake virtual/dtb
Loading cache: 100% |#################################################################################################################################| Time: 0:00:01
Loaded 3811 entries from dependency cache.
Parsing recipes: 100% |###############################################################################################################################| Time: 0:00:04
Parsing of 2777 .bb files complete (2775 cached, 2 parsed). 3812 targets, 148 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |############################################################################################################################| Time: 0:00:03
Checking sstate mirror object availability: 100% |####################################################################################################| Time: 0:00:05
Sstate summary: Wanted 137 Found 12 Missed 250 Current 732 (8% match, 85% complete)
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Tasks Summary: Attempted 2640 tasks of which 2584 didn't need to be rerun and all succeeded.
INFO: Copying Images from deploy to images
NOTE: Failed to copy built images to tftp dir:  /tftpboot
[INFO] successfully built device-tree


Check the Logs


cd ~/plxprjs/xilinx-zcu102-2019.1

cat /home/demo/plxprjs/xilinx-zcu102-2019.1/build/tmp/work/zcu102_zynqmp-xilinx-linux/device-tree/xilinx+gitAUTOINC+73e546e312-r0/temp/log.do_compile



See all of the Steps


cat /home/demo/plxprjs/xilinx-zcu102-2019.1/build/tmp/work/zcu102_zynqmp-xilinx-linux/device-tree/xilinx+gitAUTOINC+73e546e312-r0/temp/log.task_order


You'll see something like:

do_fetch (46942): log.do_fetch.46942
do_prepare_recipe_sysroot (47383): log.do_prepare_recipe_sysroot.47383
do_unpack (47451): log.do_unpack.47451
do_patch (47853): log.do_patch.47853
do_populate_lic (47972): log.do_populate_lic.47972
do_create_yaml (48015): log.do_create_yaml.48015
do_configure (48939): log.do_configure.48939
do_compile (81498): log.do_compile.81498
do_install (81833): log.do_install.81833
do_populate_sysroot (83025): log.do_populate_sysroot.83025
do_deploy (83032): log.do_deploy.83032
do_package (83034): log.do_package.83034
do_packagedata (83538): log.do_packagedata.83538
do_package_qa (83800): log.do_package_qa.83800
do_package_write_rpm (83805): log.do_package_write_rpm.83805
do_rm_work (84422): log.do_rm_work.84422
do_fetch (21286): log.do_fetch.21286
do_prepare_recipe_sysroot (21318): log.do_prepare_recipe_sysroot.21318
do_unpack (21319): log.do_unpack.21319
do_patch (21475): log.do_patch.21475
do_create_yaml (21539): log.do_create_yaml.21539
do_populate_lic (21542): log.do_populate_lic.21542
do_configure (21549): log.do_configure.21549
do_compile (41970): log.do_compile.41970
do_install (42040): log.do_install.42040
do_deploy (42270): log.do_deploy.42270
do_populate_sysroot (42271): log.do_populate_sysroot.42271
do_package (42272): log.do_package.42272
do_packagedata (42575): log.do_packagedata.42575
do_package_write_rpm (42747): log.do_package_write_rpm.42747
do_package_qa (42740): log.do_package_qa.42740
do_rm_work (92142): log.do_rm_work.92142
do_package_write_rpm_setscene (103135): log.do_package_write_rpm_setscene.103135
do_fetch (116503): log.do_fetch.116503
do_prepare_recipe_sysroot (116518): log.do_prepare_recipe_sysroot.116518
do_unpack (116519): log.do_unpack.116519
do_patch (116586): log.do_patch.116586
do_create_yaml (116628): log.do_create_yaml.116628
do_populate_lic (116641): log.do_populate_lic.116641
do_configure (116642): log.do_configure.116642
do_compile (116791): log.do_compile.116791
do_fetch (117582): log.do_fetch.117582
do_prepare_recipe_sysroot (117594): log.do_prepare_recipe_sysroot.117594
do_unpack (117595): log.do_unpack.117595
do_patch (117644): log.do_patch.117644
do_create_yaml (117649): log.do_create_yaml.117649
do_populate_lic (117651): log.do_populate_lic.117651
do_configure (117652): log.do_configure.117652
do_compile (117789): log.do_compile.117789
do_fetch (118577): log.do_fetch.118577
do_unpack (118590): log.do_unpack.118590
do_prepare_recipe_sysroot (118589): log.do_prepare_recipe_sysroot.118589
do_patch (118639): log.do_patch.118639
do_create_yaml (118644): log.do_create_yaml.118644
do_populate_lic (118646): log.do_populate_lic.118646
do_configure (118647): log.do_configure.118647
do_compile (118785): log.do_compile.118785
do_fetch (119562): log.do_fetch.119562
do_prepare_recipe_sysroot (119574): log.do_prepare_recipe_sysroot.119574
do_unpack (119575): log.do_unpack.119575
do_patch (119624): log.do_patch.119624
do_create_yaml (119629): log.do_create_yaml.119629
do_populate_lic (119631): log.do_populate_lic.119631
do_configure (119633): log.do_configure.119633
do_compile (119763): log.do_compile.119763
do_fetch (120575): log.do_fetch.120575
do_unpack (120588): log.do_unpack.120588
do_prepare_recipe_sysroot (120587): log.do_prepare_recipe_sysroot.120587
do_patch (120637): log.do_patch.120637
do_create_yaml (120642): log.do_create_yaml.120642
do_populate_lic (120644): log.do_populate_lic.120644
do_configure (120645): log.do_configure.120645
do_compile (120785): log.do_compile.120785
do_install (120797): log.do_install.120797
do_populate_sysroot (120811): log.do_populate_sysroot.120811
do_deploy (120812): log.do_deploy.120812
do_package (120810): log.do_package.120810
do_packagedata (120948): log.do_packagedata.120948
do_package_qa (121011): log.do_package_qa.121011
do_package_write_rpm (121042): log.do_package_write_rpm.121042
do_rm_work (121417): log.do_rm_work.121417
do_fetch (11124): log.do_fetch.11124
do_prepare_recipe_sysroot (11136): log.do_prepare_recipe_sysroot.11136
do_unpack (11137): log.do_unpack.11137
do_patch (11186): log.do_patch.11186
do_create_yaml (11191): log.do_create_yaml.11191
do_populate_lic (11193): log.do_populate_lic.11193
do_configure (11194): log.do_configure.11194
do_compile (11336): log.do_compile.11336
do_install (11348): log.do_install.11348
do_deploy (11361): log.do_deploy.11361
do_populate_sysroot (11363): log.do_populate_sysroot.11363
do_package (11362): log.do_package.11362
do_packagedata (11603): log.do_packagedata.11603
do_package_qa (11822): log.do_package_qa.11822
do_package_write_rpm (11888): log.do_package_write_rpm.11888
do_rm_work (12511): log.do_rm_work.12511



Check the Result Before Booting


source ~/petalinux/2019.1/settings.sh

mkdir -p ~/plxprjs/xilinx-zcu102-2019.1/debug

cd ~/plxprjs/xilinx-zcu102-2019.1

build/tmp/sysroots-components/x86_64/dtc-native/usr/bin/dtc -I dtb -O dts images/linux/system.dtb > debug/system.dts

cat debug/system.dts | grep bootargs


You should see:

bootargs = "earlycon console=ttyPS0,115200 clk_ignore_unused cpuidle.off=1";


Boot It


petalinux-boot --qemu --kernel

# Use root for the username and root for the password

cat /proc/device-tree/chosen/bootargs


You should see:

earlycon console=ttyPS0,115200 clk_ignore_unused cpuidle.off=1


Some Device Tree Resources

  • Linux Kernel Docs: Device Tree Source Format (version 1) [link]

  • Linux Kernel Docs: Documentation/devicetree/ [link]

  • Embedded Linux Wiki: Device Tree Source Undocumented [link]

  • Embedded Linux Wiki: Device Tree Mysteries [link]

  • Embedded Linux Wiki: Device Tree Reference [link]

  • A Tutorial on the Device Tree (Zynq) -- Part II [link]

  • Rasberry Pi Device Trees, overlays, and parameters [link]



References

The Xilinx graphic is from [link]




591 views0 comments