On 11/15/2018 10:33 AM, [email protected] wrote: > Hi Marek, Hi,
CC the list next time. > I am Kin, nice to meet you, I know you because I saw your u-boot > video on Youtube. > I am a learner of u-boot, and I have a big confusion on it, so I > would like to find answer from you. > > For compiling, some platform have CONFIG_SYS_TEXT_BASE set to some > value, and CONFIG_SYS_TEXT_BASE will be used when linking all sections > into one u-boot, so it can be said that the address of the first > instruction in u-boot will be bound to address CONFIG_SYS_TEXT_BASE, and > every variable and function will also be bound to address based on > CONFIG_SYS_TEXT_BASE. Yes, that's the link address. > Before relocation, gd->relocaddr is calculated, and if gd->relocaddr > doesn't equal to CONFIG_SYS_TEXT_BASE, u-boot is relocated to > gd->relocaddr but not CONFIG_SYS_TEXT_BASE. Right, U-Boot gets relocated to the end of RAM , so it's out of the way. > Since all the functions and variables are bound to address based on > CONFIG_SYS_TEXT_BASE during compilation, so if we don't locate u-boot to > CONFIG_SYS_TEXT_BASE, u-boot cannot reach functions and variable correctly. Take a look at relocate_code function and search for R_ARM_REL32 for example, it should give you an idea how that relocation stuff works and how the function pointers get adjusted to match the binary location. > But this is actually how u-boot is designed, so I am confused, could > you give me any hint for that? > Thanks. > -- Best regards, Marek Vasut _______________________________________________ U-Boot mailing list [email protected] https://lists.denx.de/listinfo/u-boot

