[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] [S390] Add firmware code
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PATCH] [S390] Add firmware code |
Date: |
Tue, 20 Apr 2010 19:11:43 +0200 |
This patch adds a firmware blob to the S390 target. The blob is a simple
implementation of a virtio client that tries to read the second stage
bootloader from sectors described as of offset 0x20 in the MBR.
In combination with an updated zipl this allows for booting from virtio
block devices. This firmware is built from the same sources as the second
stage bootloader. You can find a virtio capable s390-tools in this repo:
git://repo.or.cz/s390-tools.git
Signed-off-by: Alexander Graf <address@hidden>
---
v1 -> v2:
- Update bootloader code to support booting from non-virtio aware
zipl disks. Now you don't need to modify zipl in the guest anymore
just to boot.
- Add safety checks
- Add documentation on where to find the sources
- Make bios optional
v2 -> v3:
- Add brackets
---
hw/s390-virtio.c | 26 ++++++++++++++++++++++++++
pc-bios/README | 5 +++++
pc-bios/s390-zipl.rom | Bin 0 -> 3344 bytes
3 files changed, 31 insertions(+), 0 deletions(-)
create mode 100755 pc-bios/s390-zipl.rom
diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c
index c36a8b2..898f442 100644
--- a/hw/s390-virtio.c
+++ b/hw/s390-virtio.c
@@ -52,6 +52,10 @@
#define INITRD_PARM_SIZE 0x010410UL
#define PARMFILE_START 0x001000UL
+#define ZIPL_START 0x009000UL
+#define ZIPL_LOAD_ADDR 0x009000UL
+#define ZIPL_FILENAME "s390-zipl.rom"
+
#define MAX_BLK_DEVS 10
static VirtIOS390Bus *s390_bus;
@@ -188,6 +192,28 @@ static void s390_init(ram_addr_t ram_size,
env->psw.addr = KERN_IMAGE_START;
env->psw.mask = 0x0000000180000000ULL;
+ } else {
+ ram_addr_t bios_size = 0;
+ char *bios_filename;
+
+ /* Load zipl bootloader */
+ if (bios_name == NULL) {
+ bios_name = ZIPL_FILENAME;
+ }
+
+ bios_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+ bios_size = load_image(bios_filename,
qemu_get_ram_ptr(ZIPL_LOAD_ADDR));
+
+ if ((long)bios_size < 0) {
+ hw_error("could not load bootloader '%s'\n", bios_name);
+ }
+
+ if (bios_size > 4096) {
+ hw_error("stage1 bootloader is > 4k\n");
+ }
+
+ env->psw.addr = ZIPL_START;
+ env->psw.mask = 0x0000000180000000ULL;
}
if (initrd_filename) {
diff --git a/pc-bios/README b/pc-bios/README
index 437ef1c..be86dde 100644
--- a/pc-bios/README
+++ b/pc-bios/README
@@ -28,3 +28,8 @@
virtio 1af4:1000
http://rom-o-matic.net/
+
+- The S390 zipl loader is an addition to the official IBM s390-tools
+ package. That fork is maintained in its own git repository at:
+ git://repo.or.cz/s390-tools.git
+
diff --git a/pc-bios/s390-zipl.rom b/pc-bios/s390-zipl.rom
new file mode 100755
index
0000000000000000000000000000000000000000..915995087824864cfa362176886e94c4473d8c6f
GIT binary patch
literal 3344
zcmZuzdvH|M8UOC?hP%xJ4gtdQD4v7`l7hGiv0$LMH$WPE;37(cwKWR~A(EFNp#nu#
zjrGx5msD)address@hidden>;?jK$-r6`Zv-*+|vE!~-W
z_nhy3&)@address@hidden<GPPh*p3n9w5m&=)LX(address@hidden&msF^_
zybHYv_cav~6a}9nAQk|n?~tT%he}93BWbFdOMcZuWAX1(T{J-rQJy2*U(wEI1&!|?
address@hidden;%)IH=QCO`s2;RJl=XE>*=nFYQ3JN$;
address@hidden<(a!#-DcoN~CAATIRHlRsDu`ByK%KAyY!Q?I6{yK%IMNPMFm!9*{HtEb
zQY*=bkqkzK9POl`F&vG^{1~KQDG$7`R4b&9CBfr!gdL)Q_AL;N3ZHp3bJVQ|e#ZdB
zfV$+>!OLnqs}AKbK5mL5CCZdjKIJ=t+2Cn0ICAj3(;address@hidden)iPqd^Kh8P1`8AKef1
zidbGpr*&lIAvveN7!qL`rAo<wq<|zmQj>s#l)zz)j0RMXcM9K0h43sOiis$rP~r%-
z;zZAJ3`fsl9gT>address@hidden|rrS6Y%yEw*xT=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QL=h^HyFjLqH?4WMy2bN2et42&pM|address@hidden
address@hidden(t|3{TALpS>4JVhPU1-e1Xpql7?rY6ZCJYkg2VczU;7jXWs)Z<KoMa$NA
z3O&891Q~nd^nl+@>4~7{obh+|>hk-$$mWxGgN2#TbLjXscwg%zI=J4_D2srTOkq~T
zL!OxnwA5)address@hidden@pTQyz?{g>G-nZ}MK<>7!?E{*o~u3p`bRN8yF3Rs
zj{%O?cv<V+0o&89R7zUne5zm4ZtzcWL~0^(address@hidden)vBc$z%i937M#&1
address@hidden<{^)vDC<oam=Kp>ZB(cAP&6#D?pVb7&mqUOi4DndD9|mOBg?$E*>&+%({~
address@hidden(lF7)(75Eb;y0K
address@hidden<zJw2XHftL=08qowuYA=q?vF`Hc6mH9D;$AIq9Aor3ps
z^y+U+r4xGn=aK2*d0A;address@hidden;+}_!({hLS?KL5?y_Bb|<XyjET-q~o
address@hidden&xbPt!q<Lds-xMp=MB>u48Y^_n_n?^;Ed19FBm;Wj4d2z<_68sBvABks%hp<
zoT8UGqwrV6%K*Q|address@hidden&wS#UXP?{sBlGz)-wA)MY~gor
address@hidden&#koQC~GZI_n!HW_<0shQ{?x8=8N65ae?gAKuu~+ScCj
zNasGa)9f|>@z|!W?#<tObj#M?9ALRue(address@hidden;Vew$UjWa+Y+Z`Lk1fAZq4
z*UasA+<address@hidden@address@hidden;address@hidden
z&mu9G3UY~VUMy)@m29kt=aR(!`fuy<*j+@;ZJXmQ%?+|O-qgH~*2kM$8XIIwd%U5!
ztx0ZbY-(+6>&address@hidden<aqZtm=AZhxq=G2Sr3F(SzvRgzY;%Pf-?k?Y&L
z+ZyJ|address@hidden(P1Yyyv2uCOD!IP1y;W|A
QcQ(j|=1m*F6cobyFEAqGg#Z8m
literal 0
HcmV?d00001
--
1.6.0.2