?

Log in

lsmod to kernel options

Sometimes you want to know which kernel config options responsible for exact kernel modules (e.g. you are lazy, you took default config from distribution you use and now you want to build only modules you really use, or compile them in). I don't know a good way to accomplish that (please let me know if you do). So I wrote a bit ugly script, but it does the trick.


Script looks for all Makefiles for current kernel (so they must exist) and looks for module kernel options in them.


Script will find all options for current loaded modules (lsmod) if run with no args, or will try to find kernel options for modules specified in cmd line otherwise.


lsmodopt highlighted with GNU source-highlight 3.1




#!/bin/bash

builddir=$(readlink "/lib/modules/`uname -r`/build")
hugevar=`find "$builddir" -name Makefile -exec cat {} \; | grep '^\s*obj-$([^)]*)'`

modules="$@"
[ "X$modules" == "X" ] && modules=`lsmod | tail -n +2 | cut -d ' ' -f 1`

for mod in $modules; do
	modpath=$(modinfo -n $mod)
	file=$(basename $modpath)
	filenox=${file%.*}
	parms=$(echo "$hugevar" | sed -n "/[ =]\+$filenox\\.o/ s/ *obj-\$(\\(.*\\)).*/\\1/p")
	if [ "X$parms" == "X" ]; then
		notfound="$notfound $mod ($file)"
	else
		for parm in $parms; do
			printf "%-27s <-- %-22s - %s\n" "$parm" "$filenox.o" "($mod)"
		done
	fi
done

[ "X$notfound" == "X" ] || echo "config options not found for:$notfound" 1>&2


sample output:

$ ./lsmodopt battery fan
CONFIG_ACPI_BATTERY         <-- battery.o              - (battery)
CONFIG_ACPI_FAN             <-- fan.o                  - (fan)
$ ./lsmodopt
CONFIG_NLS_CODEPAGE_437     <-- nls_cp437.o            - (nls_cp437)
CONFIG_VFAT_FS              <-- vfat.o                 - (vfat)
CONFIG_FAT_FS               <-- fat.o                  - (fat)
CONFIG_MMC_BLOCK            <-- mmc_block.o            - (mmc_block)
CONFIG_IPV6                 <-- ipv6.o                 - (ipv6)
CONFIG_TUN                  <-- tun.o                  - (tun)
CONFIG_FUSE_FS              <-- fuse.o                 - (fuse)
CONFIG_DRM_VIA              <-- via.o                  - (via)
CONFIG_DRM                  <-- drm.o                  - (drm)
CONFIG_IP_NF_FILTER         <-- iptable_filter.o       - (iptable_filter)
CONFIG_IP_NF_IPTABLES       <-- ip_tables.o            - (ip_tables)
CONFIG_NETFILTER_XTABLES    <-- x_tables.o             - (x_tables)
CONFIG_EXT3_FS              <-- ext3.o                 - (ext3)
CONFIG_JBD                  <-- jbd.o                  - (jbd)
CONFIG_SND_HDA_INTEL        <-- snd-hda-codec-realtek.o - (snd_hda_codec_realtek)
CONFIG_SND_SEQ_DUMMY        <-- snd-seq-dummy.o        - (snd_seq_dummy)
CONFIG_SND_SEQUENCER        <-- snd-seq-oss.o          - (snd_seq_oss)
CONFIG_SND_SEQUENCER        <-- snd-seq-midi-event.o   - (snd_seq_midi_event)
CONFIG_SND_VIRMIDI          <-- snd-seq-midi-event.o   - (snd_seq_midi_event)
CONFIG_SND_RAWMIDI_SEQ      <-- snd-seq-midi-event.o   - (snd_seq_midi_event)
CONFIG_SND_OPL3_LIB_SEQ     <-- snd-seq-midi-event.o   - (snd_seq_midi_event)
CONFIG_SND_OPL4_LIB_SEQ     <-- snd-seq-midi-event.o   - (snd_seq_midi_event)
CONFIG_SND_HDA_INTEL        <-- snd-hda-intel.o        - (snd_hda_intel)
CONFIG_SND_SEQUENCER        <-- snd-seq.o              - (snd_seq)
CONFIG_SND_SEQUENCER        <-- snd-seq-device.o       - (snd_seq_device)
CONFIG_SND_HDA_INTEL        <-- snd-hda-codec.o        - (snd_hda_codec)
CONFIG_SND_PCM_OSS          <-- snd-pcm-oss.o          - (snd_pcm_oss)
CONFIG_SND_HWDEP            <-- snd-hwdep.o            - (snd_hwdep)
CONFIG_SND_MIXER_OSS        <-- snd-mixer-oss.o        - (snd_mixer_oss)
CONFIG_SND_PCM              <-- snd-pcm.o              - (snd_pcm)
CONFIG_INPUT_JOYDEV         <-- joydev.o               - (joydev)
CONFIG_SND_TIMER            <-- snd-timer.o            - (snd_timer)
CONFIG_USB_VIDEO_CLASS      <-- uvcvideo.o             - (uvcvideo)
CONFIG_SND                  <-- snd.o                  - (snd)
CONFIG_SOUND                <-- soundcore.o            - (soundcore)
CONFIG_VIDEO_DEV            <-- videodev.o             - (videodev)
CONFIG_MMC_VIA_SDMMC        <-- via-sdmmc.o            - (via_sdmmc)
CONFIG_I2C_VIAPRO           <-- i2c-viapro.o           - (i2c_viapro)
CONFIG_HOTPLUG_PCI_SHPC     <-- shpchp.o               - (shpchp)
CONFIG_VIDEO_DEV            <-- v4l1-compat.o          - (v4l1_compat)
CONFIG_ACPI_FAN             <-- fan.o                  - (fan)
CONFIG_BT_HCIBTUSB          <-- btusb.o                - (btusb)
CONFIG_VIDEO_DEV            <-- v4l2-compat-ioctl32.o  - (v4l2_compat_ioctl32)
CONFIG_BT                   <-- bluetooth.o            - (bluetooth)
CONFIG_MOUSE_PS2            <-- psmouse.o              - (psmouse)
CONFIG_RFKILL               <-- rfkill.o               - (rfkill)
CONFIG_INPUT_PCSPKR         <-- pcspkr.o               - (pcspkr)
CONFIG_ACPI_VIDEO           <-- video.o                - (video)
CONFIG_CHR_DEV_SG           <-- sg.o                   - (sg)
CONFIG_HOTPLUG_PCI          <-- pci_hotplug.o          - (pci_hotplug)
CONFIG_SERIO_RAW            <-- serio_raw.o            - (serio_raw)
CONFIG_INPUT_EVDEV          <-- evdev.o                - (evdev)
CONFIG_I2C                  <-- i2c-core.o             - (i2c_core)
CONFIG_SND_PCM              <-- snd-page-alloc.o       - (snd_page_alloc)
CONFIG_ACPI_BATTERY         <-- battery.o              - (battery)
CONFIG_ACPI_AC              <-- ac.o                   - (ac)
CONFIG_ACPI_THERMAL         <-- thermal.o              - (thermal)
CONFIG_ACPI_PROCESSOR       <-- processor.o            - (processor)
CONFIG_ACPI_WMI             <-- wmi.o                  - (wmi)
CONFIG_ACPI_BUTTON          <-- button.o               - (button)
CONFIG_LIB80211             <-- lib80211.o             - (lib80211)
CONFIG_VIDEO_OUTPUT_CONTROL <-- output.o               - (output)
CONFIG_MMC                  <-- mmc_core.o             - (mmc_core)
CONFIG_RTC_DRV_CMOS         <-- rtc-cmos.o             - (rtc_cmos)
CONFIG_RTC_CLASS            <-- rtc-core.o             - (rtc_core)
CONFIG_RTC_LIB              <-- rtc-lib.o              - (rtc_lib)
CONFIG_EXT4_FS              <-- ext4.o                 - (ext4)
CONFIG_FS_MBCACHE           <-- mbcache.o              - (mbcache)
CONFIG_JBD2                 <-- jbd2.o                 - (jbd2)
CONFIG_CRC16                <-- crc16.o                - (crc16)
CONFIG_DM_CRYPT             <-- dm-crypt.o             - (dm_crypt)
CONFIG_BLK_DEV_DM           <-- dm-mod.o               - (dm_mod)
CONFIG_HID_A4TECH           <-- hid-a4tech.o           - (hid_a4tech)
CONFIG_USB_HID              <-- usbhid.o               - (usbhid)
CONFIG_HID                  <-- hid.o                  - (hid)
CONFIG_BLK_DEV_SD           <-- sd_mod.o               - (sd_mod)
CONFIG_ATA_GENERIC          <-- ata_generic.o          - (ata_generic)
CONFIG_PATA_ACPI            <-- pata_acpi.o            - (pata_acpi)
CONFIG_PATA_VIA             <-- pata_via.o             - (pata_via)
CONFIG_ATA                  <-- libata.o               - (libata)
CONFIG_USB_UHCI_HCD         <-- uhci-hcd.o             - (uhci_hcd)
CONFIG_USB_EHCI_HCD         <-- ehci-hcd.o             - (ehci_hcd)
CONFIG_SCSI                 <-- scsi_mod.o             - (scsi_mod)
CONFIG_USB                  <-- usbcore.o              - (usbcore)
config options not found for: wl (wl.ko)

wl - stands for external broadcom wifi driver, it's not in the kernel.

The code below is an example of process monitoring in linux with netlink proc events. It's written in the most simple way I can think of, so I hope it's obvious. May be someone could save time and make use of it.



The major problem with this netlink interface and proc events still - the kernel returns 1 event at a time, no matter how big buffer your supply is (What's the reason for that?). So you can really easy get overruns with ENOBUFS from the kernel under heavy load. This means you should be carefull with adding some additional work, especially io, to the netlink listener thread. (the example below ignores that rule for simplicity reason)



This file is licensed under the GPL v2 (http://www.gnu.org/licenses/gpl2.txt) (some parts was originally borrowed from proc events example)

pmon.c

code highlighted with GNU source-highlight 3.1


#include <sys/socket.h>
#include <linux/netlink.h>
#include <linux/connector.h>
#include <linux/cn_proc.h>
#include <signal.h>
#include <errno.h>
#include <stdbool.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

/*
 * connect to netlink
 * returns netlink socket, or -1 on error
 */
static int nl_connect()
{
    int rc;
    int nl_sock;
    struct sockaddr_nl sa_nl;

    nl_sock = socket(PF_NETLINK, SOCK_DGRAM, NETLINK_CONNECTOR);
    if (nl_sock == -1) {
        perror("socket");
        return -1;
    }

    sa_nl.nl_family = AF_NETLINK;
    sa_nl.nl_groups = CN_IDX_PROC;
    sa_nl.nl_pid = getpid();

    rc = bind(nl_sock, (struct sockaddr *)&sa_nl, sizeof(sa_nl));
    if (rc == -1) {
        perror("bind");
        close(nl_sock);
        return -1;
    }

    return nl_sock;
}

/*
 * subscribe on proc events (process notifications)
 */
static int set_proc_ev_listen(int nl_sock, bool enable)
{
    int rc;
    struct __attribute__ ((aligned(NLMSG_ALIGNTO))) {
        struct nlmsghdr nl_hdr;
        struct __attribute__ ((__packed__)) {
            struct cn_msg cn_msg;
            enum proc_cn_mcast_op cn_mcast;
        };
    } nlcn_msg;

    memset(&nlcn_msg, 0, sizeof(nlcn_msg));
    nlcn_msg.nl_hdr.nlmsg_len = sizeof(nlcn_msg);
    nlcn_msg.nl_hdr.nlmsg_pid = getpid();
    nlcn_msg.nl_hdr.nlmsg_type = NLMSG_DONE;

    nlcn_msg.cn_msg.id.idx = CN_IDX_PROC;
    nlcn_msg.cn_msg.id.val = CN_VAL_PROC;
    nlcn_msg.cn_msg.len = sizeof(enum proc_cn_mcast_op);

    nlcn_msg.cn_mcast = enable ? PROC_CN_MCAST_LISTEN : PROC_CN_MCAST_IGNORE;

    rc = send(nl_sock, &nlcn_msg, sizeof(nlcn_msg), 0);
    if (rc == -1) {
        perror("netlink send");
        return -1;
    }

    return 0;
}

/*
 * handle a single process event
 */
static volatile bool need_exit = false;
static int handle_proc_ev(int nl_sock)
{
    int rc;
    struct __attribute__ ((aligned(NLMSG_ALIGNTO))) {
        struct nlmsghdr nl_hdr;
        struct __attribute__ ((__packed__)) {
            struct cn_msg cn_msg;
            struct proc_event proc_ev;
        };
    } nlcn_msg;

    while (!need_exit) {
        rc = recv(nl_sock, &nlcn_msg, sizeof(nlcn_msg), 0);
        if (rc == 0) {
            /* shutdown? */
            return 0;
        } else if (rc == -1) {
            if (errno == EINTR) continue;
            perror("netlink recv");
            return -1;
        }
        switch (nlcn_msg.proc_ev.what) {
            case PROC_EVENT_NONE:
                printf("set mcast listen ok\n");
                break;
            case PROC_EVENT_FORK:
                printf("fork: parent tid=%d pid=%d -> child tid=%d pid=%d\n",
                        nlcn_msg.proc_ev.event_data.fork.parent_pid,
                        nlcn_msg.proc_ev.event_data.fork.parent_tgid,
                        nlcn_msg.proc_ev.event_data.fork.child_pid,
                        nlcn_msg.proc_ev.event_data.fork.child_tgid);
                break;
            case PROC_EVENT_EXEC:
                printf("exec: tid=%d pid=%d\n",
                        nlcn_msg.proc_ev.event_data.exec.process_pid,
                        nlcn_msg.proc_ev.event_data.exec.process_tgid);
                break;
            case PROC_EVENT_UID:
                printf("uid change: tid=%d pid=%d from %d to %d\n",
                        nlcn_msg.proc_ev.event_data.id.process_pid,
                        nlcn_msg.proc_ev.event_data.id.process_tgid,
                        nlcn_msg.proc_ev.event_data.id.r.ruid,
                        nlcn_msg.proc_ev.event_data.id.e.euid);
                break;
            case PROC_EVENT_GID:
                printf("gid change: tid=%d pid=%d from %d to %d\n",
                        nlcn_msg.proc_ev.event_data.id.process_pid,
                        nlcn_msg.proc_ev.event_data.id.process_tgid,
                        nlcn_msg.proc_ev.event_data.id.r.rgid,
                        nlcn_msg.proc_ev.event_data.id.e.egid);
                break;
            case PROC_EVENT_EXIT:
                printf("exit: tid=%d pid=%d exit_code=%d\n",
                        nlcn_msg.proc_ev.event_data.exit.process_pid,
                        nlcn_msg.proc_ev.event_data.exit.process_tgid,
                        nlcn_msg.proc_ev.event_data.exit.exit_code);
                break;
            default:
                printf("unhandled proc event\n");
                break;
        }
    }

    return 0;
}

static void on_sigint(int unused)
{
    need_exit = true;
}

int main(int argc, const char *argv[])
{
    int nl_sock;
    int rc = EXIT_SUCCESS;

    signal(SIGINT, &on_sigint);
    siginterrupt(SIGINT, true);

    nl_sock = nl_connect();
    if (nl_sock == -1)
        exit(EXIT_FAILURE);

    rc = set_proc_ev_listen(nl_sock, true);
    if (rc == -1) {
        rc = EXIT_FAILURE;
        goto out;
    }

    rc = handle_proc_ev(nl_sock);
    if (rc == -1) {
        rc = EXIT_FAILURE;
        goto out;
    }

	set_proc_ev_listen(nl_sock, false);

out:
    close(nl_sock);
    exit(rc);
}


sample output


$ sudo ./pmon
set mcast listen ok
fork: parent tid=2202 pid=2202 -> child tid=17595 pid=17595
exec: tid=17595 pid=17595
exec: tid=17595 pid=17595
exec: tid=17595 pid=17595
fork: parent tid=17595 pid=17595 -> child tid=17596 pid=17596
exec: tid=17596 pid=17596
exit: tid=17596 pid=17596 exit_code=0
fork: parent tid=17595 pid=17595 -> child tid=17597 pid=17597
exec: tid=17597 pid=17597
exit: tid=17597 pid=17597 exit_code=0
exit: tid=17595 pid=17595 exit_code=0
fork: parent tid=2202 pid=2202 -> child tid=17598 pid=17598
exec: tid=17598 pid=17598
exec: tid=17598 pid=17598
exec: tid=17598 pid=17598
fork: parent tid=17598 pid=17598 -> child tid=17599 pid=17599
exec: tid=17599 pid=17599
exit: tid=17599 pid=17599 exit_code=0
fork: parent tid=17598 pid=17598 -> child tid=17600 pid=17600
exec: tid=17600 pid=17600
exit: tid=17600 pid=17600 exit_code=0
exit: tid=17598 pid=17598 exit_code=0




You need bios update to version 23 to support memory upgrade up to 3Gb


I used arch linux x86_64 with vanilla 2.6.31 kernel (rc8 actually, but should be released on 7 sep)


General Hardware Specifications of Lenovo Ideapad S12 via nano



Hardware Components


Status under Linux



Notes

VIA Nano processor U2250 (1.6GHz Capable) CentaurHauls, 1595.773 MHz Works See below
12.1" 1280x800 LED-backlit TFT LCD Works See my xorg.conf below
VIA Technologies, Inc. VX800/VX820 Chrome 9 HC3 Integrated Graphics [1106:1122] (rev 11) Works partly (no 3D and hardware mpeg features with opensource drivers) See below
VIA Technologies, Inc. VX800 Serial ATA and EIDE Controller [1106:5324] Works SATA=scsi (/dev/sda), using SATA compatability mode
Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express [14e4:1713] (rev 02) Works See below
Broadcom Corporation BCM4312 802.11b/g [14e4:4315] (rev 01) Works Using broadcom driver, wpa_supplicant (I used bcmwl-kernel-source_5.10.91.9+bdcom-0ubuntu4_amd64.deb as it contains patches for new kernel versions.)
Update: no more need for broadcom driver, as fully opensource driver b43 works fine and better. You just need to install proper firmware for it (I followed "You are using the b43 driver with an LP-PHY card (e.g. BCM4312)" section).
VIA Technologies, Inc. Secure Digital Memory Card Controller (rev 01) Works See below
VIA Technologies, Inc. VT1708/A [Azalia HDAC] (VIA High Definition Audio Controller) (rev 20) Works See below
[04f2:b090] Lenovo EasyCamera Works uvcvideo kernel driver
[0a5c:2150] Broadcom Corp, BCM2046 Bluetooth Device Works btusb kernel driver


NOTE: Via Padlock (support for x86_64), Hardware random generator (support for x86_64) and Via card reader drivers come with vanilla kernels >= 2.6.31


Nothing special about Arch setup, just follow installation guide. Then build latest (at the moment) 2.6.31-rc8 kernel from source (will be in stock soon after official 2.6.31 release).


VIA Nano processor U2250 (1.6GHz Capable) CentaurHauls


# cat /proc/cpuinfo 
processor	: 0
vendor_id	: CentaurHauls
cpu family	: 6
model		: 15
model name	: VIA Nano processor U2250 (1.6GHz Capable)
stepping	: 3
cpu MHz		: 1595.773
cache size	: 1024 KB
fpu		: yes
fpu_exception	: yes
cpuid level	: 10
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat clflush acpi mmx fxsr sse sse2 ss tm pbe syscall nx lm
constant_tsc rep_good pni monitor vmx est tm2 ssse3 cx16 xtpr rng rng_en
ace ace_en ace2 phe phe_en lahf_lm
bogomips	: 3191.54
clflush size	: 64
cache_alignment	: 128
address sizes	: 36 bits physical, 48 bits virtual
power management:


To enable hardware encryption (that is perfect for dm-crypt) check this options:


 Symbol: CPU_SUP_CENTAUR [=y]                                 
 Prompt: Support Centaur processors                           
   Defined at arch/x86/Kconfig.cpu:459                        
   Depends on: PROCESSOR_SELECT                               
   Location:                                                  
     -> Processor type and features                           
       -> Supported processor vendors (PROCESSOR_SELECT [=y])  

 Symbol: CRYPTO_DEV_PADLOCK [=y]                                  
 Prompt: Support for VIA PadLock ACE                              
   Defined at drivers/crypto/Kconfig:13                           
   Depends on: CRYPTO && CRYPTO_HW && X86 && !UML                 
   Location:                                                      
     -> Cryptographic API (CRYPTO [=y])                           
       -> Hardware crypto devices (CRYPTO_HW [=y])                
   Selects: CRYPTO_ALGAPI                                         

 Symbol: CRYPTO_DEV_PADLOCK_AES [=y]                              
 Prompt: PadLock driver for AES algorithm                         
   Defined at drivers/crypto/Kconfig:26                           
   Depends on: CRYPTO && CRYPTO_HW && CRYPTO_DEV_PADLOCK          
   Location:                                                      
     -> Cryptographic API (CRYPTO [=y])                           
       -> Hardware crypto devices (CRYPTO_HW [=y])                
         -> Support for VIA PadLock ACE (CRYPTO_DEV_PADLOCK [=y]) 
   Selects: CRYPTO_BLKCIPHER && CRYPTO_AES                        

 Symbol: CRYPTO_DEV_PADLOCK_SHA [=y]                              
 Prompt: PadLock driver for SHA1 and SHA256 algorithms            
   Defined at drivers/crypto/Kconfig:39                           
   Depends on: CRYPTO && CRYPTO_HW && CRYPTO_DEV_PADLOCK          
   Location:                                                      
     -> Cryptographic API (CRYPTO [=y])                           
       -> Hardware crypto devices (CRYPTO_HW [=y])                
         -> Support for VIA PadLock ACE (CRYPTO_DEV_PADLOCK [=y]) 
   Selects: CRYPTO_SHA1 && CRYPTO_SHA256                           

Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express [14e4:1713] (rev 02)


 Symbol: TIGON3 [=y]                               
 Prompt: Broadcom Tigon3 support                   
   Defined at drivers/net/Kconfig:2246             
   Depends on: NETDEVICES && NETDEV_1000 && PCI    
   Location:                                       
     -> Device Drivers                             
       -> Network device support (NETDEVICES [=y]) 
         -> Ethernet (1000 Mbit) (NETDEV_1000 [=y])
   Selects: PHYLIB 

VIA Technologies, Inc. VT1708/A [Azalia HDAC] (VIA High Definition Audio Controller) (rev 20)


Symbol: SND_HDA_CODEC_REALTEK [=y]                              
 Prompt: Build Realtek HD-audio codec support                    
   Defined at sound/pci/hda/Kconfig:42                           
   Depends on: SOUND && !M68K && SND && SND_PCI && SND_HDA_INTEL 
   Location:                                                     
     -> Device Drivers                                           
       -> Sound card support (SOUND [=m])                        
         -> Advanced Linux Sound Architecture (SND [=m])         
           -> PCI sound devices (SND_PCI [=y])                   
             -> Intel HD Audio (SND_HDA_INTEL [=m])              

 Symbol: SND_HDA_CODEC_ANALOG [=y]                               
 Prompt: Build Analog Device HD-audio codec support              
   Defined at sound/pci/hda/Kconfig:54                           
   Depends on: SOUND && !M68K && SND && SND_PCI && SND_HDA_INTEL 
   Location:                                                     
     -> Device Drivers                                           
       -> Sound card support (SOUND [=m])                        
         -> Advanced Linux Sound Architecture (SND [=m])         
           -> PCI sound devices (SND_PCI [=y])                   
             -> Intel HD Audio (SND_HDA_INTEL [=m])              

and generic HD-audio codec parser

VIA Technologies, Inc. Secure Digital Memory Card Controller (rev 01)


VIA SD/MMC Card Reader Driver comes with kernels starting from 2.6.31


linux/drivers/mmc/host/Makefile for via
 Symbol: MMC_VIA_SDMMC [=m]                 
 Prompt: VIA SD/MMC Card Reader Driver      
   Defined at drivers/mmc/host/Kconfig:245  
   Depends on: MMC && PCI                   
   Location:                                
     -> Device Drivers                      
       -> MMC/SD/SDIO card support (MMC [=y])

VIA Technologies, Inc. VX800/VX820 Chrome 9 HC3 Integrated Graphics [1106:1122] (rev 11)


I use openchrome opensource driver. It gives me working xvideo and 2D (no 3D and hardware mpeg for now). I saw some guys used proprietary via drivers, it gives them 3D and mpeg, but it's for old kernels and xserver version.


my xorg.conf


# xorg.conf (X.Org X Window System server configuration file)

Section "Module"
	Load	"bitmap"
	Load	"extmod"
	Load	"int10"
	Load	"vbe"
	Load	"dri"
	Load	"glx"
	Load	"dbe"
	Load	"v4l"
	Load	"synaptics"
EndSection

Section "Monitor"
	Identifier	"LCD-Panel"
	Option		"DPMS"
	HorizSync	60
	VertRefresh	31.5-90
	modeline  "1280x800@60" 83.46 1280 1344 1480 1680 800 801 804 828 -hsync +vsync
EndSection

Section "Device"
	Identifier	"VX800"
	BusID		"PCI:00:01:0"
	BoardName	"VIA Chrome9 HC3"
	VendorName	"VIA Tech"
	Driver		"openchrome"
	Option		"AccelMethod"	"EXA"
	Option		"ExaScratchSize"	"8192"
#	Option		"ExaNoComposite"	"On"
	Option      "EnableAGPDMA" "true"
	Option		"ExaNoComposite"	"true"
	Option		"MigrationHeuristic"	"greedy"
	Option		"HWCursor"	"on"
	Option		"VBEModes"	"Off"
	Option		"VBESaveRestore"	"Off"
EndSection

Section "Screen"
	Identifier	"Screen0"
	Device		"VX800"
	Monitor		"LCD-Panel"
	DefaultDepth	24
	SubSection "Display"
		Modes	"1280x800"
		Viewport	0 0
		Depth	24
	EndSubSection
EndSection

Section "DRI"
    Group "video"
	Mode 0666
EndSection


A bit more info in previous post.


Update: no more need for broadcom driver, as fully opensource driver b43 works fine and better (I had broadcom driver issues with monitoring, kismet and TKIP (AES) encryption problem with one router, and never encountered any problems with b43). You just need to install proper firmware for it (I followed "You are using the b43 driver with an LP-PHY card (e.g. BCM4312)" section).

gnu/linux on lenovo s12 via nano

I bought lenovo s12 via nano. It comes with win xp and lenovo quick start (linux) with no linux option :-(. To boot in lenovo quick start you need to press QS button instead of power on (lenovo quick start is also ugly piece of shit with no ability to add software or do any extension. it's based on linux, meant to be bios extension [see coreboot], but there is just old stinky buggy [you need bios update to version 23 to support memory upgrade up to 3Gb] phenix bios in lenovo s12). I had spare wd scorpio black 320gb 7200, so first thing I did, I replace standard wd scorpio blue 160Gb 5400 with it. And upgraded up to 3Gb memory.
There are plenty of general reviews out there. Here is a walk-through for driver problems (I did it for 2.6.30.5 stable kernel x86_64).

First of all I liked this netbook for it's CPU. VIA Nano U2250 is great, check this out:
# cat /proc/cpuinfo
processor    : 0
vendor_id    : CentaurHauls
cpu family    : 6
model        : 15
model name    : VIA Nano processor U2250 (1.6GHz Capable)
stepping    : 3
cpu MHz        : 1596.022
cache size    : 1024 KB
fpu        : yes
fpu_exception    : yes
cpuid level    : 10
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat clflush acpi mmx fxsr sse sse2 ss tm pbe syscall nx lm constant_tsc rep_good pni monitor vmx est tm2 ssse3 cx16 xtpr rng rng_en ace ace_en ace2 phe phe_en lahf_lm
bogomips    : 3192.04
clflush size    : 64
cache_alignment    : 128
address sizes    : 36 bits physical, 48 bits virtual
power management:

It has x86_64 extension, hardware virtualization support (note flag vmx), hardware crypto - via padlock (ace ace_en ace2), hardware random number generator (rng rng_en), multimedia extension like sse2 and ssse3 - quite a nice list for netbook, huh? That forced me to buy this thing as I like to play with kvm and test my software on both 32 and 64-bit platforms. Hardware encryption let me use dm-crypt without pain like on desktop (actually better, as my primary core 2 duo system doesn't have any hardware crypto).
All that via nano processor features are supported by linux kernel. For x86 it's been for a long time in kernel, but for x86_64 it's new (as via 64 bit extensions are new enough). So to get it one can use 2.6.31 branch kernel (that is rc for the time I'm writing this) or take stable one (2.6.30.5 for me at the moment) and pick couple of small changes from 2.6.31 (that's what I did).
Firstly select Centaur processor type:
 Symbol: CPU_SUP_CENTAUR [=y]                                 
 Prompt: Support Centaur processors                           
   Defined at arch/x86/Kconfig.cpu:459                        
   Depends on: PROCESSOR_SELECT                               
   Location:                                                  
     -> Processor type and features                           
       -> Supported processor vendors (PROCESSOR_SELECT [=y]) 

To get via padlock unmasked in menuconfig I pick this changes from 2.6.31:
drivers/crypto/padlock-aes.c and linux-2.6.30.5/drivers/crypto/Kconfig
Then activate it:
 Symbol: CRYPTO_DEV_PADLOCK [=y]                                  
 Prompt: Support for VIA PadLock ACE                              
   Defined at drivers/crypto/Kconfig:13                           
   Depends on: CRYPTO && CRYPTO_HW && X86 && !UML                 
   Location:                                                      
     -> Cryptographic API (CRYPTO [=y])                           
       -> Hardware crypto devices (CRYPTO_HW [=y])                
   Selects: CRYPTO_ALGAPI                                         

 Symbol: CRYPTO_DEV_PADLOCK_AES [=y]                              
 Prompt: PadLock driver for AES algorithm                         
   Defined at drivers/crypto/Kconfig:26                           
   Depends on: CRYPTO && CRYPTO_HW && CRYPTO_DEV_PADLOCK          
   Location:                                                      
     -> Cryptographic API (CRYPTO [=y])                           
       -> Hardware crypto devices (CRYPTO_HW [=y])                
         -> Support for VIA PadLock ACE (CRYPTO_DEV_PADLOCK [=y]) 
   Selects: CRYPTO_BLKCIPHER && CRYPTO_AES                        

 Symbol: CRYPTO_DEV_PADLOCK_SHA [=y]                              
 Prompt: PadLock driver for SHA1 and SHA256 algorithms            
   Defined at drivers/crypto/Kconfig:39                           
   Depends on: CRYPTO && CRYPTO_HW && CRYPTO_DEV_PADLOCK          
   Location:                                                      
     -> Cryptographic API (CRYPTO [=y])                           
       -> Hardware crypto devices (CRYPTO_HW [=y])                
         -> Support for VIA PadLock ACE (CRYPTO_DEV_PADLOCK [=y]) 
   Selects: CRYPTO_SHA1 && CRYPTO_SHA256                          

If done right you will see this in dmesg:
[    1.160612] padlock: Using VIA PadLock ACE for AES algorithm.
[    1.160733] padlock: Using VIA PadLock ACE for SHA1/SHA256 algorithms.

And:
$ cat /proc/crypto
name         : cbc(aes)
driver       : cbc-aes-padlock
module       : kernel
priority     : 400
refcnt       : 2
selftest     : passed
type         : givcipher
async        : yes
blocksize    : 16
min keysize  : 16
max keysize  : 32
ivsize       : 16
geniv        : chainiv

name         : sha256
driver       : sha256-padlock
module       : kernel
priority     : 300
refcnt       : 1
selftest     : passed
type         : digest
blocksize    : 64
digestsize   : 32

name         : sha1
driver       : sha1-padlock
module       : kernel
priority     : 300
refcnt       : 1
selftest     : passed
type         : digest
blocksize    : 64
digestsize   : 20

name         : cbc(aes)
driver       : cbc-aes-padlock
module       : kernel
priority     : 400
refcnt       : 2
selftest     : passed
type         : blkcipher
blocksize    : 16
min keysize  : 16
max keysize  : 32
ivsize       : 16
geniv        : <default>

name         : ecb(aes)
driver       : ecb-aes-padlock
module       : kernel
priority     : 400
refcnt       : 1
selftest     : passed
type         : blkcipher
blocksize    : 16
min keysize  : 16
max keysize  : 32
ivsize       : 0
geniv        : <default>

name         : aes
driver       : aes-padlock
module       : kernel
priority     : 300
refcnt       : 2
selftest     : passed
type         : cipher
blocksize    : 16
min keysize  : 16
max keysize  : 32

This will give you marvellous performance with dm-crypt. There is not need for special tests. I've got 100% cpu load and 15MB/s on coping from dm-crypted partion to dm-crypted partion _without_ padlock. And ordinal average load not more than 30% without a noticeable penalty coping from dm-crypted partion to dm-crypted partion _with_ padlock at speed 45MB/s! (remember I replaced stock hard drive with faster one).
More than that here is a link with patches for openssl and other userspace software for padlock usage: http://www.logix.cz/michal/devel/padlock/index.xp

For hardware random generator I pull drivers/char/hw_random/via-rng.c and drivers/char/hw_random/Kconfig 2.6.31 changes for via

 Symbol: HW_RANDOM_VIA [=y]                                                
 Prompt: VIA HW Random Number Generator support                            
   Defined at drivers/char/hw_random/Kconfig:89                            
   Depends on: HW_RANDOM && X86                                            
   Location:                                                               
     -> Device Drivers                                                     
       -> Character devices                                                
         -> Hardware Random Number Generator Core support (HW_RANDOM [=y])

You will got:
 crw-rw---- 1 root root 10, 183 2009-08-23 12:28 /dev/hwrng

and can use something like rngd to benefit from it.

Other hardware:
-[0000:00]-+-00.0  VIA Technologies, Inc. VX800 Host Bridge [1106:0353]
           +-00.1  VIA Technologies, Inc. VX800/VX820 Error Reporting [1106:1353]
           +-00.2  VIA Technologies, Inc. VX800/VX820 Host Bus Control [1106:2353]
           +-00.3  VIA Technologies, Inc. VX800 PCI to PCI Bridge [1106:3353]
           +-00.4  VIA Technologies, Inc. VX800/VX820 Power Management Control [1106:4353]
           +-00.5  VIA Technologies, Inc. VX800/VX820 APIC and Central Traffic Control [1106:5353]
           +-00.6  VIA Technologies, Inc. VX800/VX820 Scratch Registers [1106:6353]
           +-00.7  VIA Technologies, Inc. VX800/VX820 North-South Module Interface Control [1106:7353]
           +-01.0  VIA Technologies, Inc. Device [1106:1122]
           +-02.0-[0000:01]----00.0  Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express [14e4:1713]
           +-03.0-[0000:02]----00.0  Broadcom Corporation BCM4312 802.11b/g [14e4:4315]
           +-03.1-[0000:03-05]--
           +-0d.0  VIA Technologies, Inc. Secure Digital Memory Card Controller [1106:9530]
           +-0f.0  VIA Technologies, Inc. VX800 Serial ATA and EIDE Controller [1106:5324]
           +-10.0  VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller [1106:3038]
           +-10.1  VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller [1106:3038]
           +-10.2  VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller [1106:3038]
           +-10.4  VIA Technologies, Inc. USB 2.0 [1106:3104]
           +-11.0  VIA Technologies, Inc. VX800/VX820 Bus Control and Power Management [1106:8353]
           +-11.7  VIA Technologies, Inc. VX800/VX820 South-North Module Interface Control [1106:a353]
           +-13.0-[0000:06]--
           \-14.0  VIA Technologies, Inc. VT1708/A [Azalia HDAC] (VIA High Definition Audio Controller) [1106:3288]

NetLink BCM5906M Fast Ethernet PCI Express [14e4:1713] works fine with
 Symbol: TIGON3 [=y]                               
 Prompt: Broadcom Tigon3 support                   
   Defined at drivers/net/Kconfig:2246             
   Depends on: NETDEVICES && NETDEV_1000 && PCI    
   Location:                                       
     -> Device Drivers                             
       -> Network device support (NETDEVICES [=y]) 
         -> Ethernet (1000 Mbit) (NETDEV_1000 [=y])
   Selects: PHYLIB                                 

Broadcom Corporation BCM4312 802.11b/g [14e4:4315] works fine with
 Symbol: LIB80211 [=m]                         
 Prompt: Common routines for IEEE802.11 drivers
   Defined at net/wireless/Kconfig:55          
   Depends on: NET && WIRELESS                 
   Location:                                   
     -> Networking support (NET [=y])          
       -> Wireless (WIRELESS [=y])             
   Selected by: LIBERTAS && NETDEVICES && ...

And half opened Brodcom corp. driver (no opensource driver yet). I take ubuntu package "bcmwl-kernel-source_5.10.91.9+bdcom-0ubuntu4_amd64.deb" (http://packages.ubuntu.com/karmic/bcmwl-kernel-source) as it contains patches for new kernel versions. Driver works pretty well, gives full 54 Mb/s no problems was encountered.

Secure Digital Memory Card Controller [1106:9530] works fine (very good performance) with
stock kernel driver from 2.6.31
I pull changes from this files: linux/drivers/mmc/host/via-sdmmc.c and linux/drivers/mmc/host/Kconfig, linux/drivers/mmc/host/Makefile for via
 Symbol: MMC_VIA_SDMMC [=m]                 
 Prompt: VIA SD/MMC Card Reader Driver      
   Defined at drivers/mmc/host/Kconfig:245  
   Depends on: MMC && PCI                   
   Location:                                
     -> Device Drivers                      
       -> MMC/SD/SDIO card support (MMC [=y])

VT1708/A [Azalia HDAC] (VIA High Definition Audio Controller) [1106:3288] works fine with
 Symbol: SND_HDA_CODEC_REALTEK [=y]                              
 Prompt: Build Realtek HD-audio codec support                    
   Defined at sound/pci/hda/Kconfig:42                           
   Depends on: SOUND && !M68K && SND && SND_PCI && SND_HDA_INTEL 
   Location:                                                     
     -> Device Drivers                                           
       -> Sound card support (SOUND [=m])                        
         -> Advanced Linux Sound Architecture (SND [=m])         
           -> PCI sound devices (SND_PCI [=y])                   
             -> Intel HD Audio (SND_HDA_INTEL [=m])              

 Symbol: SND_HDA_CODEC_ANALOG [=y]                               
 Prompt: Build Analog Device HD-audio codec support              
   Defined at sound/pci/hda/Kconfig:54                           
   Depends on: SOUND && !M68K && SND && SND_PCI && SND_HDA_INTEL 
   Location:                                                     
     -> Device Drivers                                           
       -> Sound card support (SOUND [=m])                        
         -> Advanced Linux Sound Architecture (SND [=m])         
           -> PCI sound devices (SND_PCI [=y])                   
             -> Intel HD Audio (SND_HDA_INTEL [=m])              

and generic HD-audio codec parser

As for usb devices:

BCM2046 Bluetooth Device
Bus 004 Device 002: ID 0a5c:2150 Broadcom Corp. works fine with stock kernel drivers

webcam (Lenovo EasyCamera)
Bus 001 Device 003: ID 04f2:b090 Chicony Electronics Co., Ltd works fine with stock kernel drivers

And for desert graphic card (VIA VX800 VIA Chrome 9 HC3):
lspci -s 00:01.0 -vnn
00:01.0 VGA compatible controller [0300]: VIA Technologies, Inc. Device [1106:1122] (rev 11)
    Subsystem: Lenovo Device [17aa:388c]
    Flags: bus master, fast devsel, latency 32, IRQ 10
    Memory at d0000000 (32-bit, prefetchable) [size=256M]
    Memory at f4000000 (32-bit, non-prefetchable) [size=16M]
    Memory at f0000000 (32-bit, non-prefetchable) [size=64M]
    [virtual] Expansion ROM at 50000000 [disabled] [size=64K]
    Capabilities: [60] Power Management version 2
    Capabilities: [90] Message Signalled Interrupts: Mask- 64bit- Queue=0/0 Enable-

It's pain. At the moment no working 3D as far as I know. Please let me know if you got it!
You will buy lenovo s12 you gonna be frequent guest of openchrome.org - there are lot of info how to get this card working. I use svn version of openchrome driver. It's working fine in EXA mode and give 2D acceleration (it's fine for watching movies, not hdv). Specs are mostly open and there is work going hard to make drivers better and support major features like 3D and hardware mpeg4.
At the moment there is nothing about Lenovo S12 in driver. So to eliminate xorg error message you can add this line:
[UPDATE: openchrome guys work quickly, line is already commited in trunk]:

--- src/via_id.c    2009-08-22 22:29:51.618098173 +0400
***************
*** 223,228 ****
--- 223,229 ----
      {"Samsung NC20",                          VIA_VX800,   0x144d, 0xc04e, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
      {"Quanta DreamBook Light IL1",            VIA_VX800,   0x152d, 0x0771, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
      {"VIA OpenBook",                          VIA_VX800,   0x1170, 0x0311, VIA_DEVICE_CRT | VIA_DEVICE_LCD}, /* VIA OpenBook eNote VBE8910 */
+     {"Lenovo S12",                            VIA_VX800,   0x17aa, 0x388c, VIA_DEVICE_CRT | VIA_DEVICE_LCD},
 
      /*** VX855 ***/
      {"VIA VT8562C",                           VIA_VX855,   0x1106, 0x5122, VIA_DEVICE_CRT},

mine xorg.conf (tested with X.Org X Server 1.6.0):
# xorg.conf (X.Org X Window System server configuration file)

Section "Module"
    Load    "bitmap"
    Load    "extmod"
    Load    "int10"
    Load    "vbe"
    Load    "dri"
    Load    "glx"
    Load    "dbe"
    Load    "v4l"
    Load    "synaptics"
EndSection

Section "Monitor"
    Identifier    "LCD-Panel"
    Option        "DPMS"
    HorizSync    60
    VertRefresh    31.5-90
    modeline  "1280x800@60" 83.46 1280 1344 1480 1680 800 801 804 828 -hsync +vsync
EndSection

Section "Device"
    Identifier    "VX800"
    BusID        "PCI:00:01:0"
    BoardName    "VIA Chrome9 HC3"
    VendorName    "VIA Tech"
    Driver        "openchrome"
    Option        "AccelMethod"    "EXA"
    Option        "ExaScratchSize"    "8192"
    Option        "ExaNoComposite"    "On"
    Option        "MigrationHeuristic"    "greedy"
    Option        "HWCursor"    "on"
EndSection

Section "Screen"
    Identifier    "Screen0"
    Device        "VX800"
    Monitor        "LCD-Panel"
    DefaultDepth    24
    SubSection "Display"
        Modes    "1280x800"
        Viewport    0 0
        Depth    24
    EndSubSection
EndSection

Section "DRI"
    Mode 0666
EndSection

That's all folks. I like my lenovo s12 for it's cpu features and price (about $406 in russia). All devices except graphics adapter works fine (all features will be in stock 2.6.31 kernel).
Couple of thing I dislike are:
- win xp (why should I sponsor ms?)
- glossy screen
- no 3d for graphics adapter yet

Update: If you plan to upgrade RAM to 3Gb you need bios version >=23. Don't forget to update bios before you throw win xp into rubbish bin (where is its place), because lenovo offer bios update software for win xp only (no bare binary image). :-(

oom killer

- "Oh my God, they killed Kenny!"
- "You bastards!"
[  199.812051] Out of memory: kill process 2890 (hald) score 1956 or a child
[  199.859919] Killed process 2894 (hald-runner)
 
[  201.173418] Out of memory: kill process 3121 (eat_memory) score 1583 or a child
[  201.227888] Killed process 3121 (eat_memory)

why? why hal daemon, oh god?! tell me fucking why?!

Tags:

Two movies I like much

Donnie Darko. I like atmosphere of this movie. I like the way this movie filmed.



Wristcutters: A Love Story. This movie is weird too. Not a good trailer, it doesn't give a movie spirits.



Better one


Music: emotionally charged

Freedom downtime

Why I never seen this movie before? :-( It's good, showing real Kevin Mitnick story...



I like films like that. And this one good, too. Called "The code".



Let me know if you can continue this list

Not "...We'll Meet In The End" but also nice