diff mbox

[U-Boot,12/12] x86: Document how to play with SeaBIOS

Message ID 1456642686-18887-13-git-send-email-bmeng.cn@gmail.com
State Superseded
Delegated to: Bin Meng
Headers show

Commit Message

Bin Meng Feb. 28, 2016, 6:58 a.m. UTC
Boting SeaBIOS is done via U-Boot's bootelf command. Document this.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>

---

 doc/README.x86 | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 47 insertions(+), 2 deletions(-)

Comments

Simon Glass Feb. 29, 2016, 4:19 a.m. UTC | #1
On 27 February 2016 at 23:58, Bin Meng <bmeng.cn@gmail.com> wrote:
> Boting SeaBIOS is done via U-Boot's bootelf command. Document this.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>
> ---
>
>  doc/README.x86 | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 47 insertions(+), 2 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

I think it would be good to add instructions on creating disk.img.

Also, when I ran this (64-bit ubuntu) I get:

qemu-system-i386 -serial stdio -bios ~/u/b/qemu-x86/u-boot.rom -hda
disk.img -cdrom /vid/software/win/winxp.iso -smp 2 -m 512
WARNING: Image format was not specified for 'disk.img' and probing guessed raw.
         Automatically detecting the format is dangerous for raw
images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.


U-Boot 2016.03-rc2-00072-g67c4eef (Feb 28 2016 - 21:13:33 -0700)

CPU: x86, vendor Intel, device 663h
DRAM:  512 MiB
Using default environment

Video: 640x480x16
Model: QEMU x86 (I440FX)
Net:   e1000: 52:54:00:12:34:56

Warning: e1000#0 using MAC address from ROM
eth0: e1000#0
IDE:   Bus 0: OK Bus 1: OK
  Device 0: Model: QEMU HARDDISK  Firm: 2.3.90 Ser#: QM00001
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 2048.0 MB = 2.0 GB (4194304 x 512)
  Device 1: not available
  Device 2: Model: QEMU Firm: 2.3. Ser#: QEMU DVD-ROM
            Type: Removable CD ROM
            Capacity: 585.2 MB = 0.5 GB (299648 x 2048)
qemu: fatal: Trying to execute code outside RAM or ROM at 0xf10002ba

EAX=5bfb0000 EBX=0000f8ec ECX=00000ff3 EDX=00000000
ESI=00000002 EDI=c8000014 EBP=1ffceea5 ESP=00000005
EIP=f10002ba EFL=00000246 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 00000000 00000000 00000000
CS =0010 00000000 ffffffff 00cf9b00 DPL=0 CS32 [-RA]
SS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
DS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
FS =0020 1fd67dc8 ffffffff 00cf9300 DPL=0 DS   [-WA]
GS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
GDT=     1fd67d80 00000047
IDT=     1ffce470 000007ff
CR0=00000033 CR2=00000000 CR3=00000000 CR4=00000000
DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
DR6=ffff0ff0 DR7=00000400
CCS=5bfb0000 CCD=5bfb0000 CCO=ADDB
EFER=0000000000000000
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
Aborted

Regards,
Simon
Bin Meng Feb. 29, 2016, 7:21 a.m. UTC | #2
Hi Simon,

On Mon, Feb 29, 2016 at 12:19 PM, Simon Glass <sjg@chromium.org> wrote:
> On 27 February 2016 at 23:58, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Boting SeaBIOS is done via U-Boot's bootelf command. Document this.
>>
>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>
>> ---
>>
>>  doc/README.x86 | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
>>  1 file changed, 47 insertions(+), 2 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> I think it would be good to add instructions on creating disk.img.

Sure.

