HOWTO AMD64
出自Gentoo Linux Wiki
| 安装方法 • 架构/平台 • 内核 & 硬件 • Portage • 系统相关 • 网络 & 服务器 • X服务器 • 软件 • 游戏 • 非x86平台 |
目录 |
[编辑] 说明
我们 Gentoo 用户 (是的 , 那些 SUSE, Mandriva, and Debian 还有其他发行版也可以,虽然有点勉强) 可以建立一个原生的64位操作系统。但是不要以为会像x86的系统一样的简单或者有许多可用的软件包;AMD64 Gentoo有许多的方面不同,以至于在两台机器上成功安装过Gentoo后,我花了大约一周的时间才把这些掌握好。另外,有很多的软件还不支持64位。
[编辑] 不支持64位的软件
- 在AMD64系统上,如果你喜欢玩游戏,那么你必须安装 emul libraries: emul-linux-x86-soundlibs, emul-linux-x86-sdl。
- IMPORTANT notice about emul-linux-x86-soundlibs: check that the alsa libraries provided by this emulation package are the same as the native ones. For reference: 2.3 has version 1.0.10 and 2.4 has version 1.0.11. So, until an emulation package with version major than 1.0.11 is released, it's better for you to use alsa 1.0.11 with emulation libraries 2.4. Otherwise you will obtain weird errors for some configurations.
- If you have an nForce250 chipset with gigabit, you need kernel 2.6.8 or later.
- If you want to view video clips, you may run into problems with some file formats. That's due to the fact a lot of people use win32codecs package that MPlayer and Xine can use :codec dlls from windows which are not available as 64-bit versions yet, but there are open source codecs too, especially in the MPlayer project. You can also look into the chroot below or mplayer-bin as workarounds to the 32-bit binary codec problem.
- 如果你在使用 Mozilla 或者 Firefox ,有些插件还不支持64位。最有名的是 Adobe 的 flash 插件。有一个开源的替代品是 gnash 但是还不支持某些新版本的 flash 。Adobe Flash 也可以在预编译的 Firefox 上使用,方法如下 。 (There is a petition: http://www.petitiononline.com/lin64swf/petition.html) 。但是还有一个可能的方法可以在64位的浏览器上使用32位的插件,试试这里的 NSpluginwrapper。
- 如果你想要使用 Adobe Acrobat Reader,-Acrobat Reader 7 在AMD64上运行良好,唯一的问题是它的浏览器插件不可以在64位的浏览器上使用。KDE的 KPDF 可以 Konqueror在运行, 虽然不支持所以特性,但也许是更好的选择(至少支持书签,个人推荐)
- Java is no longer a problem as it was opened recently.
[编辑] Force building of unsupported applications
For some applications that have not yet been tested for the amd64 architecture, it might work to force building them by specifying the ~x86 keyword. It worked for:
- sys-apps/915resolution-0.5.2 --Langec 12:33, 26 September 2006 (UTC)
- app-emacs/muse-3.02.6b --24.176.68.145 22:33, 20 October 2006 (UTC)
- app-emacs/planner-3.4.0 --24.176.68.145 22:33, 20 October 2006 (UTC)
- x11-misc/autocutsel-0.8.1, but autocutsel randomly crashes. --24.176.68.145 22:33, 20 October 2006 (UTC)
If it works, please submit a bug on http://bugs.gentoo.org to make developers aware of it.
[编辑] Helpful Tips & Tricks
- If you use the below steps to create an x86 chroot, you can create 32-bit binary packages of any program for your 64-bit environment by emerging the packages in the chroot using "emerge --buildpkgonly," and then installing them in the native environment using "emerge --usepkgonly". If the /usr/portage directory is mounted in the chroot, then the binary packages will be installed in the default "/usr/portage/packages" for both, and nothing further is required. You might also want to use --oneshot, to prevent the packages from being recorded in the world file. It is not advisable to create libraries in this way, however, as the two environments use a different series of directories (/usr/lib in the chroot is /usr/lib32 in the native environment) to handle libraries.
- If you have a Tyan board using the tg3 module for the network adapter, and it fails to install correctly, add the dummy module immediately before it. This will add a dummy network adapter, but you don't need to configure it or do anything with it. You will notice that the tg3 module now loads correctly.
- If the system hangs on boot during hotplug, don't use hotplug by adding the nohotplug option on the kernel load line in your boot loader (note: this assumes you are using Genkernel to generate your kernels). Be sure to rc-update del hotplug so that it doesn't run it during boot.
- If you have a Shuttle SN85G4, you'll need to pass the noapic option to the kernel in order for the kernel to see your SATA disk(s). Without this option, the kernel detects the 6-in-1 card reader, and fails to detect the SATA disk as a disk.
- You may run into the following problems when booting the live cd with an MSI K8T Neo2 (FIR) board:
- The SATA drivers for the VIA controller are not loaded automatically
- The command modprobe sata_via hangs
- The solution is the noapic kernel option. After that the drivers are not loaded automatically, but you can at least modprobe.
- This seems to be a problem with the kernel version of the LiveCD, because with my currently running system I don't need that option anymore.
- The MSI K8N Neo Platinum motherboard needs the noapic option passed to the LiveCD (2004.3), otherwise you will get all sorts of I/O errors and segfaults. With that you should install without problems.
- On the DFI Lanparty motherboards and other NForce 4 Chipsets with Vitesse VSC8201 Gigabit and Marvell 88E8001 Gigabit you can use modprobe forcedeth to load the open source drivers if the network interface is not detected.
- Partimage does also not work. I dont know any workaround, only way use an other 32bit-linux or a LiveCD.
[编辑] OpenOffice-bin (32 bits)
If you get the following error while trying to launch OpenOffice-bin
Inconsistency detected by ld.so: ../sysdeps/generic/dl-tls.c: 72: _dl_next_tls_modid: Assertion `result <= _rtld_local._dl_tls_max_dtv_idx' failed!
The solution is to delete or move a /usr/lib32/opengl/nvidia/lib/libGL.so.1.0.x file. Or you may want to remove the /usr/lib32/opengl/nvidia/ directory altogether.
Note that you may also need to (manually) install a 32 bits JVM (such as Sun's JRE).
[编辑] 建立一个32位chroot环境
运行32位程序的时候,你需要一个32位的环境。建立一个32位的 chroot 环境可以解决这个问题,其中包括在你的AMD64系统中安装另一个gentoo系统。
首先,你要打开内核的 IA32 emulations 支持,在 Processor Types and Features 。如果你使用gentoo官方内核 (对 nVidia 芯片组的主板相当有用),你可以在这里找到 Executabile file formats / Emulations.
这里有相关的官方文档: 32 bit Compatibility
你需要还安装 emul-linux libaries 命令如下 :
emerge app-emulation/emul-linux-x86-baselibs app-emulation/emul-linux-x86-xlibs \ app-emulation/emul-linux-x86-gtklibs app-emulation/emul-linux-x86-qtlibs
新建一个目录用来安装新的Gentoo:
mkdir /mnt/gentoo32
从http://www.gentoo.org/main/en/mirrors.xml中下载一个 Gentoo stage 并解压到 chroot 目录:
cd /mnt/gentoo32 wget <PACKAGE_URL> tar -xvjpf stage?-*.tar.bz2
在stage 中没有portage 目录,自己建立一个:
mkdir -p /mnt/gentoo32/usr/portage
当你的32位chroot安装好后,你可以这样进入:
linux32 chroot /mnt/gentoo32 /bin/bash --login
如果遇到权限问题或者找不到目录之类的错误,检查一下 gentoo32 目录挂载时是否有使用 rw,exec,dev,uid 选项。用这个命令检查:
# mount -l
如果没有的话,确认一下是否只有 noatime 一个文件系统选项。检查 /etc/fstab.
There are some files, directories and mount points that need to be accessible from your 32-bit chroot enviroment; this includes the /tmp directory as XOrg uses this directory for its sockets, and common configuration files such as /etc/hostname. The following is a script that should handle most of these, you may need to modify it to suit your needs:
| 文件: /etc/init.d/gentoo32 |
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#NB: Config is in /etc/conf.d/gentoo32
depend() {
need localmount
need bootmisc
}
checkconfig() {
if [ -z "${GENTOO32_CHROOT}" ] ; then
eerror "You need to setup GENTOO32_CHROOT in /etc/conf.d/gentoo32 first"
return 1
fi
if [ ! -d "${GENTOO32_CHROOT}" ] ; then
eerror "You need to setup GENTOO32_CHROOT in /etc/conf.d/gentoo32 to a valid directory"
return 1
fi
}
start() {
checkconfig || return 1
ebegin "Mounting 32bits chroot dirs"
mount -o bind /dev ${GENTOO32_CHROOT}/dev >/dev/null && \
mount -o bind /dev/pts ${GENTOO32_CHROOT}/dev/pts >/dev/null && \
mount -o bind /dev/shm ${GENTOO32_CHROOT}/dev/shm >/dev/null && \
mount -o bind /proc ${GENTOO32_CHROOT}/proc >/dev/null && \
mount -o bind /proc/bus/usb ${GENTOO32_CHROOT}/proc/bus/usb >/dev/null && \
mount -o bind /sys ${GENTOO32_CHROOT}/sys >/dev/null && \
mount -o bind /tmp ${GENTOO32_CHROOT}/tmp >/dev/null && \
mount -o bind /usr/portage ${GENTOO32_CHROOT}/usr/portage/ >/dev/null &
eend $? "An error occured while attempting to mount 32bit chroot directories"
ebegin "Copying 32bits chroot files"
cp -pf /etc/resolv.conf ${GENTOO32_CHROOT}/etc >/dev/null &
cp -pf /etc/passwd ${GENTOO32_CHROOT}/etc >/dev/null &
cp -pf /etc/shadow ${GENTOO32_CHROOT}/etc >/dev/null &
cp -pf /etc/group ${GENTOO32_CHROOT}/etc >/dev/null &
cp -pf /etc/shadow ${GENTOO32_CHROOT}/etc >/dev/null &
cp -pf /etc/hosts ${GENTOO32_CHROOT}/etc > /dev/null &
cp -Ppf /etc/localtime ${GENTOO32_CHROOT}/etc >/dev/null &
eend $? "An error occured while attempting to copy 32 bits chroot files."
}
stop() {
ebegin "Unmounting 32bits chroot dirs"
umount -f ${GENTOO32_CHROOT}/usr/portage/ >/dev/null && \
umount -f ${GENTOO32_CHROOT}/tmp >/dev/null && \
umount -f ${GENTOO32_CHROOT}/sys >/dev/null && \
umount -f ${GENTOO32_CHROOT}/proc/bus/usb >/dev/null && \
umount -f ${GENTOO32_CHROOT}/proc >/dev/null && \
umount -f ${GENTOO32_CHROOT}/dev/shm >/dev/null && \
umount -f ${GENTOO32_CHROOT}/dev/pts >/dev/null && \
umount -f ${GENTOO32_CHROOT}/dev >/dev/null &
eend $? "An error occured while attempting to unmount 32bits chroot directories"
}
|
Configure the directory for the 32 bit environment:
| 文件: /etc/conf.d/gentoo32 |
# /etc/conf.d/gentoo32 # Point GENTOO32_CHROOT to a valid chroot environment GENTOO32_CHROOT="/mnt/gentoo32" |
This will also bind the /usr/portage directry, this way running emerge --sync only needs to be done once to update both systems, also the distfiles directory will be shared saving on downloads.
You can make this script run automatically at bootup with the following:
chmod +x /etc/init.d/gentoo32 rc-update add gentoo32 default
Now, leave the chrooted environment. To run applications installed in chroot as non-priviledged user, install dchroot:
emerge -av dchroot
and add info about your 32-bit chroot location to /etc/dchroot.conf:
echo "gentoo32 /mnt/gentoo32" >> /etc/dchroot.conf
Since dchroot can run only scripts (it will complain on running binary files), there is a little workaround:
First, create a script my_app32 under x86_64 gentoo (/usr/bin/my_app should be the path and name of the application you want to run from 32-bit chroot):
| 文件: /usr/local/bin/my_app32 |
#!/bin/bash xhost local:localhost linux32 dchroot -c gentoo32 /usr/local/bin/32run.sh /usr/bin/my_app |
Then, create a helper script 32run.sh in 32-bit chroot environment:
| 文件: /mnt/gentoo32/usr/local/bin/32run.sh |
#!/bin/sh exec "$@" |
Now, you should be able to start "my_app" compiled in 32-bit chroot environment directly by executing /usr/local/my_app32 in regular x86_64 environment.
See also: HOWTO on gentoo.org:
- http://www.gentoo.org/proj/en/base/amd64/howtos/index.xml?part=1&chap=2 (new version)
- http://www.gentoo.org/proj/en/base/amd64/technotes/index.xml?part=1&chap=4 (old version, deprecated)
[编辑] Reiser4 and AMD64
Reiser4 has just recently been updated to work on AMD64 system, however a newer kernel is required. The following are a list of kernels that are reported to work with Reiser4 and AMD64, please note that these kernels (and Reiser4) are experimental and may cause problems:
mm patchset: 2.6.14* beyond-sources: 2.6.16* cko-sources: 2.6.12-cko3
To install Gentoo 64-bit from scratch with Reiser4:
[编辑] Mplayer and 32bit codecs
Add this to your /etc/portage/package.keywords:
media-video/mplayer-bin ~amd64 media-libs/win32codecs ~amd64 app-emulation/emul-linux-x86-medialibs ~amd64
When you wish to play a video file start MPlayer with MPlayer32 or gmplayer32 if you want a GUI. gmplayer32 for some reason seems to work better than MPlayer32.
(05 Feb 2006: It's mplayer-bin and gmplayer-bin instead of mplayer32 and gmplayer32 at this time)
- If you get a -vo error stating:
/dev/mga_vid couldn't be found
- try -vo xv.
- If you get an error stating:
Win32 LoadLibrary failed to load: wmvdmod.dll /usr/lib/win32/wmvdmod.dll, /usr/local/lib/win32/wmvdmod.dll
- or similar, make a link to lib32 directory:
ln -s /usr/lib32/win32 /usr/lib/win32
[编辑] RealPlayer
Emerge media-sound/alsa-driver with the oss USE flag:
echo "media-sound/alsa-driver oss" >> /etc/portage/package.use emerge -av media-sound/alsa-driver /etc/init.d/alsasound restart
Emerge media-video/realplayer:
emerge -av media-video/realplayer
Lauch RealPlayer:
realplay
Turn off XVideo: Tools » Preferences » Hardware » Use XVideo
[编辑] Radeon 3D-acceleration in 32-bit programs
Getting 3D acceleration working with ATI Radeon requires proprietary drivers and some 32-bit programs must be enabled with the correct GL-drivers setting.
Before you run your game, you should export the proper LIBGL_DRIVERS_PATH environment variable:
export LIBGL_DRIVERS_PATH=/usr/X11R6/lib32/modules/dri
or just run the game/program with the variable included in the command:
LIBGL_DRIVERS_PATH=/usr/X11R6/lib32/modules/dri enemy-territory
