LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   What is the first instruction of Arm Linux? (https://www.linuxquestions.org/questions/linux-kernel-70/what-is-the-first-instruction-of-arm-linux-842982/)

Richard.Yang 11-08-2010 03:23 AM

What is the first instruction of Arm Linux?
 
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?

Richard.Yang 11-08-2010 03:27 AM

BTW, I don't know where these value are set?
Code:

LC0:                .word        LC0                        @ r1
                .word        __bss_start                @ r2
                .word        _end                        @ r3
                .word        zreladdr                @ r4
                .word        _start                        @ r5
                .word        _got_start                @ r6
                .word        _got_end                @ ip
                .word        user_stack+4096                @ sp

seems they are used in kernel.


All times are GMT -5. The time now is 03:16 PM.