diff options
Diffstat (limited to 'make_boot_img')
-rwxr-xr-x | make_boot_img | 121 |
1 files changed, 89 insertions, 32 deletions
diff --git a/make_boot_img b/make_boot_img index 269be0e5a..8867bc88a 100755 --- a/make_boot_img +++ b/make_boot_img @@ -1,6 +1,6 @@ #!/usr/bin/perl -@ARGV >= 2 or die "usage: $0 <image> all|other|cdrom|hd|network|usb|blank|pcmcia|live|tftp|tftprd\n"; +@ARGV >= 2 or die "usage: $0 <image> all|other|cdrom|hd|network|usb|blank|pcmcia|live|tftp|tftprd|ka\n"; use Config; use MDK::Common; @@ -14,7 +14,10 @@ my ($arch) = $Config{archname} =~ /(.*?)-/; rename 'all.kernels', 'kernel/all.kernels'; rename 'all.modules', 'kernel/all.modules'; -$default_append = "ramdisk_size=32000 root=/dev/ram3"; +# default ramdisk size +$ramdisk_size = 128000; + +$default_append = "ramdisk_size=$ramdisk_size root=/dev/ram3"; $default_vga = "vga=788"; $instdir = "mdk-stage1"; @@ -41,6 +44,7 @@ $install = $ {{ tftprd => "stage1-full", pcmcia => "stage1-full", network => "stage1-network", + ka => "stage1-full", usb => "stage1-usb", cdrom => "stage1-cdrom", hd => "stage1-disk", @@ -72,13 +76,17 @@ foreach (@kernels) { rename("$img-$main", "$img"); } } +if ($arch =~ /x86_64/ && $img =~ /all/) { + # isolinux is supposed to work on all those new hardware + isolinux($main, @kernels); +} if ($arch =~ /i.86/ && $img =~ /all/) { isolinux($main, @kernels); my ($img, $img_sav) = ("images/cdrom.img-$main", 'images/cdrom.img-sav'); rename($img, $img_sav); $type = 'cdrom'; - boot_img_i386($mnt, $img, "kernel/all.kernels/$main/boot/vmlinu*", sub { $_[0] =~ s/\bautomatic=\S+\b//; "$_[0] changedisk" }); + $::{"boot_img_$arch"}->($mnt, $img, "kernel/all.kernels/$main/boot/vmlinu*", sub { $_[0] =~ s/\bautomatic=\S+\b//; "$_[0] changedisk" }); rename($img, 'images/cdrom-changedisk.img'); rename($img_sav, $img); } @@ -94,18 +102,29 @@ sub initrd { my ($mnt, $img) = @_; my ($ltype, $I) = $type =~ /(.*?)(64)/; $ltype ||= $type; my $tmp = "$ENV{HOME}/tmp/initrd"; - my $tar = "$instdir/stage1-data/stage1.tar.bz2"; + my $tar = ""; + my $katarball = "stage1-with-kadeploy"; +# if ($arch eq "x86_64") {$katarball = $katarball . "x86_64";} + + if ($type eq "ka") { + $tar = "$instdir/stage1-data/" . $katarball . ".tar.bz2"; + $mke2fs = $mke2fs . " -N 700"; + } + else { + $tar = "$instdir/stage1-data/stage1.tar.bz2"; + } __ "$sudo umount $tmp $mnt 2>/dev/null"; - _ "dd if=/dev/zero of=$tmp bs=1k count=" . ($arch =~ /ia64/ ? ($type eq "all" ? 16386 : 16384) : ($type eq "all" ? 4000 : 2000)); + _ "dd if=/dev/zero of=$tmp bs=1k count=" . ($arch =~ /ia64/ ? ($type eq "all" ? 16386 : 16384) : ($type eq "ka" ? 2400 : ($type eq "all" ? 4000 : 2000))); _ "$mke2fs $tmp"; _ "$sudo mount -t ext2 $tmp $mnt -o loop"; _ "$sudo tar xjC $mnt -f $tar"; + symlinkf "/tmp/stage2/lib64", "$mnt/lib64" if ($arch =~ /x86_64/); install_stripped("$instdir/init", "$mnt/sbin"); - install_stripped("$instdir/$install", "$mnt/sbin/stage1"); + install_stripped("$instdir/$install", "$mnt/sbin/stage1"); - if ($type eq "network" || $type eq "usb" || $type eq "all" || $type eq "other" || $type eq "blank") { + if (member($type, qw(network usb all other blank)) && $arch !~ /x86_64/) { install_stripped("$instdir/ppp/pppd-bin", "$mnt/sbin/pppd"); install_stripped("$instdir/rp-pppoe/pppoe-bin", "$mnt/sbin/pppoe"); _ "$sudo mknod $mnt/dev/ppp c 108 0"; @@ -113,7 +132,7 @@ sub initrd { _ "$sudo mknod $mnt/dev/ttyp0 c 3 0"; } - if (member($type, qw(pcmcia all network)) && $arch !~ /ppc/ && $arch !~ /ia64/) { + if (member($type, qw(pcmcia all network)) && $arch !~ /ppc|ia64|x86_64/) { _ "$sudo cp -a /etc/pcmcia $mnt/etc"; _ "cp $mnt/etc/pcmcia/config /tmp/pcmcia_config_tmp"; _ "tools/patch_pcmcia_config.pl /tmp/pcmcia_config_tmp kernel/all.modules/$main/modules.dep"; @@ -140,6 +159,7 @@ sub entries_append { my $automatic = ""; $automatic = "automatic=method:cdrom" if ($type eq "cdrom"); $automatic = "automatic=method:disk" if ($type eq "hd"); + $automatic = "automatic=method:ka,interface:eth0,network:dhcp $DEFAULT_append rescue rw" if ($type eq "ka"); my @simple_entries = ( linux => "$default_vga", @@ -154,7 +174,7 @@ sub entries_append { my @entries = ( (map { $_->[0] => "$automatic $_->[1]" } group_by2(@simple_entries)), if_(member($type, "cdrom", "all"), oem => "automatic=method:cdrom $default_vga rescue oem rw"), - if_($type eq "all", all => "pcmcia $default_vga"), + if_($type eq "all", all => "pcmcia $default_vga"), ); map { [ $_->[0], "$default_append $_->[1]" ] } @@ -168,7 +188,7 @@ sub boot_img_i386 { if ($type eq "hd") { _ "bunzip2 -c $instdir/init-data/msgboot.img.bz2 > $img"; - } elsif ($type eq "all") { + } elsif ($type eq "all" || $type eq "ka") { _ "bunzip2 -c $instdir/init-data/msgboot-graphicallogo-2880.img.bz2 > $img"; } elsif ($type eq "blank") { _ "bunzip2 -c $instdir/init-data/msgboot-blank.img.bz2 > $img"; @@ -210,6 +230,43 @@ F3 boot.msg _ "df $mnt"; } +sub boot_img_x86_64 { + my ($mnt, $img, $kernel) = @_; + + __ "$sudo umount $mnt 2>/dev/null"; + + _ "dd if=/dev/zero of=$img bs=1k count=" . ($type eq "ka" ? 2880 : 1440); + _ "/sbin/mkfs.vfat $img"; + _ "$sudo syslinux -s $img"; + _ "$sudo mount -t vfat -o umask=0 $img $mnt -o loop"; + + _ "cat $kernel > $mnt/vmlinuz"; + my $rdz = $img; $rdz =~ s/\.img/.rdz/; + initrd "${mnt}2", $rdz if ! -e $rdz; + eval { _ "cp -f $rdz $mnt/$type.rdz" }; + if ($@) { + unlink "$mnt/$type.rdz"; + my $avail = (split ' ', `df $mnt`)[-3]; + my $s = int((-s $rdz) / 1024); + die sprintf("not enough room for $rdz: need %d KB (available %d KB < needed %d KB)\n", $s - $avail, $avail, $s); + } + + my $timeout = 72; + output "$mnt/syslinux.cfg", +"default linux +prompt 1 +timeout $timeout +" . join('', map { +"label $_->[0] + kernel vmlinuz + append initrd=$type.rdz $_->[1] +" +} entries_append($type)); + + _ "sync"; + _ "df $mnt"; +} + sub boot_img_alpha { my ($mnt, $img) = @_; @@ -249,14 +306,14 @@ image=vmlinux label=linux root=/dev/ram3 initrd=$type.rdz - append=\" ramdisk_size=120000\" + append=\" ramdisk_size=$ramdisk_size\" read-only image=vmlinux label=rescue root=/dev/ram3 initrd=$type.rdz - append=\" rescue ramdisk_size=120000\" + append=\" rescue ramdisk_size=$ramdisk_size\" "); _ "sync"; _ "df $mnt"; @@ -303,44 +360,44 @@ image[sun4c,sun4d,sun4m]=/$boot/vmlinux label=linux alias=install initrd=/$boot/live.rdz - append=\"ramdisk_size=32000 root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size root=/dev/ram3\" image[sun4c,sun4d,sun4m]=/$boot/vmlinux label=text initrd=/$boot/live.rdz - append=\"ramdisk_size=32000 text root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size text root=/dev/ram3\" image[sun4c,sun4d,sun4m]=/$boot/vmlinux label=expert initrd=/$boot/live.rdz - append=\"ramdisk_size=32000 expert root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size expert root=/dev/ram3\" image[sun4c,sun4d,sun4m]=/$boot/vmlinux label=ks initrd=/$boot/live.rdz - append=\"ramdisk_size=32000 ks root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size ks root=/dev/ram3\" image[sun4c,sun4d,sun4m]=/$boot/vmlinux label=rescue initrd=/$boot/live.rdz - append=\"ramdisk_size=32000 rescue rw root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size rescue rw root=/dev/ram3\" image[sun4u]=/$boot/vmlinux64 label=linux alias=install initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000 root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size root=/dev/ram3\" image[sun4u]=/$boot/vmlinux64 label=text initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000 text root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size text root=/dev/ram3\" image[sun4u]=/$boot/vmlinux64 label=expert initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000 expert root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size expert root=/dev/ram3\" image[sun4u]=/$boot/vmlinux64 label=ks initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000 ks root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size ks root=/dev/ram3\" image[sun4u]=/$boot/vmlinux64 label=rescue initrd=/$boot/live64.rdz - append=\"ramdisk_size=32000 rescue rw root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size rescue rw root=/dev/ram3\" "); output("$dir/$boot/README", " @@ -388,7 +445,7 @@ message=/boot.msg image=/vmlinux$I.gz label=linux initrd=/$type.rdz - append=\"ramdisk_size=32000 $ltype root=/dev/ram3\" + append=\"ramdisk_size=$ramdisk_size $ltype root=/dev/ram3\" "); _ "genromfs -d $dir -f /dev/ram -A 2048,/.. -a 512 -V \'DrakX boot disk\'"; _ "$sudo mount -t romfs /dev/ram $mnt"; @@ -420,56 +477,56 @@ image = cd:,\\\\\\\\vmlinux label = install-novideo root = /dev/ram3 initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 + initrd-size = $ramdisk_size append = \" video=ofonly\" image = cd:,\\\\\\\\vmlinux label = install-atyfb root = /dev/ram3 initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 + initrd-size = $ramdisk_size append = \" video=atyfb:vmode:17\" image = cd:,\\\\\\\\vmlinux label = install-aty128fb root = /dev/ram3 initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 + initrd-size = $ramdisk_size append = \" video=aty128fb:vmode:17\" image = cd:,\\\\\\\\vmlinux label = install-text root = /dev/ram3 initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 + initrd-size = $ramdisk_size append = \" text video=ofonly\" image = enet:0,vmlinux label = install-net root = /dev/ram3 initrd = enet:0,all.gz - initrd-size = 32000 + initrd-size = $ramdisk_size append = \" video=ofonly\" image = enet:0,vmlinux label = install-net-text root = /dev/ram3 initrd = enet:0,all.gz - initrd-size = 32000 + initrd-size = $ramdisk_size append = \" text video=ofonly\" image = cd:,\\\\\\\\vmlinux label = rescue root = /dev/ram3 initrd = cd:,\\\\\\\\all.gz - initrd-size = 32000 + initrd-size = $ramdisk_size append = \" rescue video=ofonly\" image = enet:0,vmlinux label = rescue-net root = /dev/ram3 initrd = enet:0,all.gz - initrd-size = 32000 + initrd-size = $ramdisk_size append = \" rescue video=ofonly\" "); #- seem to need 2 yaboot.conf, one in the root, and one in boot @@ -497,7 +554,7 @@ sub isolinux { } if (-e "isolinux-graphic.bmp") { #- change here for newer picture isolinux-graphic.bmp and newer parameters. - _ "lilo-bmp2mdk mode:0x103 progress:425,173,16,8,64+2 clear:600,800,64+2 pos:0,0 <isolinux-graphic.bmp >isolinux/boot.msg"; + _ "lilo-bmp2mdk mode:0x103 progress:425,173,16,8,64+0 clear:600,800,64+1 pos:0,0 <isolinux-graphic.bmp >isolinux/boot.msg"; } _ "cp /usr/lib/syslinux/isolinux.bin isolinux/isolinux.bin"; output "isolinux/isolinux.cfg", " |