Re: config procfs patch

Alexander Kjeldaas (astor@lucifer.guardian.no)
Tue, 27 May 1997 13:14:31 +0200 (MET DST)


On Fri, 23 May 1997, Alan Cox wrote:

> Oh for the benefit of people not on the list for long enough someone
> suggests wasting 20K of kernel memory on this, someone else suggests
> compressing it and we drop the idea about every 4 months. Last time
> someone suggested the far more sensible idea of linking the config file
> into the final zImage as an extra ELF segment, thus taking no RAM, but
> nobody did it.
>
> So save the discussion and just do the ELF thing
>

There is a difference between doing the ELF thing and putting it in the
kernel. When it's in the kernel image, we need the kernel image! If we
don't have the kernel image, having it in the kernel is a nice substitute.
I think we should do the ELF thing anyway, but as an option, it should be
possible to include it in the kernel.

On my system (2.0.30) linux/.config is 5102 bytes - much less than 20k.

Now - for the sake of memory we can simplify it somewhat:
grep -vE '^$|^#' <linux/.config | sed -e 's/^CONFIG_//' -e 's/=//'
= 769 bytes
or even .. | sort | gzip -9
= 392 bytes
or .. | sort | <replace repeated prefix-words with '_'>
= 640 bytes
or .. | sort | <replace repeated prefix-words with '_'> | tr -d '\012'
= 572 bytes

With these simplifications, the following is a perfectly sane kernel
configuration [toy kernel, but hopefully sane..]. This is just meant as an
example. It requires that in an expression CONFIG_XX=yy, XX doesn't end
with a number or yy doesn't start with one, and that yy consists of
anything but upper case letters and underscores. Additionally, no
consecutive underscores are allowed in XX and XX must not start with an
underscore (these restrictions can be removed easily).

BINFMT_AOUTy_ELFy_JAVAmBLK_DEV_FDy__LOOPm__MDy__RAMy__SDy__SRyCHR_DEV_SGy__STy
DEC_ELCPyDUMMYmEXPERIMENTALyEXT2_FSyFAT_FSyFIREWALLyINETyIP_ACCTy_ALIASy
_FIREWALLy__VERBOSEy_FORWARDy_MASQUERADEy_MULTICASTy_NOSRy_TRANSPARENT_PROXYy
ISDNy_AUDIOy_DRV_TELESm_MPPy_PPPy__VJyISO9660_FSyKERNEL_ELFyM686yMD_LINEARm
_STRIPEDmMINIX_FSyMODULESyMODVERSIONSyMSDOS_FSyNETyNETDEVICESyNETLINKy
NET_ALIASy_EISAy_ETHERNETy_IPIPmNFS_FSyPCIy_OPTIMIZEyPPPmPROC_FSyRST_COOKIESy
RTNETLINKySCSIy_AIC7XXXy_BUSLOGICy_CONSTANTSySERIALySKB_LARGEySOFT_WATCHDOGy
SYN_COOKIESySYSVIPCyVFAT_FSyWATCHDOGy_NOWAYOUTy

Pretty compact and I'd call it readable for the trained eye ;-). Not
really kernel bloat anymore.

[ as a side note - in the kernel configuration above it's easy to spot
some inconsistent naming - MODVERSIONS instead of MODULES_VERSIONS,
SOFT_WATCHDOG instead of WATCHDOG_SOFT ].

astor