Linux on Laptops


Linux on the Samsung n140

Just got a new Samsung n140. Very good keyboard and display (not glossy), quiet, long battery life. Not too fast, but nobody would mistake it for a desktop replacement anyways. Still fast enough to use OpenOffice. The n140 comes with XP installed on it (or rather an XP installer that you have to give some info and then it installs). Of course that is only an emergency backup choice, so I put Linux on it as primary OS.

I used Knoppix 6.2 to change partitions and do hardware detection and installed Debian Squeeze ("testing" at this time) with a custom 2.6.32 kernel from kernel.org on it.

If you have additional information on these or any other issue, I will be happy to include it here with attribution. Don't hesitate to send email to me at arno@wagner.name, preferably with "n140: something" in the subject.

Update 15.7.2010: I now use kernel 2.6.34.1. Seems to work as before, except that the network card works with the RTL8169 driver from the kernel. I also had a second go at the wireless card but failed.

Update 15.8.2010: I decided to switch off Hyperthreading. It seems the faked cores are dog-slow on some things and scrolling in Opera became unberably slow. Rather one real core that two pretend ones. Incidentially, I am not surprised. I suspected a long time theh "Hyperthreading" was basically a marketing scam and at least for the Atom that seems to be very true.

Update 24.12.2010: On the last Debian update, X stopped working. As it turns out, the current version of the Intel graphics driver depends on KMS (Kernel Mode Switching) to work. See below under "KMS".

Update 5.6.2011: Finally had another go at the in my case not working inthernal wireless card. It seems the RFKill hardware switch was set to "off" in the BIOS all along, see below. I have no idea whether I messed this up or this was the default the device was delivered with. The location of the BIOS option is under "boot", which is unusual, see below.


Hardware Overview

I will first describe he hardware itself. Linux drivers and software for it are in a separate section below.

Here is the output that Debian Etch with Kernel 2.6.32 produces for the usual hardware queries. Discussion of individual components follows below.

For the impatient, here is my current kernel config file:

CPU

Intel Atom N270 1.6GHz, definitely not the fastest CPU on the planet. If you roll your own kernel, you may want to make sure multicore support is on, some things benefit from Hyperthreading, which this CPU can do.

Battery / Power Suppply

I have the 6 cell (5200mAh) battery the n140 is usually sold with (Product ID AA-PB8NC6B). This seems to be a standard battery that is also used by other Samsung netbooks like the NC10. There is also supposedly a 3 cell variant around with something like half the capacity. The power supply that comes with the n140 is a wide input range (100-240V) slim "brick type" and delivers 19V at up to 2.1A to the n140. This should be more than enough to charge the battery while operating the n140 at full power.

LED Control Lights

There are 5 of them. From left to right they are
  1. Caps Lock
  2. Disk access
  3. Wireless indicator
  4. Charge:
    • Green = charge complete, external power present
    • Orange = charging, external power present
    • Off = running from battery, no external power
  5. Power on

Display

Non-glossy with good colors and good brighness, due to LED backlight. 1024x600 resolution. The only thing I do not quite like is that it does not open completely. When sitting down or standing at a lectern with the n140 on it, the angle is still reasonable. Standing before it with the n140 on a low table could be broblematic. My old IBM x31 opens 180 degrees and it sometimes has advantages.

Keyboard

Very good. I have an IBM x31 with an excellent keyboard and the n140 is almost as good. No competition for a good desktop-keyboard, but almost no laptop keyboard is.

Touchpad

No idea at the moment. But works out of the box with the X.org /dev/psaux driver. My guess is it emulates a classic two butten PS/2 mouse with scroll-wheel.

Graphics

This is Intel 945GM/GMS/GME, 943/940GML chipset integrated graphics which uses main memory as graphics memory.

Sound

Intel 82801G chipset integrated HD audio.

Ethernet LAN

The n140 has a RTL8101e/8102e ethernet chip, which is not supported by a kernel-native driver (as of 2.6.32). RTL offers a driver to download, which may already be in your kernel if you use a distribution kernel. It is in Knoppix 6.2 and the card works out of the box.

Update: With kernel 2.6.34.1 the RTL8169 driver (in the kernel config under 1000Mbit ethernet) works.

Wireless LAN

Atheros Communications AR9285 PCI-E card.

Note: There are some indications that the AR9285 has issues with kernel 2.6.31. Also the n140 seems to have a software-driven hardware switch that controls the radio part of the card. A driver for linux for this switch seems to be missing.

Update: In the BIOS setup, the default state of the wireless hardware switch can be set under "boot"-"wireless device control". With default on, the card should work under Linux.

Bluetooth

USB BCM2046 Bluetooth Device by Broadcom. I did not try to get it to work as I have no need for it.

USB

There are two standard USB ports (right side) and one "high current" port (left side) that can be switched in the BIOS to deliver current while the n140 is off. This feature is useful to charge small, USB charged devices like mobile phones or mp3 players.

The USB chipset is from Intel and uses the EHCI/UHCI driver.

Card Reader

No idea at the moment. Seems not to be USB or PCI-E directly. Might be ATA.

Repartitioning with Knoppix 6.2

Changing partition sizes with gparted worked without problem. Seems the NTFS support is mature. I did change the partition sizes after doing the XP installation, it is possible that repartitioning first causes problems, as the XP installation lets you resize the C: and D: partitions as well. The original partitioning looks like this (forgot to record the exact details):
  1. /dev/sda1 Hidden 7GB NTFS recovery partition. I suspect this can be scrapped, but so far I have kept it. The BIOS can directly boot fromt his partition (F4) and to a recovery installation using an image of your XP installation you created before. I have not played with this as I do XP backups with Linux NTFSprogs, but it seems this can calso do backups to USB HDD/Flash stick.
  2. /dev/sda2 NTFS Windows XP C: partition, contains the initial installer. Can be resized during XP installation, but not below 25GB. Later resizing with gparted is possible.
  3. /dev/sda3 NTFS Windows XP D: partition, empty. Will contain the rest of the disk space after XP installation.
Here is what I changed it to after XP installation using gparted from Knoppix 6.2. This is of course only an example, repartition to whatever you like!

sda3 gets mounted under /boot and holds the kernel and grub configuration files. sda7 is the main system, sda8 is a rescue system and sda9 is a bit bucket, were I keep an image-backup of sda2 among other things. I left sda1 in place for the moment, until I have investigated what booting with F4 (boots the resuce system from sda1) does when sda1 is not present or used for something else.

Disk /dev/sda: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x5f63f044

 Device Boot      Start         End      Blocks   Id  System
 /dev/sda1               1         914     7341673+  12  Compaq diagnostics
 /dev/sda2   *         915        2444    12289725    7  HPFS/NTFS
 /dev/sda3            3474        3498      200812+  83  Linux
 /dev/sda4            3499       19457   128190667+   5  Extended
 /dev/sda5            3499        7322    30716248+   b  W95 FAT32
 /dev/sda6            7323        7449     1020096   82  Linux swap / Solaris
 /dev/sda7            7450        9361    15358108+  83  Linux
 /dev/sda8            9362       10636    10241406   83  Linux
 /dev/sda9           10637       19457    70854651   83  Linux

Drivers and Software for Debian Lenny with Kernel 2.6.32

Battery

Battery levels and state (charging, discharging) can be queried with cat /proc/acpi/battery/BAT1/state. I use a small state monitor written im Perl to give me a status display in X11. Its source and some documantation is here

There is an option in the BIOS to set the battery to higher sustained charge cycles by having it charge only to 80%. Either this does not work under Linux, as the battery gets charged to 100%, or this actully means you can only discharge it down to 20%. As soon as I know, I will update this info.

A full charge will get you something like 6 hours with the disk spinning and medium brightness. This corresponds to around 9W power draw.

Display Brightness

(from http://wiki.archlinux.org/index.php/Samsung_N140) setpci -s 00:02.1 F4.B=hh with hh in 00..FF does it, with 00 = off. The link above has a script that can be used to tie this function to keys via xbindkeys. I use the commandline directly.

X.org

KMS (Kernel Mode Setting) apparently works, but I have no experience with it and did not try it. Details at http://wiki.archlinux.org/index.php/Samsung_N140.

X.org Graphics Driver: "intel". Update: Seems from around 12/2010 X.org in Debian stable needs KMS. It is a bit difficult to find in the kernel config (and a stock Debian Linux kernel may or may not work out of the box), bt here is where to find it with 2.6.36.2:

Device Drivers 
  -> Graphics support 
    -> Direct Rendering Manager (DRM [=y])
      -> Intel 830M, 845G, 852GM, 855GM, 865G ( [=m])
        -> i915 driver (DRM_I915 [=m])
Instead of compile as module, you can also statically compile.

External VGA Port

xrandr should work. Maximum external resolution is 1920x1080 or greater.

Adding RTL Ethernet Driver

With kernel 2.6.34.1, just use the kernel-integrated RTL8169 driver in the 1000Mbit ethernet section. (No, it will not turn your card magically into Gigabit Ethernet ;-)

With kernel 2.6.32, you need to use the vendor driver. The driver seems to support a broad range of kernels, and should compile and install with most other kernels as well. You need a kernel with modules enabled for this. You also either need the kernel sources or the header package for your running kernel. Instructions below, more detail (if needed) in the README of thed river.

  1. Down load the latest Linux driver from the RTL Homepage (If the link is broken, let me know and go to http://www.realtek.com.tw -> downloads -> Communications Network ICs -> Network Interface Controllers -> 10/100M Fast Ethernet -> PCI Express -> Software)
  2. Unpack the driver
  3. Make sure the RTL8169 driver is not in the kernel. You may have it as module, do a lsmod and check for the presence of a module named r8169. If it is present, remove it with rmmod r8169 and check it is really gone. If it is not, you may need to remove it from /etc/modprobe.conf and reboot. If you have the RTL8169 driver statically compiled in your kernel (if you do, you should know, because you very likely did it yourself...), you may have to remove it from the kernel configuration, recompile your kernel and reboot with the new kernel.
  4. Go to the unpacked driver driectory and do the following as root:
    • make clean modules
    • make install
    • depmod -a
    • modprobe r8101
    I got a number of warnings on the first step, it seems they can be ignored. If you want the module to load automatically at boot, you may want to add r8101 to the file /etc/modules. I did not need to, probably because of kernel module autoloading.

    If you use udev, you may also want to create or modify a rule for the physical network device in /etc/udev/rules.d directory. I found a rule there directly after installing the driver, but I don't know whether the driver installation created it or whether some hotplug script (or other script) did. Anyways, it was in the "persistent-net-device" file.

That is it. You can now assign a static network setting or do dhcp on the interface.

Wireless LAN

My n140 has a card by Atheros, with the kernel driver "ath9k" (Kernel config option "Atheros 802.11n wireless cards" in 2.6.32). Some n140 seem to have a different card. It is an add-in card that sits in what looks to me like a PCI-E micro slot on the mainboard. Note that there seems to be an issue with this card in Kernel 2.6.31. Use 2.6.30 or 2.6.32 and later.

The problem here is that the card has a hardware off-switch in the radio that is software controlled by an additional driver. There is no driver under Linux for this switch.

At this time, I can only recommend using an external wireless card, such as the Zyxel NWD271N. I have been using this USB card with the n140 under Linux 2.6.34.1 with good results.

Update: I broght this on myself, it seems. In the BIOS setup, under "boot"-"wireless device control", the hardware RFKill-switch can be disabled at boot.


Hardware Problems

TSC Instable in Idle

It seems the in-CPU timer has issues when idling. I did not find a way to get rid of the message about the TSC being disabled. The kernel parameter

clocksource=hpet tsc=reliable

did not help.


Opening the n140

Warning: Although there are no seals, opening the n140 likely voids your warranty.

Warning: Opening the n140 can damage it.

That said, with a bit of dexterity, you can open the n140 with noting more than a few, normally invisible, scratches. If you do not want any scratches, there are generic plastic case-opener kits available from some places, but I do not have experience with them. No large amount of force is needed at any time!

Tools needed are one PH1 screwdriver and optionally a flathead one or other flat tool. I also used some wooden matches to keep already separated areas separated in the beginning. Probably not needed.

Instructions:

  1. Remove battery and power cord. Results are undefined otherwise.
  2. Turn the n140 over and remove all screws you see. The screws reachable from the outside are all the same, no need to remember what went in where. The back cover is now held in place by a number of plastic hooks around the outer frame and also by the VGA and sound connectors.
  3. Starts prying apart the top and bottom plastic shell. Start very carefully at both display hinges.
  4. Next you can separate the area between the hinges, working along the crack. I used a flat-head screwdriver (leaves some tiny marks). If you do not want any marks at all, use a flat pice of plastic with rounded edges. A strong fingernail may also work.
  5. Next go around the outer edge and separate top and bottom shell, starting opposite the VGA port. The chrome strip is part of the top cover, the lower shell starts just below it. The area around the power switch may offer a bit more resistance, but it is attached just as the rest of the lower shell is. May require a bit of careful fiddeling.
  6. At some time the lower shell becomes mostly loose. You cannot pry it away directly on the VGA port side. You have to Lift the other side to around 30 degrees and then the hooks on the VGA side will disengage.
Close it again by hooking in on VGA and sound ports (the later may require a bit of force), pushing it flat and then snapping in the plastic hooks around the edge. Remount screws.

Internal HDD

It has a normal 2.5" notebook HDD, in my case a Samsung HM160HI. Other people have reported other drives. I suspect that as long as you stay with a 5400 rpm 2.5" SATA drive with 9.5mm hight (standard, but there are some 12.5mm high ones), you should be fine.

The drive is mounted in a metal drive cage by means of two M3 screws. As that should really be 4 screws, I added two 4mm M3 screws of my own. There is enough space for the heads.

The drive cage is kept in place by a short screw, not a long one like the lower plastric shell. Remove the screw and the cage is held in place only by the SATA connectors. You can then slide it out towards the side of the case, away from the mainboard.

Mounting a new HDD in the drive cage is unproblematic, just remove the screws, swap disk and put in the screws again.

RTC Clock Battery

There is also a lithium battery (betweem mainboard and upper part of the case), that may eventually need replacement after 5-7 years. It is attached to the mainboard via two cables and a connector.

If you want to reset the RTC, there is a pair of contacts to the right (non-screw side) in the memory slot. They are marked "RTC reset", shortening them out should reset your RTC (and BIOS) settings, but I have not tried this. These contaces can be reached without opening the n140, removing the memory slot cover is enough.

Links


Arno Wagner