My last post was a bit tongue-in-cheek, but this one is as serious as a heart attack. In the past couple of summers I have offered suggestions on how to strip down a current kernel and run it extremely light, and this summer I see no reason to break with tradition.
This year I’m going to even further back in time though. Instead of configuring it for a mid-grade Celeron, I’m going to show you the bottom-of-the-barrel, no-frills-no-thrills Pentium setup I use daily for everything except image viewing. This kernel boots in under 20 seconds from Grub to the login prompt, discounting the five or six seconds it takes the framebuffer to snap to the proper resolution.
As always, there are some disclaimers.
- I am not an expert.
- This is not for beginners.
- I should mention that I use Crux, but that doesn’t mean these configurations won’t work in other distros. If you are interested in using Crux — which I recommend heartily for any machine, really — I will point you at the Crux Handbook to get you started.
- I can guarantee with 99.9 percent certainty that if you copy and paste this, your machine won’t even boot.
This year I’m going to catch hell for making one very large change in the way I do things: Completely disabling power management structures altogether. Yes, I know, your eyeballs just popped out of their sockets. Ready your keyboards for e-mailing me to tell me how foolish I am; I am ready in return to tell you that for this machine, it makes almost no difference whatsoever. But let’s talk about that later.
First up, under General Setup, I enable only these things:
- Support for paging of anonymous memory (swap)
- System V IPC
- BSD Process Accounting
- Kernel->user space relay support (formerly relayfs)
- Namespaces support
- UTS namespace
- IPC namespace
That’s all. I used to optimize for size when I was working with a machine with only 16Mb of memory, but I’ve moved up in the world, and now I have a spacious 80Mb.
Next is Enable loadable module support, under which I only enable Module unloading.
For Enable the block layer, I disable Support for large (2TB+) block devices and files and use only one IO Scheduler: CFQ.
Under Processor type and features, only these things are enabled:
- Single-depth WCHAN output
- Disable Bootmem code
- Machine Check / overheating reporting
- MTRR (Memory Type Range Register) support
- Enable seccomp to safely compute untrusted bytecode
Timer frequency is set to 1000Hz, and High Memory Support is off. I set the Processor family to Pentium Classic.
Now comes the part that’s going to horrify you: Power management and ACPI options. Call me crazy, but for months now I have been running kernels on two different Pentium machines that have everything — and I mean everything disabled under this category. Frequency scaling, idle PM support, everything.
And no, my house has not burned down, and yes, the hardware battery management in the Mebius still works. I have seen no signs of the apocalypse, the sky has not blackened and there is no smell of sulphur (or an electrical fire) in the air. Life goes on.
My rationale? None, I have none. I turned it off once, nothing terrible happened, and now it’s off all the time. C’est la vie.
Next, for Bus options (PCI etc.), PCI Support, ISA support and PCCard (PCMCIA/CardBus) support are enabled. Under PCMCIA cards, I have CardBus yenta-compatible bridge support turned on, and both 16- and 32-bit support enabled. I have several network cards that reach way back to the last part of the 1990s, and I want to be able to use them.
For Executable file formats / Emulations, I just leave it however it is at default. I don’t think I’ve ever tinkered with those settings, and something tells me it wouldn’t matter if I did.
Under Networking support > Networking options, I enable:
- Packet socket
- Unix domain sockets
- TCP/IP networking
But everything under TCP/IP networking is disabled. And yes, I can still reach the Internet and my home network.
Under Networking support > Wireless I enable:
- cfg80211 – wireless configuration API
- enable powersave by default
- cfg80211 wireless extensions compatibility
- Wireless extensions sysfs files
- Generic IEEE 802.11 Networking Stack (mac80211)
- Enable LED triggers
All that gives me working wireless cards for the few that I have, when I use them. Note that I turned off anything related to debugging; debugging is Linus’s job, not mine.
This is the hairy part: Device drivers. First, Connector – unified userspace <-> kernelspace linker and its children are enabled.
Next, under Plug and Play support, I enable ISA Plug and Play support.
For Block devices, I build Normal floppy disk support as a module. Loopback device support is enabled. I don’t bother with RAM block device support.
I know this is defeating the purpose in running a newer kernel, but I use the deprecated ATA/ATAPI/MFM/RLL support. The few kernels I have built with the newer Serial ATA and Parallel ATA drivers have not behaved well, and I usually end up rebooting into my old kernel rather than the newer one. It’s possible there is some sort of code change in that section that my hardware doesn’t like, but in any case I use what works (and no more than that, if I can help it
).
These things are enabled under ATA/ATAPI/MFM/RLL …
- generic ATA/ATAPI disk support
- ATA disk support
- ATAPI floppy support
- legacy /proc/ide/ support
- generic/default IDE chipset support
- CMD640 chipset bugfix/support
- Probe IDE PCI devices in the PCI bus order
- CMD64{3|6|8|9} chipset support
Some of those are hardware-specific, but others are just for peace of mind. The one thing I dislike more than anything is to go through the whole rigamarole of transplanting the drive, building the kernel, installing it, moving the drive back, and then finding out that the thing won’t boot. So it’s possible that even more of those could be safely omitted, but I just leave them on because I’m satisified with the way they are now.
Network device support is also fun. I usually have enough various and sundry network cards to warrant keeping this category flexible and open. All the same, only Wireless LAN and PCMCIA network device support are enabled. Under wireless, these are modules where possible:
- Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)
- Cache Hermes firmware on driver initialisation
- Hermes PCMCIA card support
And PCMCIA both of these are modules:
- NE2000 compatible PCMCIA support
- Xircom 16-bit PCMCIA support
That might look a little sparse, but remember two things: First, this machine has no USB ports, which means no USB support is needed.Second, the PCMCIA hardware predates CardBus technology, so a lot of “newer” PCMCIA cards don’t work in it. Other machines get support at those levels of course, just be aware of what your machine can do, as well as what you want it to do.
Moving on, here’s Input device support, where only Event interface is enabled, aside from what is fixed in place. That includes Hardware I/O ports and everything underneath it. Remember that a lot of these items are locked “on,” until you disable USB and/or HID support, later on.
Under Character devices:
- /dev/kmem virtual device support
- Unix98 PTY support
- /dev/nvram support
Everything under Serial devices is off.
I2C support is also off, but that might require you to disable some parts lower in the list before it will be released.
Graphics support can also be a real hairball. For my own part, I enable only
- VGA Arbitration
- Support for frame buffer devices
- Enable firmware EDID
- Enable Video Mode Handling Helpers
- Enable Tile Blitting Support
- VGA 16-color graphics support
- Userspace VESA VGA graphics support
- VESA VGA graphics support
- Backlight & LCD device support
- Lowlevel Backlight controls
- Generic (aka Sharp Corgi) Backlight Driver
- Bootup logo
- Standard 224-color Linux logo
That gives me a snap-to 800×600 framebuffer with a super-cool Tux logo on an ancient C&T graphics card. I would love to figure out how to turn off the backlight properly, but for now it’s just on my to-do list.
Sound card support is another tricky one. For myself, I need ISA support and I build everything as a module, because I need to pass parameters to the module in order to get it to work. So …
- Advanced Linux Sound Architecture
- Support old ALSA API
- Verbose procfs contents
- ISA sound devices
- Sound Blaster 1.0/2.0/Pro (8-bit)
Again, less complicated than it sounded. I am not sure about Old ALSA API or Verbose procfs, I suppose it’s possible to turn off those things and still work. I’ll try that sometime soon. Of course, sound on this thing is not so fantastic to start with, so I don’t stress myself with it.
And that’s all for device drivers. Everything else is turned off — USB, HID, real time clock, and so forth. And yes, everything runs fine.
We’re on the home stretch now. Here’s File systems:
- Second extended fs support
- Dnotify support
- Inotify file change notification support
- Inotify support for userspace
- Native Language Support
- Japanese charsets (Shift-JIS, EUC-JP)
I used to disable both dnotify and inotify, but these days udev wants one, and something else wants the other (I forget what it is). Also I sometimes set up the kernel to use NFS (under Network File Systems), but since 2.6.32 or something, NFS hasn’t worked quite right for me. Again, that’s something else I’ll have to test. In the mean time I turn it off, because I think the issue is related to changes since 2.6.31 or so. And I don’t need it that bad.
For Kernel hacking:
- Show timing information on printks
- Enable __must_check logic
- Magic SysRq key
- Sysctl checks
- Enable verbose x86 bootup info messages
- Early printk
That’s all. I turn off anything related to debugging, and anything that involves hardware I don’t have.
Under Security options, everything is off. Yeah, and you thought turning off power management was daring. …
I leave Cryptographic API pretty much as it is by default, except for disabling Hardware crypto devices.
And Virtualization is disabled, while Library routines is left as-is.
And we’re done. Remember to adjust this as you like, for the hardware you want and the purpose of the machine. After the break, the .config file you might want.
Continue reading ‘Configuring an ultralight 2.6.34 kernel’
Recent Comments