diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2001-03-29 22:47:09 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2001-03-29 22:47:09 +0000 |
commit | 84adb9036e99bc2e7560135694197b9312faa9e6 (patch) | |
tree | dfdc79ddfc972f2167c67ff96af51fbec5a7518c /make_boot_img | |
parent | 094971eecb7a5df84b325de8c6ae46e88fc1f0ea (diff) | |
download | drakx-backup-do-not-use-84adb9036e99bc2e7560135694197b9312faa9e6.tar drakx-backup-do-not-use-84adb9036e99bc2e7560135694197b9312faa9e6.tar.gz drakx-backup-do-not-use-84adb9036e99bc2e7560135694197b9312faa9e6.tar.bz2 drakx-backup-do-not-use-84adb9036e99bc2e7560135694197b9312faa9e6.tar.xz drakx-backup-do-not-use-84adb9036e99bc2e7560135694197b9312faa9e6.zip |
support more than one boot kernel :-)
Diffstat (limited to 'make_boot_img')
-rwxr-xr-x | make_boot_img | 48 |
1 files changed, 33 insertions, 15 deletions
diff --git a/make_boot_img b/make_boot_img index 040288345..f18bed11b 100755 --- a/make_boot_img +++ b/make_boot_img @@ -44,12 +44,24 @@ $install = $ {{ hd64 => "stage1-disk", }}{$type} or die; -$img =~ /rdz$/ ? initrd($mnt, $img) : $::{"boot_img_$arch"}->($mnt, $img); +if ($img =~ /rdz$/) { + foreach (glob('all.modules/*')) { + -f $_ and next; + initrd($mnt, $img, $_) ; + } +} else { + foreach (glob('all.kernels/*')) { + $_ =~ 'cardmgr' and next; + my ($kern) = $_ =~ /all.kernels\/([^\/]+)/; + _ "$sudo cp -f all.kernels/$kern/boot/vmlinuz* all.kernels/$kern/vmlinuz"; + $::{"boot_img_$arch"}->($mnt, $img, "all.kernels/$kern/", "all.modules/$kern"); + } +} sub install_stripped { _ "strip $_[0]"; _ "$sudo install $_[0] $_[1]" } sub initrd { - my ($mnt, $img) = @_; + my ($mnt, $img, $modz) = @_; my ($ltype, $I) = $type =~ /(.*?)(64)/; $ltype ||= $type; my $tmp = "$ENV{HOME}/tmp/initrd"; my $tar = "$instdir/stage1-data/stage1.tar.bz2"; @@ -68,44 +80,50 @@ sub initrd { _ "$sudo cp -a /etc/pcmcia $mnt/etc"; _ "$sudo patch -p0 -d $mnt/etc < $instdir/pcmcia_config.patch"; } - _ "$sudo cp -f modules$I/${ltype}_modules.mar $mnt/modules/modules$I.mar" if $type !~ /blank/; - _ "$sudo cp -f modules$I/modules.dep $mnt/modules/"; + $modz ||= "modules$I"; + _ "$sudo cp -f $modz/${ltype}_modules.mar $mnt/modules/modules$I.mar" if $type !~ /blank/; + _ "$sudo cp -f $modz/modules.dep $mnt/modules/"; _ "$sudo umount $mnt"; + + my ($extension) = $modz =~ /.*\/([^\/]+)/; # Workaround for vfat-loop bug (quite touchy) _ "gzip -9f $tmp"; - _ "cp -f $tmp.gz $img"; + _ "cp -f $tmp.gz $img$extension"; _ "rm -f $tmp.gz"; # _ "gzip -9 -c $tmp > $img"; # _ "rm -f $tmp"; } sub boot_img_i386 { - my ($mnt, $img) = @_; + my ($mnt, $img, $kern, $modz) = @_; __ "$sudo umount $mnt 2>/dev/null"; my $automatic = ""; + my ($imgext) = $modz =~ /.*\/([^\/]+)/; if ($type eq "hd") { - _ "bunzip2 -c $instdir/init-data/msgboot.img.bz2 > $img"; + _ "bunzip2 -c $instdir/init-data/msgboot.img.bz2 > $img$imgext"; } elsif ($type eq "all") { - _ "bunzip2 -c $instdir/init-data/msgboot-graphicallogo-2880.img.bz2 > $img"; + _ "bunzip2 -c $instdir/init-data/msgboot-graphicallogo-2880.img.bz2 > $img$imgext"; } else { - _ "bunzip2 -c $instdir/init-data/msgboot-graphicallogo.img.bz2 > $img"; + _ "bunzip2 -c $instdir/init-data/msgboot-graphicallogo.img.bz2 > $img$imgext"; } $automatic = "automatic=method:cdrom" if ($type eq "cdrom"); $automatic = "automatic=method:disk" if ($type eq "hd"); - _ "$sudo mount -t vfat -o umask=0 $img $mnt -o loop"; - _ "cat vmlinuz > $mnt/vmlinuz" if $type !~ /blank/; - initrd("${mnt}2", "$type.rdz") if !-f "$type.rdz"; - eval { _ "cp -f $type.rdz $mnt" }; + _ "$sudo mount -t vfat -o umask=0 $img$imgext $mnt -o loop"; + _ "cat $kern"."vmlinuz > $mnt/vmlinuz" if $type !~ /blank/; + + my ($extension) = $modz =~ /.*\/([^\/]+)/; + initrd("${mnt}2", "$type.rdz", $modz) if !-f "$type.rdz$extension"; + eval { _ "cp -f $type.rdz$extension $mnt/$type.rdz" }; if ($@) { unlink "$mnt/$type.rdz"; my $avail = (split ' ', `df $mnt`)[-3]; - my $s = int((-s "$type.rdz") / 1024); - die sprintf("not enough room for $type.rdz: need %dKB (available %dKB < needed %dKB)\n", $s - $avail, $avail, $s); + my $s = int((-s "$type.rdz$extension") / 1024); + die sprintf("not enough room for $type.rdz$extension: need %dKB (available %dKB < needed %dKB)\n", $s - $avail, $avail, $s); } # my $ftype = $type =~ /^(other|all)$/ ? "cdrom" : $type; |