定制最简linux和根文件系统(平台龙芯1B开发板) 联系客服

发布时间 : 星期四 文章定制最简linux和根文件系统(平台龙芯1B开发板)更新完毕开始阅读ade2f25102768e9950e73814

4.1. 配置

4.1.1. 首先拷贝源码,并解压

[root@localhost test]# ls

1b-linux-3.0-d8b47bb.tar.gz busybox-1.19.2-default busybox-1.19.2-default.tar.gz [root@localhost test]# tar -zxf 1b-linux-3.0-d8b47bb.tar.gz [root@localhost test]# ls

1b-linux-3.0-d8b47bb busybox-1.19.2-default 1b-linux-3.0-d8b47bb.tar.gz busybox-1.19.2-default.tar.gz [root@localhost test]# cd 1b-linux-3.0-d8b47bb [root@localhost 1b-linux-3.0-d8b47bb]# ls

arch crypto fs Kbuild MAINTAINERS README security virt

block Documentation include Kconfig Makefile REPORTING-BUGS sound COPYING drivers init kernel mm samples tools CREDITS firmware ipc lib net scripts usr [root@localhost 1b-linux-3.0-d8b47bb]#

4.1.2. 不安装Ncurses

我是直接登录的字符界面,没有进入图形界面,也没安装Ncurses。而是直接make menuconfig

13

4.1.3. 没有拷贝.config

如果您是全新移植的话,需要拷贝.config,因为我用的是开发板光盘中的内核,本来就是移植配置好的,这里不需要这步。

[root@localhost 1b-linux-3.0-d8b47bb]# ls -a

. arch .config CREDITS Documentation firmware .gitignore init Kbuild kernel .mailmap Makefile net REPORTING-BUGS scripts sound usr

.. block COPYING crypto drivers fs include ipc Kconfig lib MAINTAINERS mm README samples security tools virt [root@localhost 1b-linux-3.0-d8b47bb]#

4.1.4. 不用修改Makefile

和.config一样,开发板光盘中的内核是配置移植好的,不用再修改Makefile了。不信请看

# CROSS_COMPILE specify the prefix used for all executables used # during compilation. Only gcc and related bin-utils executables # are prefixed with $(CROSS_COMPILE).

# CROSS_COMPILE can be set on the command line # make CROSS_COMPILE=ia64-linux-

# Alternatively CROSS_COMPILE can be set in the environment. # A third alternative is to store a setting in .config so that plain # \# Default value for CROSS_COMPILE is not to prefix executables

# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile export KBUILD_BUILDHOST := $(SUBARCH) ARCH ?= mips#$(SUBARCH)

CROSS_COMPILE ?= mipsel-linux-#$(CONFIG_CROSS_COMPILE:\#CROSS_COMPILE

mipsel-loongson-linux-gnu-#mipsel-linux-#$(CONFIG_CROSS_COMPILE:\

# Architecture as present in compile.h UTS_MACHINE := $(ARCH) SRCARCH := $(ARCH)

现在开始配置,执行make menuconfig

?=

4.1.5. 配置选项简述

CPU平台配置

Machine selection --->

14

System type (Loongson family of machines) --->

(X) Loongson family of machines Machine Type (Loongson 1B board) --->

(X) Loongson 1B board

LCD配置

Device Drivers --->

Graphics support --->

[ ] Support for frame buffer devices --->

触屏配置

Device Drivers --->

[ ] SPI support --->

Input device support --->

[ ] Touchscreens --->

鼠标键盘配置

Device Drivers --->

Input device support --->

[ ] Keyboards ---> [ ] Mouse interface [ ] USB support ---> 网卡配置

Device Drivers --->

[ ] Network device support ---> 声卡配置

Device Drivers --->

[ ] Sound card support --->

串口配置

Device Drivers --->

Character devices --->

Serial drivers --->

[*] 8250/16550 and compatible serial support

[*] Console on 8250/16550 and compatible serial port (6) Maximum number of 8250/16550 serial ports

(6) Number of 8250/16550 serial ports to register at runtime

RAMDISK文件系统 Device Drivers --->

[*] Block devices --->

[*] RAM block device support

15

(16) Default number of RAM disks (65536) Default RAM disk size (kbytes) General setup --->

[*] Initial RAM filesystem and RAM disk (initramfs/initrd) support (/nfsramdisk/LS1B) Initramfs source file(s) (0) User ID to map to 0 (user root) (NEW) (0) Group ID to map to 0 (group root) (NEW) [*] Support initial ramdisks compressed using gzip (NEW) 保存退出

4.2. 编译

刚才配置好了,这里编译只需make一下就可以了 [root@localhost 1b-linux-3.0-d8b47bb]# make

然后,慢慢等,直到编译完成。 LD .tmp_vmlinux2 KSYM .tmp_kallsyms2.S AS .tmp_kallsyms2.o LD vmlinux

SYSMAP System.map

SYSMAP .tmp_System.map

CC arch/mips/boot/compressed/dummy.o OBJCOPY arch/mips/boot/compressed/vmlinux.bin GZIP arch/mips/boot/compressed/vmlinux.bin.z OBJCOPY arch/mips/boot/compressed/piggy.o LD vmlinuz STRIP vmlinuz

[root@localhost 1b-linux-3.0-d8b47bb]# ls -l vmlinu* -rwxr-xr-x 1 root root 8520259 08-29 14:07 vmlinux -rw-r--r-- 1 root root 10324555 08-29 14:07 vmlinux.o -rwxr-xr-x 1 root root 3419144 08-29 14:07 vmlinuz [root@localhost 1b-linux-3.0-d8b47bb]#

这时候,编译完成了。

16