From 64a1907acbbf957d75647205555b8071525fd8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwenol=C3=A9=20Beauchesne?= Date: Wed, 9 Oct 2002 13:31:28 +0000 Subject: - Add x86-64 support with all.img for now as other boot images are way too big at the moment - Use isolinux on x86-64 too and stop deliberate call to boot_img_i386() - Fix Makefile when BOOT_IMG only contains all.img - "Macroize" references to ramdis_size - Add symlink for /lib64 on lib64 architectures since that's not already in stage1-data/stage1.tar.bz2 --- make_boot_img | 98 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 28 deletions(-) (limited to 'make_boot_img') diff --git a/make_boot_img b/make_boot_img index 269be0e5a..84057a5d0 100755 --- a/make_boot_img +++ b/make_boot_img @@ -14,7 +14,11 @@ 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 = ($arch =~ /ia64/ ? 120000 : + ($arch =~ /x86_64/ ? 48000 : 32000)); + +$default_append = "ramdisk_size=$ramdisk_size root=/dev/ram3"; $default_vga = "vga=788"; $instdir = "mdk-stage1"; @@ -72,13 +76,13 @@ foreach (@kernels) { rename("$img-$main", "$img"); } } -if ($arch =~ /i.86/ && $img =~ /all/) { +if ($arch =~ /i.86|x86_64/ && $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); } @@ -97,15 +101,16 @@ sub initrd { my $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) : ($arch =~ /x86_64/ ? 4000 : ($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 +118,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"; @@ -210,6 +215,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=4096"; + _ "/sbin/mkfs.vfat $img 4096"; + _ "$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 text +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 +291,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 +345,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 +430,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 +462,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 -- cgit v1.2.1