Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jul 2009 15:43:37 +0200
From:      Jacques Fourie <jacques.fourie@gmail.com>
To:        Stanislav Sedov <stas@freebsd.org>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: qemu / boot parameter
Message-ID:  <be2f52430907160643g6fe3ee97vdcb62939218a1b51@mail.gmail.com>
In-Reply-To: <20090716171030.a0e7a3f0.stas@FreeBSD.org>
References:  <4734a3ed0907150752g595b680frcacba26da7979479@mail.gmail.com> <20090716171030.a0e7a3f0.stas@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jul 16, 2009 at 3:10 PM, Stanislav Sedov<stas@freebsd.org> wrote:
> On Wed, 15 Jul 2009 16:52:40 +0200
> Henri-Pierre Charles <hpcharles@gmail.com> mentioned:
>
>> Hello list, I try to do my first FreeBSD/arm installation. I plan to
>> use qemu. I've started with this page
>> http://people.freebsd.org/~cognet/freebsd_arm.txt for kernel/world
>> build. For my personnal teaching, I've summarized these instructions
>> in the attached script.
>>
>> Now, I'm stuck with qemu. I've tried many invocation, and the best
>> result I get is with qemu-system-arm hda.img -boot n =A0 =A0 =A0 =A0 =A0=
\
>> =A0 =A0 -tftp $ARMFS/boot/kernel/ -bootp /kernel =A0\
>> =A0 =A0 -kernel $ARMFS/boot/kernel/kernel =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 \
>> =A0 =A0 -m 300 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0\
>> =A0 =A0 -M integratorc
>>
>> And I get :
>> qemu: fatal: Trying to execute code outside RAM or ROM at 0xc0200100
>> (which is not far from KERNVIRTADDR)
>>
>> I miss something somewhere ? Any idea ?
>>
>
> As far as I know we don't currently support qemu ARM/intergrator platform=
.
> However, current versions of qemu can emulate XScale devices (gumstix,
> for example), so you may want to try this type of emulation with your
> XScale kernel.
>
> Please note, however, that qemu usually emulate specific memory layouts
> that may not match what FreeBSD kernel which was configured to run
> on the different hardware would expect. =A0So a bit of hand-tweaking migh=
t
> be required. =A0You should study where qemu maps memory and onboard devic=
es,
> and how it passes the control to FreeBSD kernel and make the appropriate
> modifications to the code/kernel config.
>
> Hope that helps.
>
> --
> Stanislav Sedov
> ST4096-RIPE
>

Here is a recipe that worked for me on qemu 0.9.1. As far as I know it
won't work with the qemu 0.10 but your mileage may vary.

* Apply following patch to sys/arm/xscale/pxa/uart_bus_pxa.c
  (Patch by Mark Tinguely)

static int
uart_pxa_probe(device_t dev)
{
       bus_space_handle_t      base;
       struct                  uart_softc *sc;

+#ifdef QEMU
+       base =3D (bus_space_handle_t)pxa_get_base(dev);
+       if (0x40100000 !=3D (unsigned int) base)
+               return (ENXIO);
+#else
       /* Check to see if the enable bit's on. */
       if ((bus_space_read_4(obio_tag, base,
           (REG_IER << 2)) & PXA_UART_UUE) =3D=3D 0)
               return (ENXIO);
+#endif

       sc =3D device_get_softc(dev);
       sc->sc_class =3D &uart_ns8250_class;

       return(uart_bus_probe(dev, 2, PXA2X0_COM_FREQ, 0, 0));
}

* Remove ARM_CACHE_LOCK_ENABLE from
  sys/arm/xscale/std.xscale and compile a GUMSTIX kernel

* Build flash image:

dd of=3Dflash bs=3D1k count=3D16k if=3D/dev/zero
dd of=3Dflash bs=3D1k conv=3Dnotrunc if=3Du-boot-connex-400-r1604.bin
dd of=3Dflash bs=3D1k conv=3Dnotrunc seek=3D256 if=3Dkernel.gz.tramp

I start qemu as follows:
qemu-system-arm -M connex -m 289 -pflash flash \
-nographic -serial tcp::4000,server \
-net nic,macaddr=3D52:54:00:12:34:50,vlan=3D0,model=3Dsmc91c111 \
-net tap,vlan=3D0,ifname=3Dtap1,script=3Dno

I then telnet to port 4000 for the serial console and use 'bootelf
4000' in the uboot prompt to boot the kernel.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?be2f52430907160643g6fe3ee97vdcb62939218a1b51>