1.. zephyr:code-sample:: bootargs 2 :name: Bootargs 3 4 Print received bootargs to the console. 5 6Overview 7******** 8 9This sample demonstrates use of bootargs passed to Zephyr by printing each main argument to the console. 10Zephyr support both dynamic bootargs, received from supported bootloader, and static bootargs embedded in the binary. 11 12Requirements 13************ 14 15Static bootargs don't have special requirements. 16Dynamic bootargs work on platforms where Zephyr is booted by multiboot or efi. 17 18Building and Running 19******************** 20 21Static bootargs 22=============== 23 24Static bootargs can be configured using ``CONFIG_BOOTARGS_STRING``. 25 26.. zephyr-app-commands:: 27 :zephyr-app: samples/kernel/bootargs 28 :board: qemu_x86 29 :conf: prj_static_bootargs.conf 30 :goals: build run 31 :compact: 32 33Output: 34 35.. code-block:: console 36 37 *** Booting Zephyr OS build v3.7.0-514-gd4490bc739d1 *** 38 argv[0] = appname 39 argv[1] = This 40 argv[2] = is 41 argv[3] = a list of 42 argv[4] = arguments 43 44Multiboot 45========= 46 47.. zephyr-app-commands:: 48 :zephyr-app: samples/kernel/bootargs 49 :board: qemu_x86 50 :conf: prj_multiboot.conf 51 :goals: build run 52 :compact: 53 54Output: 55 56.. code-block:: console 57 58 *** Booting Zephyr OS build v3.7.0-rc2-421-g3cf718e6dabc *** 59 argv[0] = /home/user/zephyr/samples/kernel/bootargs/build/zephyr/zephyr.elf 60 61To pass your own arguments you can manually invoke qemu with ``-append "your args"``, for example: 62 63.. code-block:: console 64 65 qemu-system-x86_64 -kernel ./build/zephyr/zephyr.elf -nographic -append "This is 'a list of' arguments" 66 67Which will result in the following output: 68 69.. code-block:: console 70 71 *** Booting Zephyr OS build v3.7.0-rc2-421-g3cf718e6dabc *** 72 argv[0] = ./build/zephyr/zephyr.elf 73 argv[1] = This 74 argv[2] = is 75 argv[3] = a list of 76 argv[4] = arguments 77 78Efi 79========= 80 81.. zephyr-app-commands:: 82 :zephyr-app: samples/kernel/bootargs 83 :board: qemu_x86_64 84 :conf: prj_efi.conf 85 :goals: build run 86 :compact: 87 88Output: 89 90.. code-block:: console 91 92 *** Zephyr EFI Loader *** 93 RSDP found at 0xbf7e014 94 Zeroing 501792 bytes of memory at 0x163000 95 Copying 16384 data bytes to 0x1000 from image offset 96 Copying 405504 data bytes to 0x100000 from image offset 16384 97 Copying 30688 data bytes to 0x1dd820 from image offset 421888 98 Jumping to Entry Point: 0x1137 (48 31 c0 48 31 d2 48) 99 100 *** Booting Zephyr OS build v3.7.0-rc2-421-g3cf718e6dabc *** 101 argv[0] = run.efi 102 103To pass your own arguments you can press ESC and write your arguments after name of the Zephyr efi binary, for example: 104 105.. code-block:: console 106 107 Press ESC in 5 seconds to skip startup.nsh or any other key to continue. 108 Shell> run.efi This is 'a list of' arguments 109 *** Zephyr EFI Loader *** 110 RSDP found at 0xbf7e014 111 Zeroing 501792 bytes of memory at 0x163000 112 Copying 16384 data bytes to 0x1000 from image offset 113 Copying 405504 data bytes to 0x100000 from image offset 16384 114 Copying 30688 data bytes to 0x1dd820 from image offset 421888 115 Jumping to Entry Point: 0x1137 (48 31 c0 48 31 d2 48) 116 117 *** Booting Zephyr OS build v3.7.0-rc2-421-g3cf718e6dabc *** 118 argv[0] = run.efi 119 argv[1] = This 120 argv[2] = is 121 argv[3] = a list of 122 argv[4] = arguments 123