
do_bootm_standanlone() calls ntohl(images->ep) which is wrong because endianess conversion has already been done:
do_bootm() -do_bootm_states() +-bootm_find_os() | -images.ep = image_get_ep(); | -uimage_to_cpu(hdr->ih_ep); -boot_selected_os() -do_bootm_standanlone()
Without this conversion the code works correctly at least on ARM9. Addtionally "appl" need not be dereferenced with the "*" operator.
Signed-off-by: Christian Eggers ceggers@gmx.de --- Changes in v2: - Improve description why the patch is required - (appl)(...) --> appl(...)
Further remarks: It seems there's no real difference between doing "(*func_ptr)(args)" and "func_ptr(args)":
--- arm --- kernel_entry = (void (*)(int, int, uint))images->ep; kernel_entry(0, machid, r2) ---/arm --- --- powerpc --- kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong, ulong, ulong))images->ep; (*kernel)(kbd, initrd_start, initrd_end, cmd_start, cmd_end, 0, 0); ---/powerpc ---
See also: http://stackoverflow.com/questions/7518815/function-pointer-automatic-derefe...
common/cmd_bootm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c index a59ee95..c507e1d 100644 --- a/common/cmd_bootm.c +++ b/common/cmd_bootm.c @@ -514,8 +514,8 @@ static int do_bootm_standalone(int flag, int argc, char * const argv[], setenv_hex("filesize", images->os.image_len); return 0; } - appl = (int (*)(int, char * const []))(ulong)ntohl(images->ep); - (*appl)(argc, argv); + appl = (int (*)(int, char * const []))images->ep; + appl(argc, argv); return 0; }