显示标签为“gentoo”的博文。显示所有博文
显示标签为“gentoo”的博文。显示所有博文

4/18/2008

gentoo 技巧

使用 gentoo 一段时间了, 一些比较有用的命令总结在这里:

ufed - 修改 USE
qlist - 列出包中文件
equery - 查询已安装的包或包中包含的文件等
eix - 可代替 emerge 更新查询,速度快
euse - 命令行式的 USE 编辑器
emerge -fuDv world - 更新整个系统安装的包,但仅下载不编译
emerge -avuDN world - 更新整个系统安装的包,下载并编译
emerge -p --depclean - 删除未列入 world 中的包或垃圾文件
revdep-rebuild - 重新编译依赖
eselect profile list - 列出系统中所有的 profile 文件
eselect profile set * - 设定系统 profile

xdpyinfo | grep dimensions
1024 x 768
xdpyinfo | grep resolution
116 x 116 ?

history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
- 列出系统当前用户曾使用的命令及百分比

3/12/2007

From stage1 install,that's that.

使用 live cd 2006.1 启动机器,输入 gentoo nox 进入系统

hdparm -d 1 -A 1 -m 16 -u 1 -a 64 /dev/hdb (启动DMA)

/dev/hda1 /boot +32M
/dev/hda2 swap +512M
/dev/hda3 / +15360M
/dev/hda4 /home xxxM

mke2fs /dev/hda1
mke2fs -j /dev/hda3
mke2fs -j /dev/hda4

mkswap /dev/hda2
swapon /dev/hda2

mount /dev/hda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/hda1 /mnt/gentoo/boot
cd /mnt/gentoo
tar -xvjpf stage?-*.tar.bz2 (从U盘copy?)

tar -xvjf /mnt/cdrom/gentoo/snapshot/portage-xxx.tar.bz2 -C /mnt/gentoo/usr

mount /dev/hda4 /mnt/gentoo/home
mount -t proc none /mnt/gentoo/proc

配置 make.conf
CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="$ -fvisibility-inlines-hidden"
LDFLAGS="-Wl,-O1"
USE="nptl nptlonly -qt -kde -doc nls cjk" (nptl是一个LinuxThreads的替代品,使您机器的性能上一个台阶,在编译glibc时将用到。相关测试结果和讨论可以去BIM的developer论坛看看。“nptlonly”是最合适的,可以处理掉glibc多余的编译,缩短编译时间)
GENTOO_MIRRORS="ftp://linux.ntcu.net/dists/gentoo/ http://www.zentek-international.com/mirrors/gentoo/ http://gentoo.ccccom.com http://mirror.tucdemonic.org/gentoo/ http://gentoo.gg3.net http://gentoo.math.bme.hu "
SYNC="rsync://rsync.asia.gentoo.org/gentoo-portage"
MAKEOPTS="-j2"
FEATURES="sandbox ccache distlocks"
CCACHE_SIZE="512M"

cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
chroot /mnt/gentoo /bin/bash
env-update && source /etc/profile

注: 安装过程中随时可以在一些步骤中中断, 任何时候需要重新继续之前的步骤, 只需重复如下动作:
挂载各个分区 (如第一部份准备工作中的挂载分区步骤)
重新执行如上的 chroot 命令与 env-update 命令
继续你之前中断的步骤

emerge sync

echo "sys-libs/glibc userlocales" >> /etc/portage/package.use

nano -w /etc/locales.build ::
en_US.UTF-8/UTF-8
en_US/ISO-8859-1
zh_CN.GB18030/GB18030
zh_CN.GBK/GBK
zh_CN.UTF-8/UTF-8
zh_CN/GB2312

cd /usr/portage
scripts/bootstrap.sh

emerge --nodeps gdbm libperl perl

emerge -e system

ln -sf /usr/share/zoneinfo/Asia/Beijing /etc/localtime
date
hwclock --show
hwclock --hctosys
nano -w /etc/conf.d/clock
(将 CLOCK="UTC" 改成 CLOCK="local")

(
我们应该在装完内核配置完用户等步骤完成之后, 系统重启了, 才执行下面两个命令来更改系统时间
# date 120610092004
# hwclock --systohc
)

emerge gentoo-sources
cd /usr/src/linux
make menuconfig
make && make modules_install
cp -i arch/i386/boot/bzImage /boot/kernel-2.6.10 (你喜欢叫它啥名字都可以, 到时在 grub.conf 中配置好就行)
cp -i System.map /boot/System.map-2.6.10

emerge udev
emerge hotplug && rc-update add hotplug default
emerge coldplug && rc-update add coldplug default
emerge alsa-utils
nano -w /etc/modules.d/alsa (编辑 alsa 配置以让内核加载针对你的网卡的驱动)
modules-update
rc-update add alsasound boot
emerge nvidia-kernel (装显卡驱动,ati ???)

/etc/fstab :
/dev/hda1 /boot ext2 noauto,noatime 1 1
/dev/hda3 / ext3 noatime 0 1
/dev/hda2 none swap sw 0 0
/dev/hda4 /home ext3 noatime 0 2
proc /proc proc defaults 0 0
shm /dev/shm tmpfs defaults 0 0

nano -w /etc/conf.d/hostname (设置 HOSTNAME 变量, 例如我的 hzy)
nano -w /etc/conf.d/domainname (设置 DNSDOMAIN 变量, 例如我的 gentoo.com - 瞎叫的, 这域名不存在哦)

nano -w /etc/hosts :
127.0.0.1 hzy.gentoo.com hzy localhost

emerge grub
grub
nano -w /boot/grub/grub.conf :
default 0
timeout 10

title=Gentoo Linux 2004.3 (2.6.10-morph15-r1)
root (hd0,0)
kernel /boot/kernel-2.6.10 ro root=/dev/hda3

emerge syslog-ng && rc-update add syslog-ng default
emerge vixie-cron && rc-update add vixie-cron default

passwd
useradd zy -m -G users,wheel,portage,audio,games -s /bin/bash
passwd zy

emerge splashutils
splash_geninitramfs -v -g /boot/fbsplash-emergence-1024x768 -r 1024x768 emergence
nano -w /boot/grub/grub.conf :
default 0
timeout 30
splashp_w_picpath=(hd0,0)/grub/splash.xpm.gz

title=Gentoo Linux 2004.3 (2.6.10-morph15-r1)
root (hd0,0)
kernel /2.6.10-morph15-r1 root=/dev/hda3 video=vesafb:ywrap,mtrr,1024x768-32@85 splash=silent,theme:emergence
initrd (hd0,0)/fbsplash-emergence-1024x768

exit (退回 LiveCD 提供的环境)
cd /
umount /mnt/gentoo/proc /mnt/gentoo/boot /mnt/gentoo/home /mnt/gentoo
reboot

emerge -pv xorg-x11

emerge xorg-x11

装显卡的 glx 支持 (以 nvidia 为例):
emerge nvidia-glx

配置 X:
xorgcfg

startx

3/05/2007

gentoo on ibm T42<参考>

/etc/make.conf :
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
DISTCC_HOSTS="localhost "
FEATURES="distcc"
LDFLAGS="-Wl,-O2"
MAKEOPTS="-j2"
SYNC="rsync://rsync.asia.gentoo.org/gentoo-portage"
GENTOO_MIRRORS="ftp://ftp.kaist.ac.kr/gentoo/ http://gentoo.mirrors.easynews.com/linux/gentoo/ http://ftp.kaist.ac.kr/pub/gentoo/"

===============================
配置 hdparm 可以让你安装快 1.5 倍
/etc/conf.d/hdparm :
disc0_args="-d1 -X66"
cdrom0_args="-d1"

加入服务 :
rc-update add hdparm default
使得开机后自动启动 :
/etc/init.d/hdparm start

===============================
Kernel config:
比较特別的设定
Code maturity level options :
[*] Prompt for development and/or incomplete code/drivers

(Pentium-4) Processor family
<*> /dev/cpu/microcode - Intel IA32 CPU microcode support
[ ] Math emulation // 去掉
[*] MTRR (Memory Type Range Register) support
[ ] Symmetric multi-processing support // 这个一定要去掉
[*] Local APIC support on uniprocessors
[*] IO-APIC support on uniprocessors

[*] Power Management support
<*> Advanced Power Management BIOS support
[*] Allow interrupts during APM BIOS calls // IBM thinkpad 要用
[*] ACPI Support
<*> AC Adapter
<*> Battery

<*> IEEE 1394 (FireWire) support (EXPERIMENTAL)
<*> Texas Instruments PCILynx support
<*> OHCI-1394 support

Network device support --->
<*> EtherExpressPro/100 support (eepro100, original Becker driver
Input core support ---> 全选

Character devices ---> I2C 要选,不然 IEEE 1394 不能 work
<*> I2C support
<*> I2C bit-banging interfaces
<*> I2C device interface
<*> I2C /proc interface (required for hardware sensors)

[ ] Unix98 PTY support // 去掉

<*> Mouse Support (not serial and bus mice)
[*] PS/2 mouse (aka "auxiliary device") support

File systems ---> // 看你用了那个
<*> Ext3 journalling file system support
< > NTFS file system support (read only)
[*] /proc file system support
[*] /dev file system support (EXPERIMENTAL)
[*] Automatically mount at boot
<*> Second extended fs support
/pty98 不可以選

Sound card support // sound 我只选这个,其他的我用 alsa

USB support --->
<*> Support for USB
[*] Preliminary USB device filesystem
<*> EHCI HCD (USB 2.0) support (EXPERIMENTAL)
<*> UHCI Alternate Driver (JE) support
<*> OHCI (Compaq, iMacs, OPTi, SiS, ALi, ...) support
<*> USB Human Interface Device (full HID) support
[*] HID input layer support

bluetooth // up to you

save config 之後
make dep bzImage modules modules_install

===============================
env ALSA_CARD="intel8x0" emerge alsa-driver

在 make alsa_driver 的同時,你可以把 boot loader 裝好
cd /usr/src/linux
cp System.map /boot
cp arch/i386/boot/bzImage /boot

===============================
http://www.gentoo.org/
http://www.linux-laptop.net/
http://furius.ca/techdoc/misc/thinkpad.html (T42)
http://www.y3m.net/docs/gentoo-on-t42/