Linux compilation | Invalid entrypoint

后端 未结 1 645
萌比男神i
萌比男神i 2021-01-20 02:43

I am compiling a linux kernel using mipsel toolchain.

Everything works fine except at the very last point which states invalid entry point:

sh: 0: Can\         


        
1条回答
  •  走了就别回头了
    2021-01-20 02:59

    This looks like a path issue caused by improper value of an environment variable.
    The error message sh: 0: Can't open /arch/mips/boot/tools/entry is a full path relative to /, i.e. the root directory, instead of correctly specifying where your kernel source is actually stored, e.g. /home/your_username/rg300_kernel/arch/mips/boot/tools/entry.

    Question: What exactly generates kernel entry point and what potentially could be done to fix the issue?

    The issue is not the script itself, but rather how the script is invoked.
    The directory path to where your kernel source resides is incorrectly specified.
    Because the script is never found and executed, there is no value provided for the -e option for specifying the entry point.
    Consequently the mkimage utility (incorrectly) complains of an "invalid entry point", but the actual problem is that no value was obtainable because the script was never located & executed.


    The salient text for specifying the path of the script is:

    $(KBUILD_SRC)/$(obj)/tools/entry
    

    Your build output indicates that the obj environment variable is correctly set to arch/mips/boot.
    But KBUILD_SRC seems to be incorrectly set to just / (the root directory) or is blank (???!!!) or is undefined, rather than something like /home/your_username/rg300_kernel or whatever the correct path is.

    For a workaround you could try replacing variable KBUILD_SRC with srctree in arch/mips/boot/Makefile:

     uImage: $(VMLINUX) vmlinux.bin
         rm -f $(obj)/vmlinux.bin.gz
         gzip -9 $(obj)/vmlinux.bin
         mkimage -A mips -O linux -T kernel -C gzip \
    -        -a $(LOADADDR) -e $(shell sh $(KBUILD_SRC)/$(obj)/tools/entry $(NM) $(VMLINUX) ) \
    +        -a $(LOADADDR) -e $(shell sh $(srctree)/$(obj)/tools/entry $(NM) $(VMLINUX) ) \
             -n 'Linux-$(KERNELRELEASE)' \
             -d $(obj)/vmlinux.bin.gz $(obj)/uImage
         @echo '  Kernel: arch/mips/boot/$@ is ready' 
    

    Variable srctree appears to be derived from KBUILD_SRC (in the top-level kernel Makefile), and using it as a substitution is really a WAG for a workaround.
    Perhaps somewhere KBUILD_SRC is getting clobbered or not exported, but makefiles (and scripts) is not my expertise so I am unable to explain the underlying cause.

    0 讨论(0)
提交回复
热议问题