Load uImage higher so it doesn't overwrite itself

Loading of haiku_loader from an uImage is a 2-step process:

* First, the uImage is loaded (in our case from SD card using fatload)
to RAM at a temporary address.
* Then (using bootm), it is unpacked. The uImage is a container format
and can hold several files, with a load and execution address. The files
are copied from the uImage to their final location, and it's better if
that doesn't overlap with the uImage content

When this loading is done, bootm jumps to the entry point found in the
uImage.

We now actually execute our code from haiku_loader. This crashes with
the following call stack:
* vsnprintf
* dprintf
* boot_arch_cpu_init
* cpu_init

It seems vsnprintf is trying to use VFP instructions (probably from the
libgcc) but that triggers some kind of fault, and the handler (setup by
uboot?) ends up crashing the system by jumping to unmapped memory at 0.
This commit is contained in:
PulkoMandy 2014-06-13 20:14:57 +02:00
parent 0c66734e4d
commit afe56d3ab3

View File

@ -179,10 +179,13 @@ actions BuildUBootSDImage1
MTOOLSRC=$(<).mtools mpartition -cI -T 0xc i:
# format the image
MTOOLSRC=$(<).mtools mformat -L 32 -v "Haiku" i:
# generate u-boot environment variables
# We load the uImage 2MB above its final destination, bootm will decode
# it to the proper location. Our image is smaller than 2MB so this works.
echo 'uenvcmd=run loadImage; run mmcboot;
loadImage=fatload mmc0 0 0x80008000 haiku_loader_nbsd.ub
mmcboot=bootm 0x80008000' > uEnv.txt
loadImage=fatload mmc0 0 0x80200000 haiku_loader_nbsd.ub
mmcboot=bootm 0x80200000' > uEnv.txt
# populate
MTOOLSRC=$(<).mtools mcopy $(>) i:
MTOOLSRC=$(<).mtools mcopy uEnv.txt i: