LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 11-08-2010, 03:23 AM   #1
Richard.Yang
Member
 
Registered: Sep 2008
Posts: 106

Rep: Reputation: 16
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?
 
Old 11-08-2010, 03:27 AM   #2
Richard.Yang
Member
 
Registered: Sep 2008
Posts: 106

Original Poster
Rep: Reputation: 16
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.

Last edited by Richard.Yang; 11-08-2010 at 07:23 AM.
 
  


Reply

Tags
booting


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compiling debian arm for NSLU2 - arm-linux-gnueabi-objdump not found ergosteur Linux - Kernel 3 10-30-2010 11:24 AM
Compile the linux2.6.14.1 for arm must ues the arm-linux-gcc-3.4.4? frankyue Linux - Embedded & Single-board computer 2 12-20-2008 07:28 AM
So many“Illegal instruction” under Embedded Linux of PowerPC8540 ruger Programming 8 05-03-2007 12:59 PM
Which linux instruction is equivalent to windows' instruction "tracert"? backpacker Linux - Software 1 04-04-2006 10:55 PM


All times are GMT -5. The time now is 04:50 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration