Tuesday, December 28, 2004

Install Gentoo on Dell 700m

I first built a base system for the laptop on my AMD desktop. I want to use the '-march=pentium-m' CFLAGS, which means you need gcc-3.4.x. So before bootstrapping, I did:

# emerge --nodeps --oneshot linux26-headers
# USE="bootstrap" emerge --nodeps --oneshot gcc

Another way to build a clean and stable toolchain:

# emerge linux26-headers && emerge linux26-headers glibc && emerge glibc binutils gcc && emerge binutils gcc

Take a look at: An emerge wrapper for correctly building the toolchain

NIC: b44, mii may also needed
Alsa: snd_intel8x0
USB mouse, hardisk: usbcore,ehci_hcd,usbhid,uhci_hcd,ohci_hcd,usb_storage

1280x800 resolution:
Need 855resolution patch
framebuffer: 1024x768 only; grub.conf line: video=vesa:1024x768-32@75

dri: need i915

CPU Frequency scaling: enable ('ondemand' cpufreq policy governor) AND (Use ACPI tables to decode valid frequency/voltage pairs) in kernel

Suspend to disk: swsusp2 works with 2.6.9-nitro4

Fonts: for best shape, emerge freetype-2.1.7 from glc; Chinese bold fonts may look blue-tinted, disable anti-alias for SimSun will fix it.

Watching DVDs with mplayer entails adding "-monitoraspect 1.6 (or 1280:800)" as an option.

Monday, December 13, 2004

Gentoo hardisk install on a windows only machine

Let's say you only have windows on your machine, no floppy, no cdrom drive, and no vmware installed. But I assume you have successfully installed and set up Grub for DOS

You need to have a vfat partition (which is also useful for exchanging files between linux and windows). After downloading the 2005.1 LiveCD iso, extract the files and directories from the LiveCD iso (using programs like ultraiso) and copy them over to the vfat partition.
Edit:It turns out Grub-for-DOS also works for ntfs partitions. Details please see: http://forums.gentoo.org/viewtopic-p-3525073.html#3525073

Next, set up a Grub entry like this:
title Gentoo Livecd
root (hd0,4)
kernel /isolinux/gentoo root=/dev/ram0 init=/linuxrc looptype=squashfs loop=/livecd.squashfs cdroot=/dev/hda5 vga=791 splash=silent,theme:livecd-2005.1 CONSOLE=/dev/tty1
initrd /isolinux/gentoo.igz

If it's necessary, append the kernel options as listed in the isolinux/F*.msg files.

Knoppix can be used as a substitute (if you want a graphic environment while you install Gentoo). Take the 3.6 CD as an example, extract and copy over the 'isolinux' directory (it's in the boot directory) to a vfat partition, you also need to copy over the 'KNOPPIX' directory which is quite big. Then write your grub entry like this:
title Knoppix26 From HD
root (hd0,6)
kernel /isolinux/linux26 ramdisk_size=100000 init=/etc/init lang=us apm=power-off vga=791 nomce BOOT_IMAGE=knoppix
initrd /isolinux/minirt26.gz

Now boot with the Grub entry 'Gentoo Livecd'. After getting into a root shell, you may proceed as described in the handbook. Note that the stuff in /mnt/cdrom are just the files and directories on that vfat partition (here /dev/hda5)

The following scripts are useful for automatic installation, make adjustments if necessary.


#hdparm -d 1 /dev/hda #(Activate DMA)
#mke2fs -j /dev/hda9 #(initialize the boot partition)
#mkswap /dev/hda10 #(initialize the swap partition)
swapon /dev/hda10 #(Activate the swap partition)
#mke2fs -j /dev/hda3 #(if you want to use ext3 for your root partition)
mkreiserfs -f /dev/hda3 #(if you want to use reiserfs)
#mkfs.xfs -f /dev/hda3 #(if you want to use xfs)
mount /dev/hda3 /mnt/gentoo #(Mount the root partition)
#mkdir /mnt/gentoo/boot #(Create the boot mountpoint)
#mount /dev/hda9 /mnt/gentoo/boot #(Mount the boot partition)
echo "Now set your system time! For instance, to set the date to October 29th, 16:21 in the year 2005, type: date 102916212005"


cd /mnt/gentoo #(Go to the mountpoint where the root partition has been mounted)
tar xjvpf /mnt/cdrom/stages/stage3-x86-2005.1-r1.tar.bz2 #(Extract a stage3 tarball...)
tar -xvjf /mnt/cdrom/snapshots/portage-20050709.tar.bz2 -C /mnt/gentoo/usr #(unpack a portage tree)
mkdir /mnt/gentoo/usr/portage/distfiles #(Create a directory for distfiles)
cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/ #(copy over distfiles)
#nano -w /mnt/gentoo/etc/make.conf (Optional: edit make.conf)
cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf #(Copy over nameserver information)
mount -t proc none /mnt/gentoo/proc #(Mount the proc filesystem)
mount -o bind /dev /mnt/gentoo/dev #(Mount-bind the /dev filesystem)
cp /mnt/cdrom/step3 /mnt/gentoo #(Copy over the step3 script)
echo "
Now you can run step3!"
chroot /mnt/gentoo /bin/bash #(Chroot into the new environment)

env-update && source /etc/profile #(Load the necessary variables)
export PS1="(chroot) $PS1"
emerge --metadata #(Build the Portage cache to speed up future emerges)
cp /usr/share/zoneinfo/Hongkong /etc/localtime #(Set timezone information)
#nano -w /etc/make.conf #(Optional: edit make.conf)
emerge genkernel #(prepare to compile a kernel)
USE="-doc symlink" emerge gentoo-sources #(install a kernel source)
genkernel --menuconfig all #(save your config when exit)
emerge coldplug #(install coldplug)
rc-update add coldplug default #(Add it to the default runlevel)
nano -w /etc/modules.autoload.d/kernel-2.6 #(List the modules you want automatically loaded)
nano -w /etc/fstab #(edit fstab)
nano -w /etc/conf.d/hostname #(Set the system hostname)
nano -w /etc/conf.d/domainname #(Set the system domainname and NIS domain name)
rc-update add domainname default
echo 'config_eth0=( "dhcp" )
dhcp_eth0="nodns nontp nonis"' >> /etc/conf.d/net
rc-update add net.eth0 default
nano -w /etc/hosts
echo "Have fun with Gentoo!
" >> /etc/issue #(Set the greeting message)
echo "
Now you need to set your root password!"
echo "tts/0" >> /etc/securetty #(Let root to be able to log on through the serial console)
nano -w /etc/rc.conf #(Further system configurations)
#nano -w /etc/conf.d/keymaps
nano -w /etc/conf.d/clock
emerge syslog-ng #(Installing a system logger)
rc-update add syslog-ng default
emerge slocate #(Installing File Indexing tool)
emerge reiserfsprogs #(Installing File System Tools)
#emerge xfsprogs
emerge dhcpcd #(Installing a DHCP Client)
#emerge grub #(If you want to keep your Grub-for-Dos,skip the following)
#cat > /boot/grub/grub.conf << "EOF"
#echo "default 0
#timeout 15
#color cyan/blue white/blue

#title=Gentoo Linux 2.6.12-r10
#root (hd0,2)
#kernel /boot/kernel-genkernel-x86-2.6.12-gentoo-r10 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hda3 udev
#initrd /boot/initramfs-genkernel-x86-2.6.12-gentoo-r10
#title=Windows XP
#rootnoverify (hd0,0)
#chainloader +1
echo "OK, your system is ready, now you may exit and reboot!"

Copy these scripts onto that vfat partition, after booting into the livecd environment, type:
# /mnt/cdrom/step1

Set up time for your environment as instructed, then
# /mnt/cdrom/step2

When you see the message 'Now you can run step3!', you're in the chroot environment. Now execute the 'step3' script:
# /step3

You'll be promted to edit /etc/fstab, change root password, configure kernel and so on. Unless your machine is very slow, the whole installation process takes less than 1 hour. Try to keep things as simple as possible, once your base system is up, you can always take your time and configure it into anything you want it to be.