Update Building HTPC; Fedora 18 + XBMC 12 on AT3N7A-I available.

Update Building HTPC; Fedora 15 + XBMC 10 on AT3N7A-I available.


Following to masses, I've decided to build my own HTPC. My old home "server" dead after years of serving, so I had a reason to rebuild it as HTPC also. So, I've opened web site of my favorite shop and found nice mini-ATX board. Googling, I've found that it almost fully supported by latest distributions. A case, I've selected, is ugly, but supports 2 HDD + 2 CD/DVD. I had a bad experience loosing valuable personal data, scince then all my data mirrored.


A nice mini-ATX board is AT3N7A-I from ASUSTeK Computer INC., which built on Intel(R) Atom(TM) CPU 330 @ 1.60GHz, which is Dual-Core + HT (OS see 4CPU on-board), and nVidia MCP79 (ION) chip. It's amazing, a companion chip is 4 times bigger than CPU! Actually, it will do all rest work...

An empty PCI slot I've used for wireless RaLink RT2500 mini-PCI card (I hate cables). Two SATA 250G disks as /dev/sda and /dev/sdb, one combo CD. Oh, almost forgot, 2G of kingston memory kit (supported for higher timing, according to MB booklet. Will try later, may be.)


It's looks like most popular distribution is *ubuntu flawors now. RedHat/Fedora lost most of enthusiasts due to its aggressive commercial position. However, "the shortest way is a way you know". So, I've downloaded FC12 (Fedora Core 12) for installtion. If I had knew about so much changes in OS, then I'd could start with *buntu, got no time saving for learning phase in any case. I've took 32bit version, because according to reviews, no benefits for 64bit in HTPC environment.

Anyway, FC12 was installed on single disk, as installer desired, with packages imposed to me. No problem with this, rpm -e always works for me. (Update: rpmreaper is the best tool I've seen for RPM wiping. Respect.)

A / occupied whole disk (my mistake, missed by me on installing phase). I've boot from rescue CD (actually, from FC12 Live CD, no big difference) and have reduced volume by commands:

# e2fsck -f /vol/rootvg/slash
# resize2fs -M /vol/rootvg/slash
# lvresize -L 3g /vol/rootvg/slash
# resize2fs /vol/rootvg/slash

Now I have some spare space to make all desired volumes and file systems. I like to have separate FS for every purpose. Every project, I've started, has it's own FS. When project finished, a result archived and FS destroyed totally. I separate even system FS, this way I have a working system, even mldonkey filled up all its temp directory.

A SELinux was disabled by me immediately after installation. I'll configure it later, now I do not want loose time for solving access problems.

Wireless story deserves its own part. I've used this based on RT2500 PCI card on previous computer for a while using its "proprietary" driver. RealTech dropped its software to open-source community, and rt2500 driver is part of kernel now. According to others it works well, but my card stopped to work after 5 minutes. Reloading driver helps for other 5 minutes. Googling had not helped, it seems that nobody had similar problem. But I've found some references, discovered for me -v option of lspci command. This is "good" fragment of lspci -v about my card:

01:05.0 Network controller: RaLink RT2500 802.11g Cardbus/mini-PCI (rev 01)
	Subsystem: RaLink Device 2560
	Flags: bus master, slow devsel, latency 64, IRQ 18
	Memory at f9ffe000 (32-bit, non-prefetchable) [size=8K]
	Capabilities: [40] Power Management version 2
	Kernel driver in use: rt2500pci
	Kernel modules: rt2500pci

An emphased lines were missing before a problem was fixed. It was a stupid hardware problem - the PCI card was not sit well in its slot. The card was pulled out, its contacts were cleaned by eraser and card was inserted back. The problem gone.

DHCP daemon still not works over wlan0. It works well as DHCP client, but not works as DHCP server. I can see by tcpdump that DHCPQUERY and DHCPOFFER goes to wlan0, but cannot sniff DHCPOFFER on air. It looks like some feature is off in driver. I'll check this later, too much time lost for wireless...

Other strange hardware related problem was USB problem. I've used external HDD(ATA/SATA)->USB case while migrate my old data to new computer. A disk was discovered well and successfully mounted. But real usage of external disk fills /var/log/messages with messages like:

Dec  9 10:13:17 localhost kernel: usb 1-1: reset high speed USB device using ehci_hcd and address 2
Dec  9 10:13:18 localhost kernel: usb 1-1: device not accepting address 2, error -71

As usual, a problem was very stupid - bad cheap chineese USB cable. Replacing to good USB2 cable (actually, also from China) solved the problem.

Building mirror

A BIOS SATA settings offer RAID capabilities. This may be nice, but due to lack of OS diagnostic, you will never know if you have already broken disk. This is why I going to use software mirror. This software was higly improved scince my first try in 1995, I recommend it as stable.

This procedure probably described many times. Actually, I have no surprised here with FC12. mdadm, and grub works as usual. An initrd command was replaced by dracut, however, a default initrd image had all mirror related modules and tools, so I've not need to use it (an old dog never learn new tricks).

A brief procedure of mirror build is follow:
Create the layout like this, using fdisk (be sure work on FREE disk, you can destroy all your data at this phase):

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1          11       88326   fd  Linux raid autodetect
/dev/sdb2              12       30401   244107675   fd  Linux raid autodetect

We should create mirror with only one channel works, because other disk hold our working OS. Create and start mirrors with missing device:

# mdadm -C /dev/md0 -n2 -l1 /dev/sdb2 missing
# mdadm -R /dev/md0
# mdadm -C /dev/md1 -n2 -l1 /dev/sdb1 missing
# mdadm -R /dev/md1

Create /etc/mdadm.conf config file. It is not strictly necessary, but help to lock md names and maintain RAIDs.

# cat /etc/mdadm.conf
ARRAY /dev/md1 uuid=5829e05a:5365432f:29a5effe:7118d4ab
ARRAY /dev/md0 uuid=1bb5889d:61e7bb46:29a5effe:7118d4ab

These uuid numbers are not free hand strings, You should get it from your running md using command:

# mdadm --examine /dev/sdb1 | grep UUID
           UUID : 5829e05a:5365432f:29a5effe:7118d4ab

Let's move data, We have two data to move, /boot and LVM PV. There is two different way for that. An LVM way:

# pvcreate /dev/md0
# vgextend /dev/rootvg /dev/md0
# pvmove /dev/sda2
# vgreduce /dev/rootvg /dev/sda2
# pvremove /dev/sda2

Thanks to reducing / to 3g size, a pvmove will not take much time. After vgreduce all LVM data resides on our broken mirror.

Moving /boot involves not data moving only, but boot loader update. A boot record should be installed on both disks. Reflect this by updating /boot/grub/device.map

# this device map was generated by anaconda
(hd0)     /dev/sda
(hd1)     /dev/sdb

Now, move data

# mkfs.ext4 -j -m0 -L /boot /dev/md1
# mount /dev/md1 /mnt
# (cd /boot && tar cf - .)|(cd /mnt && tar xpvfB -)
# umount /mnt

Install boot record using grub:

grub> root (hd1,0)
root (hd1,0)
 Filesystem type is ext2fs, partition type 0xfd
grub> setup (hd1)
setup (hd1)
 Checking if "/boot/grub/stage1" exists... no
 Checking if "/grub/stage1" exists... yes
 Checking if "/grub/stage2" exists... yes
 Checking if "/grub/e2fs_stage1_5" exists... yes
 Running "embed /grub/e2fs_stage1_5 (hd1)"...  26 sectors are embedded.
 Running "install /grub/stage1 (hd1) (hd1)1+26 p (hd1,0)/grub/stage2 /grub/grub.conf"... succeeded
grub> quit

Grub should output something bout "success" after setup command. It is recommended to try boot from second disk (selecting by BIOS). However, all can be fixed later by using rescue/Live CD.

Now we have all data moved to our broken mirrors. Fix /etc/fstab about correct /boot mount:

/dev/md1	/boot		ext4	defaults	1 2
and mount new /boot. (umount , mount)

Let's rebuild mirror. We should make physical layout of disks similar:

# sfdisk -d /dev/sdb > sfdisk.sdb
# sfdisk /dev/sda < sfdisk.sdb

If command output told you, that kernel still use an old partition table, reboot required at this phase. Reboot, or continue according to the message. Now, add missing previously devices:

# mdadm -a /dev/md0 /dev/sda2
# mdadm -a /dev/md1 /dev/sda1
# cat /proc/mdstat

Wait for full syncronization before next reboot (highly recommended). Meanwhile, repeat boot loader (GRUB) installation, ising (hd0,0) and (hd0) respectively.

yum repositories and bunch of RPMs

Go to rpm.livna.org and follow instruction to install their REPO. Repeate same procedure with rpmfusion.org.

# MPEG related tools and libs:
# yum install ffmpeg transcode lame id3lib mjpegtools mpg321 wavpack unrar xmms xmms-pulse pavucontrol
# nVidia drivers and video/sound tools:
# yum install kmod-nvidia xorg-x11-drv-nvidia vdpauinfo libvdpau
# MYTHTV soft:
# yum install libmyth mytharchive mythbrowser mythflix mythtv-themes mythtv-setup

Once you've installed nVidia drivers, you will lost X, so put 3 as your default in /etc/inittab until you finished X configuration.


The MB has HDMI output, the TV has HDMI input, even HDMI cable presents. No doubt, they should work with native HD resolution. This was not trivial....

It was not so easy to configure out that ALL problems comes from nouveau module, which is an open-source nVidia driver. It works well, but does not turn on HW acceleration, etc. The nouveau module is part of initrd and still in use when framebuffer starts. Even unloaded, it leaves nVidia chip in state preventing nvidia module to load/initialize chip. Again, lspci -v comes in help:

02:00.0 VGA compatible controller: nVidia Corporation Device 087d (rev b1) (prog-if 00 [VGA controller])
	Subsystem: ASUSTeK Computer Inc. Device 83f9
	Flags: bus master, fast devsel, latency 0, IRQ 20
	Memory at fa000000 (32-bit, non-prefetchable) [size=16M]
	Memory at e0000000 (64-bit, prefetchable) [size=256M]
	Memory at f6000000 (64-bit, prefetchable) [size=32M]
	I/O ports at dc00 [size=128]
	[virtual] Expansion ROM at fbee0000 [disabled] [size=128K]
	Capabilities: [60] Power Management version 2
	Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+
	Kernel driver in use: nvidia
	Kernel modules: nvidia, nouveau, nvidiafb

You should get rid of nouveau in emphased line. There are three step to do: Put module in blacklist. This already done for you by xorg-x11-drv-nvidia RPM from rpmfusion. Read /etc/modprobe.d/blacklist-nouveau.conf for step two. As for step three, add rdblacklist=nouveau to end of kernel line in /boot/grub/grub.conf

If you got message like could not open device file /dev/nvidia0, the chip is already in use by driver nouveau. "rmmod" will not help you either. Other popular message looks like:

vmap allocation for size 16781312 failed: use vmalloc= to increase size.
NVRM: RmInitAdapter failed! (0x26:0xffffffff:1092)
NVRM: rm_init_adapter(0) failed

Read hudge README file for nVIDIA to discover that vmalloc=192MB should be added to grub.conf to end of kernel line.

Once X started, it starts with any resolution, but not what you want. Attached /etc/X11/xorg.conf with good modeline and some options to persuade nVidia use this modeline instead of autoconfig. To be honest, this file is not mine but combination from two or more published on internet.

Section "ServerLayout"
	Identifier "Default Layout"
	Screen 0 "Screen0" 0 0
	InputDevice "Keyboard0" "CoreKeyboard"

Section "Files"
	ModulePath "/usr/lib/xorg/modules/extensions/nvidia"
	ModulePath "/usr/lib/xorg/modules"

Section "ServerFlags"
	Option "AIGLX" "on"

Section "InputDevice"
	Identifier "Keyboard0"
	Driver "kbd"
	Option "XkbModel" "pc105"
	Option "XkbLayout" "us+inet"

Section "Device"
	Identifier "Videocard0"
	Driver "nvidia"
	Option "AddARGBGLXVisuals" "True"
	Option "UseEDIDFreqs" "False"
	Option "ModeValidation" "NoWidthAlignmentCheck, NoDFPNativeResolutionCheck"
	Option "UseEvents" "True"
	Option "UseEdidDpi" "FALSE"
	Option "ExactModeTimingsDVI" "TRUE"

Section "Monitor"
	Identifier "Vizio37"
	HorizSync 31.0 - 70.0
	VertRefresh 50.0 - 85.0
	Modeline "1368x768_60.00" 85.9 1368 1440 1584 1800 768 769 772 795 -hsync +vsync
	# Option "DPMS"
	Option "ModeValidation" "NoDFPNativeResolutionCheck"

Section "Screen"
	Identifier "Screen0"
	Device "Videocard0"
	Monitor "Vizio37"
	Option "UseEdidDpi" "FALSE"
	Option "DPI" "100 x 100"
	#Option "TVStandard" "HD1080i"
	Option "NoLogo" "1"
	Option "TVStandard" "HD720p"
	Option "TVOverScan" ".7"
	Option "ConnectedMonitor" "DFP"
	Option "ExactModeTimingsDVI" "True"
	DefaultDepth 24
	SubSection "Display"
		Viewport 0 0
		Depth 24
		Modes "1368x768_60.00"

Section "Extensions"
	Option "Composite" "Enable"

The other, very interesting recommendation found on internet, make me create 2-pixell image (one left pixell is black, other right pixell is white). Here is the image for lazy people. Use this image as "Tiled" background image. You should get uniform 50% gray background if yor monitor works in its native resolution. (Actually this correct for any LCD display, not related to HDMI resolution at all). If resolution is far from native, the background will looks like gray scaled waves.


All audio outputs detected with no problems during installation. An analog part of sound works well from beginning, while other outputs were not worked until native nVidia driver (for video) was installed. It looks like some initialization problem. However, other outputs starts to work after native driver installed.

No recommended tricks with /etc/pulse/default.pa (like load-module module-alsa-sink device=hw:0,3) needed. No additional ALSA or pulseaudio configuration required.

The trick is to use pavucontrol to make desired output as your default output and unmute it using any mixer software (for example alsamixer -c0). Actually, pavucontrol unmute it for you.

Alternative way is to select HDMI as system default at /etc/pulse/default.pa:

# echo "set-card-profile 0 output:hdmi-stereo" >> /etc/pulse/default.pa

Similar, use alsamixer -c0 to unmute S/PDIF 1 output and save the state as system efault using alsactl store command.


I dropped an idea to use MythTV after some testings. I do not need its features. I need simple file player with UI for kids. So, I've switched to use XBMC.


There is known issue with libcdio which make XBMC do not detect loaded CD's. Fixed version of XBMC, compiled specially for FC12 and packed as RPM, resides here. Once installed, select XBMC session at {K|G}DM login screen. Very nice feature in addition to autologin. Kids are happy.

An /usr/bin/xbmc-standalone script does not auto start pulseaudio, so it was modifyed as follows:

if which pulse-session; then                                                                                            
  pulse-session xbmc --standalone "$@"                                                                                  
        pulseaudio -D --start                                                                                           
  xbmc --standalone "$@"                                                                                                

USB external disks automount without KDE/GNOME managers

Create file /etc/udev/rules.d/86-usb-hdd.rules with the following content:

# Automount USB storage under /media/LABEL

ACTION=="add", KERNEL=="sd*", ATTRS{configuration}=="USB Mass Storage", ENV{ID_FS_LABEL}!="", RUN+="/bin/mkdir /media/$env{ID_FS_LABEL}"
ACTION=="add", KERNEL=="sd*", ATTRS{configuration}=="USB Mass Storage", ENV{ID_FS_LABEL}!="", RUN+="/bin/mount -o ro,noexec /dev/%k /media/$env{ID_FS_LABEL}"
ACTION=="remove", KERNEL=="sd*", ATTRS{configuration}=="USB Mass Storage", ENV{ID_FS_LABEL}!="", RUN+="/bin/umount -l /dev/%k"
ACTION=="remove", KERNEL=="sd*", ATTRS{configuration}=="USB Mass Storage", ENV{ID_FS_LABEL}!="", RUN+="/bin/rmdir /media/$env{ID_FS_LABEL}"

This force UDEV (not HAL) to mount USB drives at /media/FS_LABEL position"

IR remote control


Finally, bluetooth works. I am planning to buy BT keyboard and mouse to use this instead of IR control (meanwhile).

There is a patch, that make new kernel module, called ath3k that can load firmware for Atheros Communications, Inc. built-in USB device. However, a firmware file is not distributed. The story how to extract firmware (atherosbt.bin) from installation CD, comes with MB, found here. Copy it as /lib/firmware/ath3k-1.fw and load module with modprobe ath3k.

enabling selinux

If this was helpfull, please donate
Last modified by Oleg Volkov Fri Mar 29 12:13:07 IDT 2013