📄 编译linux.txt
字号:
(1)安装toolchain,2.4.19指定用gcc2.95.3(见Readme)
bash# cd /usr/local
bash# mkdir arm
bash# cd arm
bash# tar Ixvf cross-2.95.3.tar.bz2
Add /usr/local/arm/2.95.3/bin to your path to use the cross compiler
(2)编译Linux
bash$ su
Password:
bash# cd /usr/src
bash# mkdir arm
bash# chown myuser.mygroup arm
bash# exit
bash$
(3)
First of all, as you are not compiling the kernel natively, you need to modify the top level
kernel makefile. You will need to change the definition of "ARCH" and "CROSS_COMPILE". Replace
the line starting with ARCH := with ARCH := arm.
Set the starting with CROSS_COMPILE = to be the path and prefix to your compiler tools (eg, CROSS_COMPILE = /usr/local/arm/2.95.3/bin/arm-linux-).
(4)
bash$ make at91rm9200dk_config(必须步骤)
bash$ make oldconfig (直接执行.config脚本,不会出现配置画面)这两步等同于下面一步
If you want to further customize your kernel configuration your use either "make menuconfig" which will display a text configuration browser inside your shell or "make xconfig" which will pop up a TCL/TK interface. We choose here to use "make xconfig" because it's very simple and intuitive.
bash$ make xconfig(这步和上面的是互斥的,一种即可,如果.config存在会读入作为默认值)
(5)
bash$ make clean
bash$ make dep
bash$ make Image
A "vmlinux" file is created in the kernel source directory (where you compiled ofcourse) which leads to the next step : building the uImage. But before you proceed you need to know where the "mkimage" binary is. You can usually find it in U-Boot source distribution. the operation goes like this :
生成vmlinux
Once done, you need to build an uImage from your kernel.
(6)
In order to build an uImage you have to make an uncompressed Image of your kernel, then you have to type the following command when you compile your kernel on your host PC :
[ root @PCLinux ~/linux-2.4.19] /usr/local/arm/2.95.3/bin/arm-linux-objcopy -O binary -S vmlinux linux.bin
[ root @PCLinux ~/linux-2.4.19] gzip -v9 linux.bin
[ root @PCLinux ~/linux-2.4.19] mkimage -A arm -O linux -C gzip -a 0x20008000 -e 0x20008000 -d linux.bin.gz uImage
At this time a "uImage" file is created in the current directory. All you have to do now is to copy this file in your TFTP server directory :
[ root @PCLinux ~/linux-2.4.19] cp uImage /tftpboot/AS/
Note: You can write a script with all these
关于make
make mrproper 是清理代码树的动作,保证源代码是干净的
make config是纯文本方式界面配置
make menuconfig是以文本菜单方式配置
make xconfig是以图形界面方式配置
make oldconfig
make config — 互动文本程序。组件以线形格式出现,并被一个一个地回答。这种方法不需要运行 X 窗口系统,而且不允许你改变对前面问题的回答。
make xconfig — 这种方法要求 X 窗口系统和 tk 软件包。我们不推荐你使用这种方法,因为它不能可靠地解析配置文件。
make oldconfig — 这是一个读取现存配置文件(.config)的非互动脚本,它只提示你回答以前没有的新问题。
其实make oldconfig和make menuconfig差不多,都会读取以前的.config文件,但是make oldconfig是非交互的,除非碰到未设置的选项
才会提示输入。
主目录下的makefile里面又包含了include arch/$(ARCH)/Makefile
make at91rm9200dk_config是调用arch/$(ARCH)/Makefile里面的规则,将主目录下面的.config备份为.config.old。然后
将arch/arm/def-configs/$$CFG下的配置文件拷贝为主目录的.config文件
配置项都是放在config.in里面的。.config文件是保存配置生成的结果。
下载
解压
将patch文件拷贝linux目录下,patch -p1 < xxxxx
make at91热敏200_config(生成.config文件)
make oldconfig(产生真正的动作)或make menuconfig
make dep
make Image
/usr/local/arm/2.95.3/bin/arm-linux-objcopy -O binary -S vmlinux linux.bin
gzip -v9 linux.bin
/usr/local/uboot/mkimage -A arm -O linux -C gzip -a 0x20008000 -e 0x20008000 -d
linux.bin.gz uImage
cp uImage /samba/company/Computer/tftp/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -