制作Loongson版Debiansqueeze系统
2012-11-21
1.背景
本文档试图通过官方源码为龙芯2F笔记本制作Debiansqueeze系统。
需要的设备:
2.制作squeeze基本系统(在龙芯母机上运行)
2.1下载基本系统
2.2设置root密码:
3.制作内核
3.1使用源码安装内核(在X86母机上运行)
3.1.1制作编译内核的交叉工具链
采用gcc4.4.4+binutils-2.20.1,请在gnu网站上自行下载
mkdir toolchain
cd toolchain
wget gcc4.4.4.tar.bz2和binutils-2.20.1.tar.bz2
编译binutils-2.20.1,vimake-binutils.sh,写入如下内容:
#!/bin/sh
cross_host="x86_64-linux-gnu"
cross_target="mips64el-linux"
dell_install_path="/Your-Install-Path/install"
binutils_version="binutils-2.20.1"
binutils_suffix=".tar.bz2"
#mkdir -pv ./install
# build binutils-2.20
if [ ! -e ./$binutils_version ]; then
fi
if [ -e ./build-binutils ]; then
fi
mkdir -pv ./build-binutils
cd build-binutils
../$binutils_version/configure--prefix=$dell_install_path
--build=$cross_host --host=$cross_host--target=$cross_target
--enable-shared --disable-werror -v \
&& make \
&& make install
cd ../
echo "End of building binutilstoolchain"
运行../make-binutils.sh,如果在configure过程中停掉,请安装相应包,并重新执行
编译gcc-4.4.4,vimake-gcc.sh,写入以下内容:
#!/bin/sh
cross_host="x86_64-linux-gnu"
cross_target="mips64el-linux"
dell_install_path="/Your-Install-Path/install"
gcc_version="gcc-4.4.4"
gcc_suffix=".tar.bz2"
sudo apt-get install libgmp-dev libmpfr-devlibmpc-dev
if [ ! -e ./$gcc_version ]; then
fi
if [ -e ./build-gcc ]; then
fi
mkdir -pv ./build-gcc
cd ./build-gcc
env
../$gcc_version/configure--prefix=$dell_install_path
--build=$cross_host --host=$cross_host--target=$cross_target
--disable-shared --enable-languages=c--disable-threads--disable-werror
-v \
&& make all-gcc -j4\
&& make install-gcc
cd ../
运行../make-gcc.sh,如果在configure过程中停掉,请安装相应包,并重新执行
3.1.2编译龙芯2F笔记本的内核
从官方下载最新内核源码,例如linux-3.5.1.tar.bz2
tar xf linux-3.5.1.tar.bz2
cd linux-3.5.1
cp arch/mips/configs/lemote2f_defconfig./.config
make ARCH=mips menuconfig, 检查一下并退出
make ARCH=mipsCROSS_COMPILE=/Your-Install-Path/install/bin/mips64el-linux-
3.2使用apt安装内核((在龙芯母机上运行,未测试)
chroot ./chroot-squeeze
vi /etc/apt/sources.list,写入以下内容:
debhttp://linux-libre.fsfla.org/pub/linux-libre/lemote/gnewsense metadmain
保存退出
wget http://www.fsfla.org/svnwiki/selibre/linux-libre/download/SIGNING-KEY
apt-key add SIGNING-KEY
apt-get update
apt-cache search linux-image loongson
最后用apt-getinstall安装有loongson 2f字样的内核包
4.制作系统硬盘(需要将龙芯2F笔记本的硬盘接入X86母机或者龙芯母机,然后在母机上操作)
假设龙芯2F笔记本的硬盘(以sata硬盘为例)分区sdb1(sda为已有硬盘)为系统安装分区,大小至少需要5G
mkfs.ext3 /dev/sdb1
mount /dev/sdb1 /mnt
cp -af ./chroot-squeezedebian/patches/
wgethttp://jasonwoof.com/downloads/01_mips-sarea.diff
其中01_mips-sarea.diff的内容如下:
diff -urNxorg-server-1.3.0.orig/hw/xfree86/dri/sarea.hxorg-server-1.1.1/hw/xfree86/dri/sarea.h
---xorg-server-1.3.0.orig/hw/xfree86/dri/sarea.h
+++xorg-server-1.3.0/hw/xfree86/dri/sarea.h
@@ -44,6 +44,8 @@
+#elif defined(__mips__)
+#defineSAREA_MAX
diff --gita/hw/xfree86/os-support/linux/lnx_video.cb/hw/xfree86/os-support/linux/lnx_video.c
index 688106a..1552860 100644
---a/hw/xfree86/os-support/linux/lnx_video.c
+++b/hw/xfree86/os-support/linux/lnx_video.c
@@ -505,9 +505,10 @@ _X_EXPORT volatile unsignedchar *ioBase = NULL;
-#if defined(__powerpc__)
+#if defined(__powerpc__) ||defined(__mips__)
+
@@ -532,7 +533,22 @@ xf86EnableIO(void)
-#elif !defined(__mc68000__) &&!defined(__sparc__) && !defined(__mips__) &&!defined(__sh__) && !defined(__hppa__) &&!defined(__s390__) && !defined(__arm__) &&!defined(__m32r__)
+#elif defined(__mips__)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#elif !defined(__mc68000__) &&!defined(__sparc__) && !defined(__sh__) &&!defined(__hppa__) && !defined(__s390__) &&!defined(__arm__) && !defined(__m32r__)
6.4配置xorg.conf
vi/etc/X11/xorg.conf,写入以下内容:
#xorg.conf (X.Org X Window System server configurationfile)
# Thisfile was generated by dexconf, the Debian X Configuration tool,using
#values from the debconf database.
# Editthis file with caution, and see the xorg.conf manualpage.
# (Type"man xorg.conf" at the shell prompt.)
# Thisfile is automatically updated on xserver-xorg package upgrades*only*
# if ithas not been modified since the last upgrade of thexserver-xorg
# Ifyou have edited this file but would like it to be automaticallyupdated
#again, run the following command:
7.安装gnome(在龙芯2F笔记本上操作)
apt-get install gdm3
restart
结束!
参考文献:
http://wiki.debian.org/DebianYeeloong/HowTo/Install