Subject: Re: Qemu OMAP
From: Loïc Minier <[email-masked]>
To: Jean-Christophe PLAGNIOL-VILLARD <[email-masked]>
Date: Thu, 7 Jul 2011 15:41:13 +0200

On Thu, Jul 07, 2011, Loïc Minier wrote:
>  I just tried creating an image manually myself minutes ago after
>  building barebox for beagle and beagle_xload, but failed miserably, I'm
>  not sure why yet; I just get "qemu: hardware error: no boot device
>  found".  I will dig into this, as I need this for the UEFI research
>  too.

 Ok; QEMU seems to be picky about the FAT for some reason; will dig into
 this later, but here is how I got some of it working (and then breaking
 badly):

 * Create blank SD card (sparse) image, sufficiently big to allow FAT32 parts (here: 256 MiB)
{{{
    % dd if=/dev/zero of=sd.img bs=1M seek=256 count=0
}}}

 * Partition with a bootable FAT32 partition starting at +63s
{{{
    % parted sd.img
    (parted) unit s
    (parted) mklabel msdos
    (parted) mkpartfs primary fat32 63 -1
    (parted) toggle 1 boot
    (parted) quit
    % sudo mount -o loop,offset=$((63*512)) sd.img /mnt
    % sudo cp barebox/obj-omap3530_beagle_xload/barebox.bin.ift /mnt/MLO
    % sudo cp barebox/obj-omap3530_beagle/barebox.bin /mnt/barebox.bin
    % sudo cp barebox/obj-omap3530_beagle/barebox.bin /mnt/barebox
    % sudo umount /mnt
}}}
 * Boot in QEMU
{{{
    % qemu-system-arm -sd sd.img -nographic -M beagle
}}}

 You should get:
{{{

barebox 2011.07.0-00043-gd757dd4 (Jul  7 2011 - 15:06:10)

Board: Texas Instrument's Beagle
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xba ( )
Malloc space: 0x87bfff10 -> 0x87ffff10 (size  4 MB)
Stack space : 0x87bf7f10 -> 0x87bfff10 (size 32 kB)
unknown boot source. Fall back to nand
booting from NAND
qemu: fatal: Trying to execute code outside RAM or ROM at 0x402145f4

R00=40200000 R01=4020f800 R02=00000000 R03=00000030
R04=87c054b8 R05=87bfff10 R06=78500100 R07=ffffffff
R08=87bfff00 R09=ffffffff R10=00000000 R11=00000002
R12=40209ac4 R13=87bfff00 R14=4020f858 R15=402145f4
PSR=200001db --C- A und32
}}}

 to debug, you can use Ubuntu's gdb-multiarch (which allows debugging
 ARM binaries) and connecting to QEMU's gdb connection.

-- 
Loïc Minier