Friday, May 14, 2010

Setup Gentoo on Asus U30JC-QX010X : Part 1

Here is how to setup Gentoo on my brand new asus.

Summary :
  • Resize partitions with gparted.
  • Setup minimal gentoo
  • Update Windows 7 boot loader
Partitioning :
  • Burn last GParted live iso (current is 0.5.2-9).
  • Enter BIOS (sup key)
  • Switch boot devices
  • Launch GParted
  • Remove 30 GB from D: (/dev/sda5)
  • Add / partition : 25 GB (/dev/sda6)
  • Add /home partition : 5 GB (/dev/sda7)
I don't think I need a swap partition.

To install Gentoo, I followed both x64 (last updated in 2008) and x86 (updated in 2010) guides.
  • Boot : gentoo with fr keymap.
  • Set root pasword : passwd ...
  • Load wifi : modprobe ath9k
  • ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0
  • Edit /etc/conf.d/net and /etc/wpa_supplicant/wpa_supplicant.conf
Copy them from another box through a usb key or edit them from scratch with nano.

/etc/conf.d/net :
modules=( "wpa_supplicant" "!iwconfig" )
wpa_supplicant_wlan0="-Dwext"
/etc/wpa_supplicant/wpa_supplicant.conf :
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1
network={
ssid="freebox_essid"
key_mgmt=WPA-PSK
psk="secret"
priority=20
}
  • Start network : /etc/init.d/net.wlan0 start
  • Mount partitions :
mount /dev/sda6 /mnt/gentoo
mkdir /mnt/gentoo/home
mount /dev/sda7 /mnt/gentoo/home
  • Set date
Stage3 :
cd /mnt/gentoo
links http://www.gentoo.org/main/en/mirrors.xml
  • Links keys : Download / Quit.
  • releases/amd64/current-iso/stage3-amd64-20100408.tar.bz2
tar xvjpf stage3-*.tar.bz2
  • snapshots/current/portage-latest.tar.bz2
tar -xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr
make.conf :
nano -w /mnt/gentoo/etc/make.conf
  • Got CFLAGS and CXXFLAGS from Gentoo wiki.
  • MAKEOPTS is cpu count plus one.
CFLAGS="-march=core2 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j5"
mirrorselect (free.fr) :
emerge mirrorselect
mirrorselect -i -o >> /etc/make.conf
mirrorselect -i -r -o >> /etc/make.conf
Chroot :
cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc none /mnt/gentoo/proc
mount -o bind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile
export PS1="(chroot) $PS1"
Portage :
emerge --sync
USE="-fortran -ipv6 mmx nptl nptlonly sse sse2 unicode"
locale & time :
nano -w /etc/locale.gen
en_US ISO-8859-1
en_US.UTF-8 UTF-8
fr_FR ISO-8859-1
fr_FR@euro ISO-8859-15
fr_FR.UTF-8 UTF-8
cp /usr/share/zoneinfo/Europe/Paris /etc/localtime
Kernel (2.6.32-r7) :
emerge gentoo-sources
make menuconfig
    Device Drivers  --->
[*] Network device support --->
[*] Wireless LAN --->
[*] Wireless LAN (IEEE 802.11) --->
<M> Atheros Wireless Cards --->
<M> Atheros 802.11n wireless cards support
File systems --->
<*> The Extended 4 (ext4) filesystem
[*] Ext4 extended attributes
[*] Ext4 POSIX Access Control Lists
[*] Ext4 Security Labels
CONFIG_ATH_COMMON=m
CONFIG_ATH9K=m
CONFIG_EXT4_FS=y
CONFIG_EXT4_FS_XATTR=y
CONFIG_EXT4_FS_POSIX_ACL=y
CONFIG_EXT4_FS_SECURITY=y
make -j5 && make modules_install
cp arch/x86_64/boot/bzImage /boot/kernel-2.6.32-gentoo-r7
nano -w /etc/modules.autoload.d/kernel-2.6
ath9k
  • fstab :
nano -w /etc/fstab
/dev/sda6 / ext4 defaults,noatime 1 1
/dev/sda7 /home ext4 noatime 0 2
  • network : copy net and wpa_supplicant.conf (you can use alternate console with Alt-F2)
cd /etc/init.d
ln -s net.lo net.wlan0
rc-update add net.wlan0 default
emerge dhcpcd wpa_supplicant
System configuration :
emerge syslog-ng vixie-cron
rc-update add syslog-ng default
rc-update add vixie-cron default
rc-update add sshd default
  • Set root password (do not skip this step!) :
passwd
  • Config files :
nano -w /etc/conf.d/clock

TIMEZONE="Europe/Paris"

nano -w /etc/rc.conf

EDITOR="/usr/bin/vim"
XSESSION="e16"

nano -w /etc/conf.d/rc

RC_PARALLEL_STARTUP="yes"

nano -w /etc/conf.d/keymaps

KEYMAP="fr-latin9"
grub :
emerge grub

nano -w /boot/grub/grub.conf

default 0
timeout 50
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title Gentoo
root (hd0,5)
kernel /boot/kernel-2.6.32-r7 root=/dev/sda6

grub

grub> root (hd0,5)
grub> setup (hd0,5)
grub> quit
  • Save boot sector (to some usb key):
dd if=/dev/sda6 of=boot.grub bs=512 count=1
Reboot :
exit
umount /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo/home /mnt/gentoo
reboot
Update boot loader :
  • Steps based on this post
  • Copy boot.grub to C:\
  • Open a cmd as administrator :
C:\>bcdedit /export bcdedit-export-100513
L'opération a réussi.

C:\>bcdedit /create /d Gentoo /application BOOTSECTOR
L'entrée {4bd6ad4c-7c0c-11de-baef-deb9d273c9fa} a été correctement créée.
L'entrée {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} a été correctement créée.

C:\>bcdedit /set {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} device boot
L'opération a réussi.

C:\>bcdedit /set {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} path \boot.grub
L'opération a réussi.

C:\>bcdedit /set {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} locale fr-FR
L'opération a réussi.

C:\>bcdedit /displayorder {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} /addlast
L'opération a réussi.

C:\>bcdedit -v
...

Secteur de démarrage en mode réel
---------------------------------
identificateur {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa}
device boot
path \boot.grub
description Gentoo
locale fr-FR
Now you should be able to select Gentoo on next reboot.

Not seen in amd64 guide :
ccache
emerge -vuD --newuse world
emerge --oneshot libtool
dispatch-conf
perl-cleaner all
python-updater
Notes :
  • grub menu is not visible ?!
  • A lot of packages need to be emerged, still.
Some hardware info is available in next post.

No comments: