先是将vmlinux的某些段去掉了,生成了Image,比如.comment。
arm-linux-objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S vmlinux arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
然后用gzip压缩Image,成为piggy.gz。
gzip -f -9 < arch/arm/boot/compressed/../Image > arch/arm/boot/compressed/piggy.gz
GZIP arch/arm/boot/compressed/piggy.gz
这个生成piggy.o这么长?先是从piggy.S编译出来一个piggy.o。
arm-linux-gcc -Wp,-MD,arch/arm/boot/compressed/.piggy.o.d -nostdinc -isystem
/home/wyang2/test/usr/local/arm/4.4.1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/include -D__KERNEL__ -Iinclude -I/home/wyang2/test/linux-2.6.28.6/arch/arm/include -include include/linux/autoconf.h -mlittle-endian
-Iarch/arm/mach-s3c6400/include -Iarch/arm/mach-s3c6410/include -Iarch/arm/plat-s3c64xx/include
-Iarch/arm/plat-s3c/include -D__ASSEMBLY__ -mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=6 -march=armv6k -mtune=arm1136j-s -msoft-float -gdwarf-2 -Wa,-march=all -c -o arch/arm/boot/compressed/piggy.o arch/arm/boot/compressed/piggy.S
AS arch/arm/boot/compressed/piggy.o
话说我一直没找到piggy.o和piggy.gz的关系,原来在piggy.S文件里面。它把整个piggy.gz包含进去了,嚣张啊。
.section .piggydata,#alloc
.globl input_data
input_data:
.incbin "arch/arm/boot/compressed/piggy.gz"
.globl input_data_end
input_data_end:
下面是编译head.o, 没有看出有什么特别的地方
arm-linux-gcc -Wp,-MD,arch/arm/boot/compressed/.head.o.d -nostdinc -isystem
/home/wyang2/test/usr/local/arm/4.4.1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/include -D__KERNEL__
-Iinclude -I/home/wyang2/test/linux-2.6.28.6/arch/arm/include -include include/linux/autoconf.h
-mlittle-endian -Iarch/arm/mach-s3c6400/include -Iarch/arm/mach-s3c6410/include -Iarch/arm/plat-s3c64xx/include
-Iarch/arm/plat-s3c/include -D__ASSEMBLY__ -mabi=aapcs-linux -mno-thumb-interwork
-D__LINUX_ARM_ARCH__=6 -march=armv6k -mtune=arm1136j-s -msoft-float -gdwarf-2 -Wa,-march=all
-c -o arch/arm/boot/compressed/head.o arch/arm/boot/compressed/head.S
AS arch/arm/boot/compressed/head.o
下面是编译misc.o 这个老长了
arm-linux-gcc -Wp,-MD,arch/arm/boot/compressed/.misc.o.d -nostdinc -isystem
/home/wyang2/test/usr/local/arm/4.4.1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/include
-D__KERNEL__ -Iinclude -I/home/wyang2/test/linux-2.6.28.6/arch/arm/include
-include include/linux/autoconf.h -mlittle-endian -Iarch/arm/mach-s3c6400/include
-Iarch/arm/mach-s3c6410/include -Iarch/arm/plat-s3c64xx/include -Iarch/arm/plat-s3c/include
-Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Os -marm -fno-omit-frame-pointer -mapcs -mno-sched-prolog
-mabi=aapcs-linux -mno-thumb-interwork -D__LINUX_ARM_ARCH__=6 -march=armv6k -mtune=arm1136j-s
-msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fno-omit-frame-pointer
-fno-optimize-sibling-calls -g -Wdeclaration-after-statement -Wno-pointer-sign -fpic -fno-builtin -Dstatic=
-D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(misc)" -D"KBUILD_MODNAME=KBUILD_STR(misc)"
-c -o arch/arm/boot/compressed/misc.o arch/arm/boot/compressed/misc.c
;
CC arch/arm/boot/compressed/misc.o
根据head.o piggy.o misc.o 编译成 compressed/vmlinux
arm-linux-ld -EL --defsym zreladdr=0x50008000 --defsym params_phys=0x50000100 -p --no-undefined -X /usr/local/arm/4.4.1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/libgcc.a -T arch/arm/boot/compressed/vmlinux.lds arch/arm/boot/compressed/head.o arch/arm/boot/compressed/piggy.o arch/arm/boot/compressed/misc.o -o arch/arm/boot/compressed/vmlinux
LD arch/arm/boot/compressed/vmlinux
#@make -f scripts/Makefile.build obj=arch/arm/boot/compressed arch/arm/boot/compressed/vmlinux
用vmlinux去掉一些符号,生成了 zImage。
arm-linux-objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S arch/arm/boot/compressed/vmlinux arch/arm/boot/zImage
上一篇:ARM架构下添加系统调用与32位x86区别
下一篇:ARM架构下LDR、STR、MOV和伪指令LDR指令理解
推荐阅读最新更新时间:2024-03-16 14:58
设计资源 培训 开发板 精华推荐
- 柔灵科技陈涵:将小型、柔性的脑机接口睡眠设备,做到千家万户
- 微灵医疗李骁健:脑机接口技术正在开启意识与AI融合的新纪元
- USB Type-C® 和 USB Power Delivery:专为扩展功率范围和电池供电型系统而设计
- 景昱医疗耿东:脑机接口DBS治疗技术已实现国产替代
- 首都医科大学王长明:针对癫痫的数字疗法已进入使用阶段
- 非常见问题解答第223期:如何在没有软启动方程的情况下测量和确定软启动时序?
- 兆易创新GD25/55全系列车规级SPI NOR Flash荣获ISO 26262 ASIL D功能安全认证证书
- 新型IsoVu™ 隔离电流探头:为电流测量带来全新维度
- 英飞凌推出简化电机控制开发的ModusToolbox™电机套件
- 意法半导体IO-Link执行器电路板为工业监控和设备厂商带来一站式参考设计