Hi all
I am curious about what is the first instruction of the Arm Linux?
From some web, I found they say the first instruction is Arm Linux is just the start section in compressed/head.S. While I still curious why?
From Uboot log, I found the Uboot will download the kernel zImage to an address, 0xc0008000, and then just jump to this address.
Then I try to figure out what the zImage is composed? Below two commands are used to build the zImage.
Code:
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
arm-linux-objcopy -O binary -R .note -R .note.gnu.build-id -R .comment -S arch/arm/boot/compressed/vmlinux arch/arm/boot/zImage
If I don't make a mistake, the objcopy just remove some section, .note, .note.gnu.build-id? So this doestn't affect the image a lot? So the important link thing is done by the first command?
From the lds script,
Code:
.text : {
_start = .;
*(.start)
*(.text)
*(.text.*)
*(.fixup)
*(.gnu.warning)
*(.rodata)
*(.rodata.*)
*(.glue_7)
*(.glue_7t)
*(.piggydata)
. = ALIGN(4);
}
the first section is the "start" section. While in head.S, there is a "start" section. This is the reason why the first instruction is in head.S?