Merge lp:~xnox/debian-cd/s390x-el-torito into lp:~ubuntu-cdimage/debian-cd/ubun3

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 1928
Proposed branch: lp:~xnox/debian-cd/s390x-el-torito
Merge into: lp:~ubuntu-cdimage/debian-cd/ubun3
Diff against target: 197 lines (+175/-0)
2 files modified
tools/boot/xenial/boot-s390x (+6/-0)
tools/gen-s390-cd-kernel.pl (+169/-0)
To merge this branch: bzr merge lp:~xnox/debian-cd/s390x-el-torito
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+283798@code.launchpad.net

Description of the change

El Torito support for s390x.

It builds .iso images that sort of look right, however they verify yet fail to boot in qemu 2.5.
Hoping to build an El Torito enabled image, and request upstream support/feedback as to what is wrong with it.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'tools/boot/xenial/boot-s390x'
--- tools/boot/xenial/boot-s390x 2016-01-18 18:06:53 +0000
+++ tools/boot/xenial/boot-s390x 2016-01-25 13:00:56 +0000
@@ -49,6 +49,8 @@
49cp -lf "$DI_DIR/generic/initrd.ubuntu" $imagedir49cp -lf "$DI_DIR/generic/initrd.ubuntu" $imagedir
50cp -lf "$DI_DIR/generic/kernel.ubuntu" $imagedir50cp -lf "$DI_DIR/generic/kernel.ubuntu" $imagedir
5151
52$BASEDIR/tools/gen-s390-cd-kernel.pl --initrd=$imagedir/initrd.ubuntu --kernel=$imagedir/kernel.ubuntu --outfile=$imagedir/ubuntu.ikr
53
52# Create the files specifying offset and size of the initrd54# Create the files specifying offset and size of the initrd
53perl -e "print pack('N', 0x1000000)" >"$imagedir/initrd.off"55perl -e "print pack('N', 0x1000000)" >"$imagedir/initrd.off"
54perl -e "print pack('N', -s '$imagedir/initrd.ubuntu')" >"$imagedir/initrd.siz"56perl -e "print pack('N', -s '$imagedir/initrd.ubuntu')" >"$imagedir/initrd.siz"
@@ -61,6 +63,10 @@
61# - README63# - README
62cp $BASEDIR/data/$CODENAME/$ARCH/* $imagedir64cp $BASEDIR/data/$CODENAME/$ARCH/* $imagedir
6365
66add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-no-emul-boot"
67add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-b"
68add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "boot/ubuntu.ikr"
69
64# Include the boot$N/-tree into the iso-image70# Include the boot$N/-tree into the iso-image
65add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J"71add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J"
66add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "boot$N"72add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "boot$N"
6773
=== added file 'tools/gen-s390-cd-kernel.pl'
--- tools/gen-s390-cd-kernel.pl 1970-01-01 00:00:00 +0000
+++ tools/gen-s390-cd-kernel.pl 2016-01-25 13:00:56 +0000
@@ -0,0 +1,169 @@
1#!/usr/bin/perl -w
2#
3# Generates a bootable CD-ROM for S/390
4#
5# Copyright (C) 2006 Novell Inc.
6#
7# This program is free software; you can redistribute it and/or
8# modify it under the terms of the GNU General Public License
9# as published by the Free Software Foundation; either version 2
10# of the License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU General Public License for more details.
16#
17# You should have received a copy of the GNU General Public License
18# along with this program; if not, write to the
19# Free Software Foundation, Inc.,
20# 51 Franklin Street,
21# Fifth Floor,
22# Boston, MA 02110-1301,
23# USA.
24#
25# $Id: gen-s390-cd-kernel.pl 107 2009-03-06 11:48:14Z ro $
26
27use FileHandle;
28use Getopt::Long;
29use strict;
30
31# Help text
32#
33sub help($) {
34 my $exitcode = shift || 1;
35 print "Usage: $0 <OPTIONS> - generate a kernel image for CD-ROM boot\n";
36 print "SYNOPSIS: $0 [--initrd=file] \n";
37 print " [--parmfile=file] [--outfile=file] \n";
38 print " [--kernel=file] [--cmdline=string] \n";
39 exit $exitcode;
40}
41
42# Parse command line options
43my ($initrd, $image, $parmfile, $outfile, $cmdline ) =
44 ('/boot/initrd','/boot/image', '', '/tmp/image.cd', 'root=/dev/sda2');
45
46Getopt::Long::Configure ("bundling");
47eval {
48 unless (GetOptions (
49 'i|initrd=s' => \$initrd,
50 'k|kernel=s' => \$image,
51 'p|parmfile=s' => \$parmfile,
52 'o|outfile=s' => \$outfile,
53 'c|cmdline=s' => \$cmdline,
54 'h|help' => sub { help(0); } )) {
55 help(1);
56 }
57};
58
59if ($@) {
60 print "$@";
61 help(1);
62}
63
64# Open input files
65sysopen(image_fh,$image,O_RDONLY) or die "Cannot open $image: $!\n";
66sysopen(initrd_fh,$initrd,O_RDONLY) or die "Cannot $initrd: $!\n";
67
68my $image_size = (stat(image_fh))[7];
69my $initrd_size = (stat(initrd_fh))[7];
70
71# Get the size of the input files
72printf("%s: offset 0x%x len 0x%x (%d blocks)\n",
73 $image, 0, $image_size, ($image_size >> 12) + 1);
74
75# The kernel appearently needs some free space above the
76# actual image (bss? stack?), so use this hard-coded
77# limit (from include/asm-s390/setup.h)
78
79# my $initrd_offset = (($image_size >> 12) + 1) << 12;
80my $initrd_offset = 0x1000000;
81my $boot_size = ((($initrd_offset + $initrd_size) >> 12) + 1 ) << 12;
82printf("%s: offset 0x%x len 0x%x (%d blocks)\n",
83 $initrd, $initrd_offset, $initrd_size, ($initrd_size >>12) + 1);
84printf("%s: len 0x%x (%d blocks)\n",
85 $outfile, $initrd_offset + $initrd_size, $boot_size / 4096);
86
87# Get the kernel command line arguments
88$cmdline .= " " if ($cmdline ne "");
89
90if ($parmfile ne "") {
91 my $line;
92
93 $cmdline = '';
94 open(parm_fh,$parmfile) or die "Cannot open $parmfile: $!\n";
95 while($line=<parm_fh>) {
96 chomp $line;
97 $cmdline .= $line . " ";
98 }
99 close(parm_fh);
100}
101
102if ($cmdline ne "") {
103 chop $cmdline;
104}
105
106# Max length for the kernel command line is 896 bytes
107die "Kernel commandline too long (". length($cmdline) ." bytes)\n" if (length($cmdline) >= 896);
108
109# Now create the image file.
110sysopen(out_fh,$outfile,O_RDWR|O_CREAT|O_TRUNC) or die "Cannot open $outfile: $!\n";
111
112# First fill the entire size with zeroes
113sysopen(null_fh,"/dev/zero",O_RDONLY) or die "Cannot open /dev/zero: $!\n";
114
115my $buffer="";
116my $blocks_read=0;
117while ($blocks_read < ($boot_size >> 12)) {
118 sysread(null_fh,$buffer, 4096);
119 syswrite(out_fh,$buffer);
120 $blocks_read += 1;
121}
122
123print "Read $blocks_read blocks from /dev/zero\n";
124close(null_fh);
125
126# Now copy the image file to location 0
127sysseek(out_fh,0,0);
128$blocks_read = 0;
129while (sysread(image_fh,$buffer, 4096) != 0) {
130 syswrite(out_fh,$buffer,4096);
131 $blocks_read += 1;
132}
133
134print "Read $blocks_read blocks from $image\n";
135close(image_fh);
136
137# Then the initrd to location specified by initrd_offset
138sysseek(out_fh,$initrd_offset,0);
139$blocks_read = 0;
140while (sysread(initrd_fh,$buffer, 4096) != 0) {
141 syswrite(out_fh,$buffer,4096);
142 $blocks_read += 1;
143}
144
145print "Read $blocks_read blocks from $initrd\n";
146
147close(initrd_fh);
148
149# Now for the real black magic.
150# If we are loading from CD-ROM or HMC, the kernel is already loaded
151# in memory by the first loader itself.
152print "Setting boot loader control to 0x10000\n";
153
154sysseek(out_fh,4,0 );
155syswrite(out_fh,pack("N",0x80010000),4);
156
157print "Writing kernel commandline (". length($cmdline) ." bytes):\n$cmdline\n";
158
159sysseek(out_fh,0x10480,0);
160syswrite(out_fh,$cmdline,length($cmdline));
161
162print "Setting initrd parameter: offset $initrd_offset size $initrd_size\n";
163
164sysseek(out_fh,0x1040C,0);
165syswrite(out_fh,pack("N",$initrd_offset),4);
166sysseek(out_fh,0x10414,0);
167syswrite(out_fh,pack("N",$initrd_size),4);
168
169close(out_fh);

Subscribers

People subscribed via source and target branches