Le 21 avr. 2016 à 14:54, Peter Maydell <peter.mayd...@linaro.org> a écrit :
> On 21 April 2016 at 13:50, Sylvain Garrigues
> <sylv...@sylvaingarrigues.com> wrote:
>> It does prevent FreeBSD to boot correctly.
>> 
>> With that patch and
>> #define KERNEL_LOAD_ADDR 0x00200000
>> in arm/boot/boot.c, official FreeBSD RPI2 images boot like a charm :-)
> 
> This is the kind of thing that is useful to mention in the commit
> message, because it tells people why the change is important…

You are obviously right, sorry about that.

>> BTW, would be great to be able to set the load addr on the command
>> line, wouldn’t it?
> 
> The booting protocol does not mandate any particular address
> that the kernel has to be loaded at:
> https://www.kernel.org/doc/Documentation/arm/Booting

I didn’t know qemu would blindly follow and stick to Linux rules, but I 
understand. I use qemu for baremetal and *BSD emulation, I wish it would be 
easier to change the loading address (and not stick with Linux rules like so 
many people again) :-)  


> If the FreeBSD kernel can't handle being loaded wherever
> we put it, that sounds like a FreeBSD bug to me…

I would not say it is a bug, but an explicit assumption. Indeed, the kernel 
expects it is loaded on a 2 MB page boundary.
I’m no expert, but I believe it was made so that we could remove the need for 
setting the physical address in the building process. The virtual to physical 
offset is computed more simply with that assumption. 

With the patch you committed for me earlier today (b4850e5), the patch we are 
talking about in this email (which is not a feature but a bug fix in my 
opinion), and the ability to set the load address to 0x200000 (on the command 
line if possible), the following line just works straight to the login prompt 
:-) 
# ./arm-softmmu/qemu-system-arm -M raspi2 -m 1024 -smp 4 -kernel kernel.bin 
-serial stdio -dtb rpi2.dtb -sd 
FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20160408-r297692.img

FreeBSD-11.0-CURRENT-arm-armv6-RPI2-20160408-r297692.img is the latest FreeBSD 
official image.
rpi2.dtb and kernel.bin are in the /boot/ partition of that img file. 

That’s it for my patches to make qemu and BSDs the best lovers in the world.

Have a good day,
Sylvain Garrigues.

Reply via email to