gentoo stage4

来源:互联网 发布:怎么用网络看电视 编辑:程序博客网 时间:2024/06/05 08:34
==================rootfs========================
mkdir /mnt/gentoo
mount /dev/sda2 /mnt/gentoo
tar xvjpf stage3-*.tar.bz2
tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

cp -L /etc/resolv.conf /mnt/gentoo/etc/
mount -t proc none /mnt/gentoo/proc
mount --rbind /sys /mnt/gentoo/sys
mount --rbind /dev /mnt/gentoo/dev

chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile
export PS1="(chroot) $PS1"
==================Portage========================
emerge-webrsync  (Or)  emerge --sync
eselect profile list
eselect profile set
==================make.conf
#cpu march(gcc)
#http://en.gentoo-wiki.com/wiki/Safe_Cflags/Intel#Core_i7_and_Core_i5.2C_Xeon_55xx

CFLAGS="-march=corei7-avx -O2 -pipe"#-march=corei7-avx
MAKEOPTS="-j4"
GENTOO_MIRRORS="http://mirrors.163.com/gentoo
http://mirrors.sohu.com/gentoo
http://gentoo.osuosl.org
http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
SYNC="rsync://mirrors.163.com/gentoo-portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
==================Timezone========================
ls /usr/share/zoneinfo
cp /usr/share/zoneinfo/Asia/Shanghai  /etc/localtime
echo "Asia/Shanghai" > /etc/timezone
==================Kernel========================
emerge gentoo-sources
cd /usr/src/linux
make menuconfig
+++
Executable file formats / Emulations  --->
   [*] IA32 Emulation
Device Drivers --->
  Generic Driver Options --->
    [*] Maintain a devtmpfs filesystem to mount at /dev
    [ ]   Automount devtmpfs at /dev, after the kernel mounted the rootfs
File systems --->
  Pseudo Filesystems --->
    [*] /proc file system support
    [*] Virtual memory file system support (former shm fs)
+++
make && make modules_install
cp arch/x86_64/boot/bzImage /boot/kernel-3.7.10-gentoo
cp .config   /boot/config-3.7.10-gentoo
find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko' | less

#For instance, to automatically load the 3c59x.ko
nano -w /etc/conf.d/modules
    modules_2_6="3c59x"
==================Config========================
nano -w /etc/fstab
nano -w /etc/conf.d/hostname
nano -w /etc/conf.d/net
    config_eth0="dhcp"

cd /etc/init.d
ln -s net.lo net.eth0
rc-update add net.eth0 default

nano -w /etc/hosts
passwd
nano -w /etc/rc.conf
nano -w /etc/conf.d/keymaps
nano -w /etc/conf.d/hwclock
=============locales
nano -w /etc/locale.gen

en_US ISO-8859-1
en_US.UTF-8 UTF-8
zh_CN.GB18030 GB18030
zh_CN.GB2312 GB2312
zh_CN.GBK GBK
zh_CN.UTF-8 UTF-8
zh_HK.UTF-8 UTF-8
zh_TW.BIG5 BIG5
zh_TW.UTF-8 UTF-8

locale-gen
nano -w /etc/env.d/02locale
    LANG="zh_CN.UTF-8"
env-update && source /etc/profile
==================Systool========================
emerge syslog-ng
rc-update add syslog-ng default
opt)emerge vixie-cron &&
    rc-update add vixie-cron default &&
    (Only if you have chosen dcron or fcron)  crontab /etc/crontab
opt)emerge mlocate
opt)rc-update add sshd default &&
    nano -w /etc/inittab
    # SERIAL CONSOLES
    s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100
    s1:12345:respawn:/sbin/agetty 9600 ttyS1 vt100
emerge dhcpcd
opt)emerge ppp
==================Grub========================
emerge grub
nano -w /boot/grub/grub.conf
    title Gentoo Linux 3.4.9    
    root (hd0,1)
    kernel /boot/kernel-3.4.9-gentoo root=/dev/sda2
    title Windows 7
    rootnoverify (hd0,0)
    makeactive
    chainloader +1

grub --no-floppy
    root (hd0,1)
    setup (hd0)
opt)grep -v rootfs /proc/mounts > /etc/mtab && grep -v rootfs /proc/mounts > /etc/mtab
==================Reboot========================
# exit
cdimage ~# cd
cdimage ~# umount -l /mnt/gentoo/dev{/shm,/pts,}
cdimage ~# umount -l /mnt/gentoo{/boot,/proc,}
cdimage ~# reboot
==================User========================

useradd -m -G users,wheel,audio -s /bin/bash  lin   //?????
passwd lin
==================package.mask========================
#>sys-boot/grub-0.97
#>sys-kernel/gentoo-sources-3.7.10

==================Kernel========================
http://www.kernel-seeds.org/
http://lamp.linux.gov.cn/Linux/kernel_options.html
http://www.linuxsir.org/bbs/thread322894.html
http://www.cnblogs.com/kulin/archive/2013/01/04/linux-core.html

PCI ID    Works?    Vendor    Device    Driver    Kernel
80860104        Intel Corporation    2nd Generation Core Processor Family DRAM Controller        
80860116    Yes    Intel Corporation    2nd Generation Core Processor Family Integrated Graphics Controller    i915    v2.6.38-
80861c3a        Intel Corporation    6 Series/C200 Series Chipset Family MEI Controller #1        
80861c2d        Intel Corporation    6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2        
80861c20    Yes    Intel Corporation    6 Series/C200 Series Chipset Family High Definition Audio Controller    snd-hda-intel    v2.6.34-
80861c10        Intel Corporation    6 Series/C200 Series Chipset Family PCI Express Root Port 1        
80861c12        Intel Corporation    6 Series/C200 Series Chipset Family PCI Express Root Port 2        
80861c16        Intel Corporation    6 Series/C200 Series Chipset Family PCI Express Root Port 4        
80861c26        Intel Corporation    6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1        
80861c49    Yes    Intel Corporation    HM65 Express Chipset Family LPC Controller    iTCO_wdt    v2.6.34-
80861c03    Yes    Intel Corporation    6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller    ahci    v2.6.34-
80861c22    Yes    Intel Corporation    6 Series/C200 Series Chipset Family SMBus Controller    i2c-i801    v2.6.34-
80860084    Yes    Intel Corporation    Centrino Wireless-N 1000 [Condor Peak]    iwlwifi    v2.6.30-
10ec8168    Yes    Realtek Semiconductor Co., Ltd.    RTL8111/8168 PCI Express Gigabit Ethernet controller    r8169    v2.6.25-


lubuntu@lubuntu:~$ lspci
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 05)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b5)
00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b5)
00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b5)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 05)
00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset Family LPC Controller (rev 05)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 05)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 05)
02:00.0 Network controller: Intel Corporation Centrino Wireless-N 1000 [Condor Peak]
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06)
请教:
1,声卡现在都是现在几乎都是intel_hda,
但是里面那么多codecs你是怎么确定的?
我是没动它用默认的。
alsa里面的 OSS (大概是这个吧,就是除了选硬件设备剩下的那些)怎么选择?
我也没动,只把带有 verbose debug之类的去掉了。
2,cpu的hotplug 貌似必须被依赖,和电源管理有关,是吧。
其实我想把cpu 啊,pci啊的hotplug关掉。
3,还有就是比如说一些的东西,如unix pty,ram disk,
根本没法确认是否需要啊。unix pty 虚拟终端会用到,这个我知道,
但是也有人不用虚拟终端的。这些玩意要确认,难道要自己读kernel 的 Doc?
4,串口问题。理论上芯片组都带串口,但是我又不用,问题是我不看专家模式,
ps/2的driver会把串口依赖进去。你知道有工具可以生成依赖树吗?
5,有个叫MMU 还是 IOMMU的玩意,冒失是AMD的内存管理相关的,
我依稀记得INTEL也有这个东西。但是kernel只提供了AMD的选项,
我还是选了,能确认下来吗?
6,我发现我还有3-5个和内存相关的,在lspci上能列出来,但是信息很少的设备。
(就是比如说上面的显卡可能有8行info,那几个就一行)一看就有问题吧。
后来我看那个nv开源driver的wiki发现我的显卡还有3块buffer,
一个32M,2个16M(大概这么多)我对硬件了解太少了,不知道到kernel
能不能drive上 那个3块buffer,有可能已经drive上了。有没有相关的信息可以
提供?
1. 检测方法:
Shell代码
cat /proc/asound/card0/codec#0 |grep Codec  
Codec: IDT 92HD90BXX  
然后再查一下
Documentation/sound/alsa/HD-Audio-Controls.txt
Documentation/sound/alsa/HD-Audio.txt
现在OSS已经过时了,要么用OSS4,对我来说alsa+pulseaudio已经足够

2. 这个我没有特别关注,下面是我的配置
CONFIG_HOTPLUG=y
# CONFIG_MEMORY_HOTPLUG is not set
CONFIG_HOTPLUG_CPU=y
CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
CONFIG_ACPI_HOTPLUG_CPU=y
# CONFIG_HOTPLUG_PCI is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set

3. UNIX98_PTYS=y 这个一定选,ssh或者用xterm等时会用到,生成pts/1这样的设备
我要使用FRAMEBUFFER_CONSOLE=y,它依赖于BLK_DEV_RAM=y,如果你没啥用,可以不选,或者选成模块

4. 在个人电脑上,所有的串口,并口都可以去掉,很多主板都不带这些接口了。要用的话也是usb转串口的数据线,比如我用的prolific pl2303 usb to serial芯片的转换线:
USB_SERIAL_PL2303 [=m]
Shell代码
Location:                                                                                                          |    
  |     -> Device Drivers                                                                                                |    
  |       -> USB support (USB_SUPPORT [=y])                                                                              |    
  |         -> USB Serial Converter support (USB_SERIAL [=m])  


5. IOMMU貌似是没啥作用,不选也没啥,但是我选了
INTEL_IOMMU [=y]
Shell代码
Location:                                                                                                          |    
  |     -> Device Drivers                                                                                                |    
  |       -> IOMMU Hardware Support (IOMMU_SUPPORT [=y])  


6. lspci -vnnn,列出的设备如果有Kernel driver in use和Kernel modules,说明已经装载驱动,但是不一定就对,如果没有,
那么就说明这个设备目前没有对应的驱动。

==================lsmod================ =======
dm_crypt               22820  0
snd_hda_codec_hdmi     36748  1   ////////closed  (and snd_rawmidi)
snd_hda_codec_realtek    78399  1 IIIIIIIIIII
snd_hda_intel          39619  1    ||||||||||
snd_hda_codec         136128  3 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_intel  |||||||||
snd_hwdep              13602  1 snd_hda_codec    |||||||||||||
uvcvideo               80847  0  ||||||||||
rts5139               352481  0  \\\\\\\\\\\\wiat
snd_pcm                97451  3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel        ||||||||||||
videobuf2_vmalloc      13056  1 uvcvideo
videobuf2_memops       13202  1 videobuf2_vmalloc
snd_page_alloc         18710  2 snd_pcm,snd_hda_intel
videobuf2_core         40513  1 uvcvideo
videodev              129260  2 uvcvideo,videobuf2_core
snd_seq_midi           13324  0
coretemp               13355  0
arc4                   12615  2
snd_seq_midi_event     14899  1 snd_seq_midi
snd_rawmidi            30180  1 snd_seq_midi
kvm_intel             132891  0
joydev                 17377  0
snd_seq                61554  2 snd_seq_midi_event,snd_seq_midi
iwldvm                241834  0
kvm                   443165  1 kvm_intel
mac80211              606411  1 iwldvm ||||||||||||||||||||
acer_wmi               32467  0
ideapad_laptop         18394  0          |||||||||||||||||
snd_seq_device         14497  3 snd_seq,snd_rawmidi,snd_seq_midi
ghash_clmulni_intel    13259  0
snd_timer              29425  2 snd_pcm,snd_seq
cryptd                 20373  1 ghash_clmulni_intel
mei                    41158  0
sparse_keymap          13890  2 acer_wmi,ideapad_laptop
iwlwifi               173477  1 iwldvm ||||||||||||||||||||||||||
bnep                   18036  2
lpc_ich                17061  0
mac_hid                13205  0
dm_multipath           22843  0
psmouse                95870  0  |||||||||||||||||||||||||
rfcomm                 42641  4
bluetooth             228619  10 bnep,rfcomm
scsi_dh                14843  1 dm_multipath
serio_raw              13215  0
snd                    68876  12 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_seq,snd_rawmidi,snd_hda_codec,snd_hda_intel,snd_seq_device
cfg80211              510937  3 iwlwifi,mac80211,iwldvm
soundcore              12680  1 snd
microcode              22881  0
squashfs               36522  1
overlayfs              28003  1
nls_iso8859_1          12713  1
dm_raid45              76725  0
xor                    17116  1 dm_raid45
dm_mirror              21946  0
dm_region_hash         20820  1 dm_mirror
dm_log                 18529  3 dm_region_hash,dm_mirror,dm_raid45
usb_storage            57204  1
hid_generic            12540  0
usbhid                 47074  0
hid                   101002  2 hid_generic,usbhid
i915                  600303  2
r8169                  67446  0   |||||||||||||||||||||||||||||||||||||||||||||
wmi                    19070  1 acer_wmi
video                  19390  2 i915,acer_wmi
i2c_algo_bit           13413  1 i915
drm_kms_helper         49394  1 i915
ahci                   25731  2   ||||||||||||||||||||||
libahci                31364  1 ahci
drm                   286313  3 i915,drm_kms_helper
==================Kernel unsure========================
Blo
│ │               Partition Types  --->     
Pow
Turbo mode  CPU Frequency Scaling ????? (1+3+2mod)
Intel chipset idle memory power saving driver  -- CONFIG_I7300_IDLE (mod)

                 --- ACPI (Advanced Configuration and Power Interface) Support       
  │ │                 [*]   Deprecated /proc/acpi files                                                       
  │ │                 [*]   Deprecated power /proc/acpi directories                                           
  │ │                 < >   EC read/write access through /sys/kernel/debug/ec                               
  │ │                 [*]   Deprecated /proc/acpi/event support

Pro
│ │                 [*] EFI runtime service support                              
  │ │                 [ ]   EFI stub support    

 │                 [*] Check for low memory corruption                           
  │ │                 [*]   Set the default setting of memory_corruption_check
 
              
Bus
 │ │         [ ] PCI PRI support                                  
  │ │         [ ] PCI PASID support   

Net
│         <*>   Bluetooth subsystem support  --->

DD
hdmi(not open)

│        Input device support
  │         -*-   Support for memoryless force-feedback devices

│         -*- LED Support  --->     

│         [*] EDAC (Error Detection And Correction) reporting  --->   

│         < > MMC/SD/SDIO card support  --->   
==================Kernel confirmed========================
Pro
  │ │                 [*] IBM Calgary IOMMU support         
  │ │                 [*]   Should Calgary be enabled by default?  
disabled for
[    0.000000] Calgary: detecting Calgary via BIOS EBDA area
[    0.000000] Calgary: Unable to locate Rio Grande table in EBDA - bailing!
int __init detect_calgary(void)

 │         [*] Numa Memory Allocation and Scheduler Support      
  │ │         [ ] Old style AMD Opteron NUMA detection        
  │ │         [*] ACPI NUMA detection                                            
  │ │         [ ] NUMA emulation                           
  │ │         (4) Maximum NUMA Nodes (as a power of 2)        
disabled for
[    0.000000] No NUMA configuration found
/**
 * dummy_numa_init - Fallback dummy NUMA init
 *
 * Used if there's no underlying NUMA architecture, NUMA initialization
 * fails, or NUMA is disabled on the command line.
 *
 * Must online at least one node and add memory blocks that cover all
 * allowed memory.  This function must not fail.
 */
static int __init dummy_numa_init(void)
{
    printk(KERN_INFO "%s\n",
           numa_off ? "NUMA turned off" : "No NUMA configuration found");
void __init x86_numa_init(void)