Re: User/kernelspace stuff to set/get kernel variables

Yann E. MORIN (yann.morin.1998@anciens.enib.fr)
Thu, 13 Dec 2001 17:11:12 +0100


Hi DK.

> Basically: is it possible to - one way or another - set variables at
> kernel boot and read those using userspace utilities?
> for instance: i boot my kernel (using any old bootmanager that
> accepts kernel params)
> LILO: linux network=dhcp
> and later, in the init scripts, i check the value of this variable
> using some sort of userspace program, and if it happends to be
> 'dhcp' i'll invoke the dhcp client.
[--8<--SNIP--8<--]

You'll at least find that in /proc/1/environ

It's a null-terminated list of strings that consist of what you want.
You'll see it as well while dumping the kernel log (dmesg) at the
begining. For my machine, I have:

--8<--
Kernel command line: auto BOOT_IMAGE=linux root=806 devfs=mount idebus=33
--8<--

Regards,
Yann.

--
.---------------------------.----------------------.------------------.
|       Yann E. MORIN       |  Real-Time Embedded  | ASCII RIBBON /"\ |
| phone (+33/0) 299 055 231 |  Software  Designer  |   CAMPAIGN   \ / |
|   fax (+33/0) 299 055 221 °----------------------:   AGAINST     X  |
| yann.morin@atosorigin.com    www.atosorigin.com  |  HTML MAIL   / \ |
°--------------------------------------------------°------------------°

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/