>
> Also, when I ran this (64-bit ubuntu) I get:
>
> qemu-system-i386 -serial stdio -bios ~/u/b/qemu-x86/u-boot.rom -hda
> disk.img -cdrom /vid/software/win/winxp.iso -smp 2 -m 512
> WARNING: Image format was not specified for 'disk.img' and probing guessed raw.
>          Automatically detecting the format is dangerous for raw
> images, write operations on block 0 will be restricted.
>          Specify the 'raw' format explicitly to remove the restrictions.
>
>
> U-Boot 2016.03-rc2-00072-g67c4eef (Feb 28 2016 - 21:13:33 -0700)
>
> CPU: x86, vendor Intel, device 663h
> DRAM:  512 MiB
> Using default environment
>
> Video: 640x480x16
> Model: QEMU x86 (I440FX)
> Net:   e1000: 52:54:00:12:34:56
>
> Warning: e1000#0 using MAC address from ROM
> eth0: e1000#0
> IDE:   Bus 0: OK Bus 1: OK
>   Device 0: Model: QEMU HARDDISK  Firm: 2.3.90 Ser#: QM00001
>             Type: Hard Disk
>             Supports 48-bit addressing
>             Capacity: 2048.0 MB = 2.0 GB (4194304 x 512)
>   Device 1: not available
>   Device 2: Model: QEMU Firm: 2.3. Ser#: QEMU DVD-ROM
>             Type: Removable CD ROM
>             Capacity: 585.2 MB = 0.5 GB (299648 x 2048)
> qemu: fatal: Trying to execute code outside RAM or ROM at 0xf10002ba
>
> EAX=5bfb0000 EBX=0000f8ec ECX=00000ff3 EDX=00000000
> ESI=00000002 EDI=c8000014 EBP=1ffceea5 ESP=00000005
> EIP=f10002ba EFL=00000246 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
> ES =0000 00000000 00000000 00000000
> CS =0010 00000000 ffffffff 00cf9b00 DPL=0 CS32 [-RA]
> SS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
> DS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
> FS =0020 1fd67dc8 ffffffff 00cf9300 DPL=0 DS   [-WA]
> GS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
> LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
> TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
> GDT=     1fd67d80 00000047
> IDT=     1ffce470 000007ff
> CR0=00000033 CR2=00000000 CR3=00000000 CR4=00000000
> DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
> DR6=ffff0ff0 DR7=00000400
> CCS=5bfb0000 CCD=5bfb0000 CCO=ADDB
> EFER=0000000000000000
> FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
> FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
> FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
> FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
> FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
> XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
> XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
> XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
> XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
> Aborted
>

Which QEMU version is this on your Ubuntu?

Regards,
Bin
Simon Glass March 1, 2016, 2:03 a.m. UTC | #3
Hi Bin,

On 29 February 2016 at 00:21, Bin Meng <bmeng.cn@gmail.com> wrote:
> Hi Simon,
>
> On Mon, Feb 29, 2016 at 12:19 PM, Simon Glass <sjg@chromium.org> wrote:
>> On 27 February 2016 at 23:58, Bin Meng <bmeng.cn@gmail.com> wrote:
>>> Boting SeaBIOS is done via U-Boot's bootelf command. Document this.
>>>
>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>>
>>> ---
>>>
>>>  doc/README.x86 | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
>>>  1 file changed, 47 insertions(+), 2 deletions(-)
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> I think it would be good to add instructions on creating disk.img.
>
> Sure.
>
>>
>> Also, when I ran this (64-bit ubuntu) I get:
>>
>> qemu-system-i386 -serial stdio -bios ~/u/b/qemu-x86/u-boot.rom -hda
>> disk.img -cdrom /vid/software/win/winxp.iso -smp 2 -m 512
>> WARNING: Image format was not specified for 'disk.img' and probing guessed raw.
>>          Automatically detecting the format is dangerous for raw
>> images, write operations on block 0 will be restricted.
>>          Specify the 'raw' format explicitly to remove the restrictions.
>>
>>
>> U-Boot 2016.03-rc2-00072-g67c4eef (Feb 28 2016 - 21:13:33 -0700)
>>
>> CPU: x86, vendor Intel, device 663h
>> DRAM:  512 MiB
>> Using default environment
>>
>> Video: 640x480x16
>> Model: QEMU x86 (I440FX)
>> Net:   e1000: 52:54:00:12:34:56
>>
>> Warning: e1000#0 using MAC address from ROM
>> eth0: e1000#0
>> IDE:   Bus 0: OK Bus 1: OK
>>   Device 0: Model: QEMU HARDDISK  Firm: 2.3.90 Ser#: QM00001
>>             Type: Hard Disk
>>             Supports 48-bit addressing
>>             Capacity: 2048.0 MB = 2.0 GB (4194304 x 512)
>>   Device 1: not available
>>   Device 2: Model: QEMU Firm: 2.3. Ser#: QEMU DVD-ROM
>>             Type: Removable CD ROM
>>             Capacity: 585.2 MB = 0.5 GB (299648 x 2048)
>> qemu: fatal: Trying to execute code outside RAM or ROM at 0xf10002ba
>>
>> EAX=5bfb0000 EBX=0000f8ec ECX=00000ff3 EDX=00000000
>> ESI=00000002 EDI=c8000014 EBP=1ffceea5 ESP=00000005
>> EIP=f10002ba EFL=00000246 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
>> ES =0000 00000000 00000000 00000000
>> CS =0010 00000000 ffffffff 00cf9b00 DPL=0 CS32 [-RA]
>> SS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
>> DS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
>> FS =0020 1fd67dc8 ffffffff 00cf9300 DPL=0 DS   [-WA]
>> GS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
>> LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
>> TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
>> GDT=     1fd67d80 00000047
>> IDT=     1ffce470 000007ff
>> CR0=00000033 CR2=00000000 CR3=00000000 CR4=00000000
>> DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
>> DR6=ffff0ff0 DR7=00000400
>> CCS=5bfb0000 CCD=5bfb0000 CCO=ADDB
>> EFER=0000000000000000
>> FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
>> FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
>> FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
>> FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
>> FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
>> XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
>> XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
>> XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
>> XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
>> Aborted
>>
>
> Which QEMU version is this on your Ubuntu?

I am using:

QEMU emulator version 2.3.90, Copyright (c) 2003-2008 Fabrice Bellard

It seems to be the winxp.iso that kills it. Maybe mind is broken? I'm
pretty sure I have installed from it ages ago though.

Regards,
Simon
Bin Meng March 1, 2016, 2:40 a.m. UTC | #4
Hi Simon,

On Tue, Mar 1, 2016 at 10:03 AM, Simon Glass <sjg@chromium.org> wrote:
> Hi Bin,
>
> On 29 February 2016 at 00:21, Bin Meng <bmeng.cn@gmail.com> wrote:
>> Hi Simon,
>>
>> On Mon, Feb 29, 2016 at 12:19 PM, Simon Glass <sjg@chromium.org> wrote:
>>> On 27 February 2016 at 23:58, Bin Meng <bmeng.cn@gmail.com> wrote:
>>>> Boting SeaBIOS is done via U-Boot's bootelf command. Document this.
>>>>
>>>> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
>>>>
>>>> ---
>>>>
>>>>  doc/README.x86 | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
>>>>  1 file changed, 47 insertions(+), 2 deletions(-)
>>>
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>
>>> I think it would be good to add instructions on creating disk.img.
>>
>> Sure.
>>
>>>
>>> Also, when I ran this (64-bit ubuntu) I get:
>>>
>>> qemu-system-i386 -serial stdio -bios ~/u/b/qemu-x86/u-boot.rom -hda
>>> disk.img -cdrom /vid/software/win/winxp.iso -smp 2 -m 512
>>> WARNING: Image format was not specified for 'disk.img' and probing guessed raw.
>>>          Automatically detecting the format is dangerous for raw
>>> images, write operations on block 0 will be restricted.
>>>          Specify the 'raw' format explicitly to remove the restrictions.
>>>
>>>
>>> U-Boot 2016.03-rc2-00072-g67c4eef (Feb 28 2016 - 21:13:33 -0700)
>>>
>>> CPU: x86, vendor Intel, device 663h
>>> DRAM:  512 MiB
>>> Using default environment
>>>
>>> Video: 640x480x16
>>> Model: QEMU x86 (I440FX)
>>> Net:   e1000: 52:54:00:12:34:56
>>>
>>> Warning: e1000#0 using MAC address from ROM
>>> eth0: e1000#0
>>> IDE:   Bus 0: OK Bus 1: OK
>>>   Device 0: Model: QEMU HARDDISK  Firm: 2.3.90 Ser#: QM00001
>>>             Type: Hard Disk
>>>             Supports 48-bit addressing
>>>             Capacity: 2048.0 MB = 2.0 GB (4194304 x 512)
>>>   Device 1: not available
>>>   Device 2: Model: QEMU Firm: 2.3. Ser#: QEMU DVD-ROM
>>>             Type: Removable CD ROM
>>>             Capacity: 585.2 MB = 0.5 GB (299648 x 2048)
>>> qemu: fatal: Trying to execute code outside RAM or ROM at 0xf10002ba
>>>
>>> EAX=5bfb0000 EBX=0000f8ec ECX=00000ff3 EDX=00000000
>>> ESI=00000002 EDI=c8000014 EBP=1ffceea5 ESP=00000005
>>> EIP=f10002ba EFL=00000246 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
>>> ES =0000 00000000 00000000 00000000
>>> CS =0010 00000000 ffffffff 00cf9b00 DPL=0 CS32 [-RA]
>>> SS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
>>> DS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
>>> FS =0020 1fd67dc8 ffffffff 00cf9300 DPL=0 DS   [-WA]
>>> GS =0018 00000000 ffffffff 00cf9300 DPL=0 DS   [-WA]
>>> LDT=0000 00000000 0000ffff 00008200 DPL=0 LDT
>>> TR =0000 00000000 0000ffff 00008b00 DPL=0 TSS32-busy
>>> GDT=     1fd67d80 00000047
>>> IDT=     1ffce470 000007ff
>>> CR0=00000033 CR2=00000000 CR3=00000000 CR4=00000000
>>> DR0=00000000 DR1=00000000 DR2=00000000 DR3=00000000
>>> DR6=ffff0ff0 DR7=00000400
>>> CCS=5bfb0000 CCD=5bfb0000 CCO=ADDB
>>> EFER=0000000000000000
>>> FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00001f80
>>> FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
>>> FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
>>> FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
>>> FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
>>> XMM00=00000000000000000000000000000000 XMM01=00000000000000000000000000000000
>>> XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
>>> XMM04=00000000000000000000000000000000 XMM05=00000000000000000000000000000000
>>> XMM06=00000000000000000000000000000000 XMM07=00000000000000000000000000000000
>>> Aborted
>>>
>>
>> Which QEMU version is this on your Ubuntu?
>
> I am using:
>
> QEMU emulator version 2.3.90, Copyright (c) 2003-2008 Fabrice Bellard

I am using QEMU 2.3.0, built from source.

> It seems to be the winxp.iso that kills it. Maybe mind is broken? I'm
> pretty sure I have installed from it ages ago though.
>

That's strange. Based on U-Boot log, it seems it just executes to a
place where the U-Boot IDE driver is probing the IDE devices (in this
case, a hard disk and a CD-ROM are identified), but somehow it crashed
without printing the 'Device 3', like my log below.

IDE:   Bus 0: OK Bus 1: OK
  Device 0: Model: QEMU HARDDISK  Firm: 2.3.0  Ser#: QM00001
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 10240.0 MB = 10.0 GB (20971520 x 512)
  Device 1: not available
  Device 2: Model: QEMU Firm: 2.3. Ser#: QEMU DVD-ROM
            Type: Removable CD ROM
            Capacity: 694.4 MB = 0.6 GB (355541 x 2048)
  Device 3: not available
Hit any key to stop autoboot:  0

I have no idea, maybe it's something wrong with the iso, or QEMU version (?).

Regards,
Bin
diff mbox

Patch

diff --git a/doc/README.x86 b/doc/README.x86
index d3fea5d..4b6ad42 100644
--- a/doc/README.x86
+++ b/doc/README.x86
@@ -669,6 +669,50 @@  environment variables if you add this to minnowmax.h:
 #undef CONFIG_EXTRA_ENV_SETTINGS
 #define CONFIG_EXTRA_ENV_SETTINGS "boot=zboot 03000000 0 04000000 ${filesize}"
 
+Test with SeaBIOS
+-----------------
+SeaBIOS [14] is an open source implementation of a 16-bit x86 BIOS. It can run
+in an emulator or natively on x86 hardware with the use of U-Boot. With its
+help, we can boot some OSes that require 16-bit BIOS services like Windows/DOS.
+
+As U-Boot, we have to manually create a table where SeaBIOS gets various system
+information (eg: E820) from. The table unfortunately has to follow the coreboot
+table format as SeaBIOS currently supports booting as a coreboot payload.
+
+Booting SeaBIOS is done via U-Boot's bootelf command, like below:
+
+   => tftp bios.bin.elf;bootelf
+   Using e1000#0 device
+   TFTP from server 10.10.0.100; our IP address is 10.10.0.108
+   ...
+   Bytes transferred = 122124 (1dd0c hex)
+   ## Starting application at 0x000ff06e ...
+   SeaBIOS (version rel-1.9.0)
+   ...
+
+bios.bin.elf is the SeaBIOS image built from SeaBIOS source tree.
+Make sure it is built as follows:
+
+   $ make menuconfig
+
+Inside the "General Features" menu, select "Build for coreboot" as the
+"Build Target". Inside the "Debugging" menu, turn on "Serial port debugging"
+so that we can see something as soon as SeaBIOS boots. Leave other options
+as in their default state. Then,
+
+   $ make
+   ...
+   Total size: 121888  Fixed: 66496  Free: 9184 (used 93.0% of 128KiB rom)
+   Creating out/bios.bin.elf
+
+Currently this is tested on QEMU x86 target with U-Boot chain-loading SeaBIOS
+to install/boot a Windows XP OS (below for example command to install Windows).
+
+   $ qemu-system-i386 -serial stdio -bios u-boot.rom -hda disk.img -cdrom winxp.iso -smp 2 -m 512
+
+This is also tested on Intel Crown Bay board with a PCIe graphics card, booting
+SeaBIOS then chain-loading a GRUB on a USB drive, then Linux kernel finally.
+
 
 Development Flow
 ----------------
@@ -736,7 +780,7 @@  debug serial port may be useful here. See setup_internal_uart() for an example.
 During the U-Boot porting, one of the important steps is to write correct PIRQ
 routing information in the board device tree. Without it, device drivers in the
 Linux kernel won't function correctly due to interrupt is not working. Please
-refer to U-Boot doc [14] for the device tree bindings of Intel interrupt router.
+refer to U-Boot doc [15] for the device tree bindings of Intel interrupt router.
 Here we have more details on the intel,pirq-routing property below.
 
 	intel,pirq-routing = <
@@ -833,4 +877,5 @@  References
 [11] https://en.wikipedia.org/wiki/GUID_Partition_Table
 [12] http://events.linuxfoundation.org/sites/events/files/slides/chromeos_and_diy_vboot_0.pdf
 [13] http://events.linuxfoundation.org/sites/events/files/slides/elce-2014.pdf
-[14] doc/device-tree-bindings/misc/intel,irq-router.txt
+[14] http://www.seabios.org/SeaBIOS
+[15] doc/device-tree-bindings/misc/intel,irq-router.txt