how does objcopy work? and how does the linux kernel process relocation with that stripped off image?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).

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

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux