u-boot/lib/lmb.c:154: undefined reference to `_start'

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
machinehum
Posts: 1
Joined: Wed Apr 13, 2022 10:57 am
Libera.chat IRC: @machinehum

u-boot/lib/lmb.c:154: undefined reference to `_start'

Post by machinehum »

I'm trying to upstream support for the Allwinner V5 in u-boot, Linux and eventually Buildroot. I've based several of my changes on the H6 as they are very similar chips. I'm stuck one last linking step regarding the program entry.

Code: Select all

[machinehum@whitebox u-boot]$ make
  CFGCHK  u-boot.cfg
  OFCHK   .config
  UPD     include/generated/timestamp_autogenerated.h
  ENVC    include/generated/env.txt
  ENVP    include/generated/env.in
  ENVT    include/generated/environment.h
  CC      cmd/version.o
  AR      cmd/built-in.o
  CC      env/common.o
  AR      env/built-in.o
  CC      lib/efi_loader/dtbdump.o
  LD      lib/efi_loader/dtbdump_efi.so
  OBJCOPY lib/efi_loader/dtbdump.efi
  CC      lib/efi_loader/initrddump.o
  LD      lib/efi_loader/initrddump_efi.so
  OBJCOPY lib/efi_loader/initrddump.efi
  LD      u-boot
arm-linux-gnueabi-ld.bfd: warning: cannot find entry symbol _start; defaulting to 000000004a000000
arm-linux-gnueabi-ld.bfd: lib/lmb.o: in function `arch_lmb_reserve_generic':
/home/machinehum/projects/u-boot/lib/lmb.c:154: undefined reference to `_start'
make: *** [Makefile:1801: u-boot] Error 1
Here are my changes so far.

Code: Select all

[machinehum@whitebox u-boot]$ git diff
diff --git a/.gitignore b/.gitignore
index 28c439f09f..5579026b61 100644
--- a/.gitignore
+++ b/.gitignore
@@ -58,7 +58,7 @@ fit-dtb.blob*
 /tpl/
 /defconfig
 
-#
+
 # Generated include files
 #
 /include/config/
diff --git a/arch/arm/include/asm/arch-sunxi/clock.h b/arch/arm/include/asm/arch-sunxi/clock.h
index 2cfd540742..c6a0963c59 100644
--- a/arch/arm/include/asm/arch-sunxi/clock.h
+++ b/arch/arm/include/asm/arch-sunxi/clock.h
@@ -19,7 +19,8 @@
 #elif defined(CONFIG_SUN50I_GEN_H6)
 #include <asm/arch/clock_sun50i_h6.h>
 #elif defined(CONFIG_MACH_SUN6I) || defined(CONFIG_MACH_SUN8I) || \
-      defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUNIV)
+      defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUNIV) || \
+      defined(CONFIG_MACH_SUN8I_V5)
 #include <asm/arch/clock_sun6i.h>
 #elif defined(CONFIG_MACH_SUN9I)
 #include <asm/arch/clock_sun9i.h>
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 73da6b8f61..6b3571c471 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -177,7 +177,7 @@ config MACH_SUNXI_H3_H5
 config SUNXI_DRAM_MAX_SIZE
        hex
        default 0x100000000 if MACH_SUN50I_H616
-       default 0xC0000000 if MACH_SUN50I || MACH_SUN50I_H5 || MACH_SUN50I_H6
+       default 0xC0000000 if MACH_SUN50I || MACH_SUN50I_H5 || MACH_SUN50I_H6 || MACH_SUN8I_V5
        default 0x80000000
 
 choice
@@ -319,6 +319,17 @@ config MACH_SUN8I_V3S
        select SUPPORT_SPL
        select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
 
+config MACH_SUN8I_V5
+       bool "sun8i (Allwinner V5)"
+       select CPU_V7A
+       # select CPU_V7_HAS_NONSEC
+       select CPU_V7_HAS_VIRT
+       # select ARCH_SUPPORT_PSCI
+       select SUNXI_DRAM_DW
+       select SUNXI_DRAM_DW_16BIT
+       select SUPPORT_SPL
+       # select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
+
 config MACH_SUN9I
        bool "sun9i (Allwinner A80)"
        select CPU_V7A
@@ -473,7 +484,7 @@ config DRAM_CLK
        default 360 if MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || \
                       MACH_SUN8I_V3S
        default 672 if MACH_SUN50I
-       default 744 if MACH_SUN50I_H6
+       default 744 if MACH_SUN50I_H6 || MACH_SUN8I_V5
        default 720 if MACH_SUN50I_H616
        ---help---
        Set the dram clock speed, valid range 240 - 480 (prior to sun9i),
@@ -496,7 +507,7 @@ config DRAM_ZQ
                       MACH_SUN8I_A23 || MACH_SUN8I_A33 || MACH_SUN8I_A83T
        default 127 if MACH_SUN7I
        default 14779 if MACH_SUN8I_V3S
-       default 3881979 if MACH_SUNXI_H3_H5 || MACH_SUN8I_R40 || MACH_SUN50I_H6
+       default 3881979 if MACH_SUNXI_H3_H5 || MACH_SUN8I_R40 || MACH_SUN50I_H6 || MACH_SUN8I_V5
        default 4145117 if MACH_SUN9I
        default 3881915 if MACH_SUN50I
        ---help---
@@ -509,6 +520,7 @@ config DRAM_ODT_EN
        default y if MACH_SUN8I_R40
        default y if MACH_SUN50I
        default y if MACH_SUN50I_H6
+       default y if MACH_SUN8I_V5
        default y if MACH_SUN50I_H616
        ---help---
        Select this to enable dram odt (on die termination).
@@ -601,7 +613,7 @@ config SYS_CLK_FREQ
        default 816000000 if MACH_SUN50I || MACH_SUN50I_H5
        default 1008000000 if MACH_SUN8I
        default 1008000000 if MACH_SUN9I
-       default 888000000 if MACH_SUN50I_H6
+       default 888000000 if MACH_SUN50I_H6 || MACH_SUN8I_V5
        default 1008000000 if MACH_SUN50I_H616
 
 config SYS_CONFIG_NAME
@@ -610,7 +622,7 @@ config SYS_CONFIG_NAME
        default "sun5i" if MACH_SUN5I
        default "sun6i" if MACH_SUN6I
        default "sun7i" if MACH_SUN7I
-       default "sun8i" if MACH_SUN8I
+       default "sun8i" if MACH_SUN8I || MACH_SUN8I_V5
        default "sun9i" if MACH_SUN9I
        default "sun50i" if MACH_SUN50I
        default "sun50i" if MACH_SUN50I_H6
@@ -1035,7 +1047,7 @@ config SPL_STACK_R_ADDR
 
 config SPL_SPI_SUNXI
        bool "Support for SPI Flash on Allwinner SoCs in SPL"
-       depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || MACH_SUN50I_H6 || MACH_SUNIV
+       depends on MACH_SUN4I || MACH_SUN5I || MACH_SUN7I || MACH_SUNXI_H3_H5 || MACH_SUN50I || MACH_SUN8I_R40 || MACH_SUN50I_H6 || MACH_SUN8I_V5 || MACH_SUNIV
        help
          Enable support for SPI Flash. This option allows SPL to read from
          sunxi SPI Flash. It uses the same method as the boot ROM, so does
diff --git a/arch/arm/mach-sunxi/Makefile b/arch/arm/mach-sunxi/Makefile
index 58f807cb82..2db95394b2 100644
--- a/arch/arm/mach-sunxi/Makefile
+++ b/arch/arm/mach-sunxi/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_MACH_SUN5I)      += clock_sun4i.o
 obj-$(CONFIG_MACH_SUN6I)       += clock_sun6i.o
 obj-$(CONFIG_MACH_SUN7I)       += clock_sun4i.o
 obj-$(CONFIG_MACH_SUN50I)      += clock_sun6i.o
+obj-$(CONFIG_MACH_SUN8I_V5)    += clock_sun6i.o # I hope this works :<
 ifdef CONFIG_MACH_SUN8I_A83T
 obj-y                          += clock_sun8i_a83t.o
 else
diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index 2e24d12214..480c92c28f 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -567,6 +567,8 @@ static int parse_phy_pins(struct udevice *dev)
                iomux = SUN8I_IOMUX;
        else if (IS_ENABLED(CONFIG_MACH_SUN50I))
                iomux = SUN8I_IOMUX;
+       else if (IS_ENABLED(CONFIG_MACH_SUN8I_V5))
+               iomux = SUN8I_IOMUX;
        else
                BUILD_BUG_ON_MSG(1, "missing pinmux value for Ethernet pins");
 
Any information regarding this would be very much appreciated.
linuxyne
Member
Member
Posts: 211
Joined: Sat Jul 02, 2016 7:02 am

Re: u-boot/lib/lmb.c:154: undefined reference to `_start'

Post by linuxyne »

Wouldn't it be more appropriate for the question to be posted on uboot forums/list?
Post Reply