kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* how does objcopy work? and how does the linux kernel process relocation with that stripped off image?
@ 2020-12-18  9:21 ckim
  0 siblings, 0 replies; only message in thread
From: ckim @ 2020-12-18  9:21 UTC (permalink / raw)
  To: kernelnewbies


[-- Attachment #1.1: Type: text/plain, Size: 1672 bytes --]

I saw in a linux build log this command (how to generate from 'vmlinux' to
'Image'),  

 

>
/home/ckim/N1SDP/arm-reference-platforms/tools/gcc/gcc-linaro-6.2.1-2016.11-
x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-objcopy

> -O binary -R .note -R .note.gnu.build-id -R .comment -S vmlinux
arch/arm64/boot/Image

 

so the 'Image' file is generated from 'vmlinux' by objcopy command and about
the -S option, objcopy help says 

    '-S --strip-all                   Remove all symbol and relocation
information' 

 

I checked I can run 'Image' file on the machine and it really boots linux to
some point(I just tested it on qemu-system-aarch64, with -m virt option),
arm support person says the 'Image' file is loaded at 0x40000000 in the
'virt' machine when I passed the 'Image' with -kernel option.(I guess the
qemu knows where to load it..).  

 

My question is, I understand I can load the 'Image' file anywhere on the
memory (because it's position independent code using only relative offsets
for function calls and variable addresses probably,..), and at some point
the kernel itself relocates the kernel image to somewhere else. (In arm64
linux, they don't use compressed kernel, so is it not relocated later in
this case?). How does the kernel program ('Image') relocates the image and
setup the MMU table when there is no symbol or relocation table?  

Can anyone correct my understanding if I'm wrong and explain to me how
objcopy works and how kernel relocation is done in this case?(if it's done).


(I know 'vmlinux' file is ELF file so the loader knows where to load it from
where to start it, but this 'Image' files doesn't have any such
information).


[-- Attachment #1.2: Type: text/html, Size: 4392 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-18  9:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18  9:21 how does objcopy work? and how does the linux kernel process relocation with that stripped off image? ckim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).