Le 01/02/2017 à 08:42, Casper Ti. Vector a écrit :
> From those distros I have used, it seems that the kernel does not eat
> anything from its command line, so I think it is unnecessary to
> duplicate the `rootfs' parameter.
>
>> Once it has all the information it needs and has found its rootfs, the
>> initramfs script doesn't need environment variables anymore, so it
>> cleans up its environment. You should do the same: be as transparent as
>> possible, do not leak into /sbin/init anything it doesn't strictly need.
>> /sbin/init may have the environment variables set by the kernel, but it
>> definitely shouldn't have any variables set by your initramfs script.
> In addition, the cause for `KOPT_*' not showing up in Alpine init is
> that sh(1) does not leak manually set variables except when told to
> `export'. In contrast, rc(1) does not have the `export' builtin, and
> simply exports all variables. Anyway, you can use the following
> chainloading command to clean up the environment just before switching
> root:
For my tests, I used the following snippet as an init script:
#!/bin/execlineb -p
foreground { /usr/bin/s6-printenv }
/bin/sh
Neither execlineb nor s6-printenv touch the environment. Yet, I had
"modules" and "initrd" variables (which are in the kernel command line)
but not the "root" one.
--
Guillaume.
Received on Wed Feb 01 2017 - 09:11:12 UTC