From c5aeb1791c00ce7a41c79e47658c681e676ee65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Wed, 25 Mar 2020 00:00:00 +0000 Subject: [PATCH] Fix init environment code examples Likely not updated after --kernel-cli-after-dash was added. Prompted by: https://github.com/cirosantilli/linux-kernel-module-cheat/issues/120 --- README.adoc | 13 ++++++++++--- run | 2 ++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.adoc b/README.adoc index 18d956b..b884753 100644 --- a/README.adoc +++ b/README.adoc @@ -3130,10 +3130,16 @@ ____ And you can try it out with: .... -./run --kernel-cli 'init=/lkmc/linux/init_env_poweroff.out - asdf=qwer zxcv' +./run --kernel-cli 'init=/lkmc/linux/init_env_poweroff.out' --kernel-cli-after-dash 'asdf=qwer zxcv' .... -Output: +From the <>, we see that the kernel CLI at LKMC 69f5745d3df11d5c741551009df86ea6c61a09cf now contains: + +.... +init=/lkmc/linux/init_env_poweroff.out console=ttyS0 - lkmc_home=/lkmc asdf=qwer zxcv +.... + +and the init program outputs: .... args: @@ -3144,6 +3150,7 @@ zxcv env: HOME=/ TERM=linux +lkmc_home=/lkmc asdf=qwer .... @@ -3156,7 +3163,7 @@ The annoying dash `-` gets passed as a parameter to `init`, which makes it impos Arguments with dots that come after `-` are still treated specially (of the form `subsystem.somevalue`) and disappear, from args, e.g.: .... -./run --kernel-cli 'init=/lkmc/linux/init_env_poweroff.out - /lkmc/linux/poweroff.out' +./run --kernel-cli 'init=/lkmc/linux/init_env_poweroff.out' --kernel-cli-after-dash '/lkmc/linux/poweroff.out' .... outputs: diff --git a/run b/run index cfcf974..04ed774 100755 --- a/run +++ b/run @@ -172,6 +172,7 @@ Pass an extra Linux kernel command line options, and place them before the dash separator `-`. Only options that come before the `-`, i.e. "standard" options, should be passed with this option. Example: `./run --arch arm --kernel-cli 'init=/lkmc/poweroff.out'` +See also: https://cirosantilli.com/linux-kernel-module-cheat#init-environment ''' ) self.add_argument( @@ -182,6 +183,7 @@ separator, and place the options after the dash. Intended for custom options understood by our `init` scripts, most of which are prefixed by `lkmc_`. Example: `./run --kernel-cli-after-dash 'lkmc_eval="wget google.com" lkmc_lala=y'` +See also: https://cirosantilli.com/linux-kernel-module-cheat#init-environment ''' ) self.add_argument(