First, some segments of vmlinux are removed and the Image is generated, such as .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
Then use gzip to compress the image into piggy.gz.
gzip -f -9 < arch/arm/boot/compressed/../Image > arch/arm/boot/compressed/piggy.gz
GZIP arch/arm/boot/compressed/piggy.gz
Why is the generated piggy.o so long? First, compile piggy.o from piggy.S.
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
I have never found the relationship between piggy.o and piggy.gz. It turns out that it is in the piggy.S file. It includes the entire piggy.gz. How arrogant!
.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
Compile into compressed/vmlinux according to head.o piggy.o misc.o
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
Use vmlinux to remove some symbols and generate 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
Previous article:Differences between adding system calls under ARM architecture and 32-bit x86
Next article:Understanding of LDR, STR, MOV and pseudo-instructions LDR instructions under ARM architecture
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 【Development and application based on NUCLEO-F746ZG motor】6. Program framework
- Precision Rectification
- 【Lexin Home Smart Butler】Work Submission
- Problems with W5500
- Design of mobile power supply based on MC32P21 microcontroller
- Why choose 50 ohms?
- Study of TMS320F28335 ADC module
- 【CH579M-R1】+A/D acquisition and sensor usage and value display (1)
- State machine model of microcontroller program
- How to quickly configure an industrial-grade 4G router?