Subject: Re: Allow config extract embedded configuration files
To: Frederick Bruckman <>
From: Andrew Brown <>
List: tech-userlevel
Date: 04/14/2003 11:33:59
>> as kernel files can contain embedded configuration files (with options
>> INCLUDE_CONFIG_FILE or INCLUDE_JUST_CONFIG), I think it could be good
>> if config(8) could automatically extract them and configure a new
>> kernel based on that information.
>> I've got a patch that does it (see below).  I feel it's not very polished
>> and several things can be improved, but I don't know which ones are they.
>> Is it there any interest in this?  Comments?
>Clearly, we need something like that. Otherwise, what's the point of
>embedding the file? I'd find it more useful if it could recover the
>original file, to update it for newer sources or to tweak it, than to
>configure with the live kernel directly, though. For what it's worth,
>this is what I've used:
>	strings /netbsd \
>        |awk '/^_CFG_/ {sub(/_CFG_/,""); gsub(/\\011/,"	"); print}'
>(the character between the second pair of double-quotes should be an
>actual tab-character.)

the options(4) man page suggests:

	strings netbsd | sed -n 's/^_CFG_//p' | unvis

since more than just the tab characters are "encoded".  eg:

	% strings /netbsd | sed -n 's/^_CFG_//p'
	#options \011CONSDEVNAME="\134"com\134"",CONADDR=0x2f8,CONSPEED=57600

note that the patch to config(8) that jmmv posted properly calls
strunvis(3) on the data.

|-----< "CODE WARRIOR" >-----|             * "ah!  i see you have the internet (Andrew Brown)                that goes *ping*!"       * "information is power -- share the wealth."