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 :
  1. modules=( "wpa_supplicant" "!iwconfig" )  
  2. wpa_supplicant_wlan0="-Dwext"  
/etc/wpa_supplicant/wpa_supplicant.conf :
  1. ctrl_interface=/var/run/wpa_supplicant  
  2. ctrl_interface_group=0  
  3. eapol_version=1  
  4. ap_scan=1  
  5. fast_reauth=1  
  6. network={  
  7.  ssid="freebox_essid"  
  8.  key_mgmt=WPA-PSK  
  9.  psk="secret"  
  10.  priority=20  
  11. }  
  • Start network : /etc/init.d/net.wlan0 start
  • Mount partitions :
  1. mount /dev/sda6 /mnt/gentoo  
  2. mkdir /mnt/gentoo/home  
  3. mount /dev/sda7 /mnt/gentoo/home  
  • Set date
Stage3 :
  1. cd /mnt/gentoo  
  2. links http://www.gentoo.org/main/en/mirrors.xml  
  • Links keys : Download / Quit.
  • releases/amd64/current-iso/stage3-amd64-20100408.tar.bz2
  1. tar xvjpf stage3-*.tar.bz2  
  • snapshots/current/portage-latest.tar.bz2
  1. tar -xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr  
make.conf :
  1. nano -w /mnt/gentoo/etc/make.conf  
  • Got CFLAGS and CXXFLAGS from Gentoo wiki.
  • MAKEOPTS is cpu count plus one.
  1. CFLAGS="-march=core2 -msse4 -mcx16 -mpopcnt -msahf -O2 -pipe"  
  2. CXXFLAGS="${CFLAGS}"  
  3. MAKEOPTS="-j5"  
mirrorselect (free.fr) :
  1. emerge mirrorselect  
  2. mirrorselect -i -o >> /etc/make.conf  
  3. mirrorselect -i -r -o >> /etc/make.conf  
Chroot :
  1. cp -L /etc/resolv.conf /mnt/gentoo/etc/  
  2. mount -t proc none /mnt/gentoo/proc  
  3. mount -o bind /dev /mnt/gentoo/dev  
  4.   
  5. chroot /mnt/gentoo /bin/bash  
  6. env-update && source /etc/profile  
  7. export PS1="(chroot) $PS1"  
Portage :
  1. emerge --sync  
  1. USE="-fortran -ipv6 mmx nptl nptlonly sse sse2 unicode"  
locale & time :
  1. nano -w /etc/locale.gen  
  1. en_US ISO-8859-1  
  2. en_US.UTF-8 UTF-8  
  3. fr_FR ISO-8859-1  
  4. fr_FR@euro ISO-8859-15  
  5. fr_FR.UTF-8 UTF-8  
  1. cp /usr/share/zoneinfo/Europe/Paris /etc/localtime  
Kernel (2.6.32-r7) :
  1. emerge gentoo-sources  
  2. make menuconfig  
  1.     Device Drivers  --->  
  2. [*]   Network device support  --->  
  3. [*]     Wireless LAN  --->  
  4. [*]       Wireless LAN (IEEE 802.11)  --->  
  5. <M>         Atheros Wireless Cards  --->  
  6. <M>           Atheros 802.11n wireless cards support  
  7.     File systems  --->  
  8. <*>   The Extended 4 (ext4) filesystem  
  9. [*]     Ext4 extended attributes  
  10. [*]       Ext4 POSIX Access Control Lists  
  11. [*]       Ext4 Security Labels  
  1. CONFIG_ATH_COMMON=m  
  2. CONFIG_ATH9K=m  
  3. CONFIG_EXT4_FS=y  
  4. CONFIG_EXT4_FS_XATTR=y  
  5. CONFIG_EXT4_FS_POSIX_ACL=y  
  6. CONFIG_EXT4_FS_SECURITY=y  
  1. make -j5 && make modules_install  
  2. cp arch/x86_64/boot/bzImage /boot/kernel-2.6.32-gentoo-r7  
  1. nano -w /etc/modules.autoload.d/kernel-2.6  
  • fstab :
  1. nano -w /etc/fstab  
  1. /dev/sda6 / ext4 defaults,noatime 1 1  
  2. /dev/sda7 /home ext4 noatime   0 2  
  • network : copy net and wpa_supplicant.conf (you can use alternate console with Alt-F2)
  1. cd /etc/init.d  
  2. ln -s net.lo net.wlan0  
  3. rc-update add net.wlan0 default  
  4. emerge dhcpcd wpa_supplicant  
System configuration :
  1. emerge syslog-ng vixie-cron  
  2. rc-update add syslog-ng default  
  3. rc-update add vixie-cron default  
  4. rc-update add sshd default  
  • Set root password (do not skip this step!) :
  • Config files :
  1. nano -w /etc/conf.d/clock  
  2.   
  3. TIMEZONE="Europe/Paris"  
  4.   
  5. nano -w /etc/rc.conf  
  6.   
  7. EDITOR="/usr/bin/vim"  
  8. XSESSION="e16"  
  9.   
  10. nano -w /etc/conf.d/rc  
  11.   
  12. RC_PARALLEL_STARTUP="yes"  
  13.   
  14. nano -w /etc/conf.d/keymaps  
  15.   
  16. KEYMAP="fr-latin9"  
grub :
  1. emerge grub  
  2.   
  3. nano -w /boot/grub/grub.conf  
  4.   
  5. default 0  
  6. timeout 50  
  7. splashimage=(hd0,0)/boot/grub/splash.xpm.gz  
  8. title Gentoo  
  9. root (hd0,5)  
  10. kernel /boot/kernel-2.6.32-r7 root=/dev/sda6  
  11.   
  12. grub  
  13.   
  14. grub> root (hd0,5)  
  15. grub> setup (hd0,5)  
  16. grub> quit  
  • Save boot sector (to some usb key):
  1. dd if=/dev/sda6 of=boot.grub bs=512 count=1  
Reboot :
  1. exit  
  2. umount /mnt/gentoo/dev /mnt/gentoo/proc /mnt/gentoo/home /mnt/gentoo  
  3. reboot  
Update boot loader :
  • Steps based on this post
  • Copy boot.grub to C:\
  • Open a cmd as administrator :
  1. C:\>bcdedit /export bcdedit-export-100513  
  2. L'opération a réussi.  
  3.   
  4. C:\>bcdedit /create /d Gentoo /application BOOTSECTOR  
  5. L'entrée {4bd6ad4c-7c0c-11de-baef-deb9d273c9fa} a été correctement créée.  
  6. L'entrée {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} a été correctement créée.  
  7.   
  8. C:\>bcdedit /set {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} device boot  
  9. L'opération a réussi.  
  10.   
  11. C:\>bcdedit /set {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} path \boot.grub  
  12. L'opération a réussi.  
  13.   
  14. C:\>bcdedit /set {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} locale fr-FR  
  15. L'opération a réussi.  
  16.   
  17. C:\>bcdedit /displayorder {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa} /addlast  
  18. L'opération a réussi.  
  19.   
  20. C:\>bcdedit -v  
  21. ...  
  22.   
  23. Secteur de démarrage en mode réel  
  24. ---------------------------------  
  25. identificateur          {4bd6ad4d-7c0c-11de-baef-deb9d273c9fa}  
  26. device                  boot  
  27. path                    \boot.grub  
  28. description             Gentoo  
  29. locale                  fr-FR  
Now you should be able to select Gentoo on next reboot. Not seen in amd64 guide :
  1. ccache  
  2. emerge -vuD --newuse world  
  3. emerge --oneshot libtool  
  4. dispatch-conf  
  5. perl-cleaner all  
  6. 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: