diff options
author | Dexter Morgan <dmorgan@mageia.org> | 2011-06-02 20:51:35 +0000 |
---|---|---|
committer | Dexter Morgan <dmorgan@mageia.org> | 2011-06-02 20:51:35 +0000 |
commit | a9b2bdafaf625d10aef2f476aa4014fd36c846bc (patch) | |
tree | 2364afc0ee6739b59a25c44d68c9f003bcaf03d9 /images | |
download | drakx-backup-do-not-use-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar drakx-backup-do-not-use-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar.gz drakx-backup-do-not-use-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar.bz2 drakx-backup-do-not-use-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.tar.xz drakx-backup-do-not-use-a9b2bdafaf625d10aef2f476aa4014fd36c846bc.zip |
Branch for updates
Diffstat (limited to 'images')
-rw-r--r-- | images/.perl_checker | 1 | ||||
-rw-r--r-- | images/Makefile | 57 | ||||
-rw-r--r-- | images/NEWS | 225 | ||||
-rw-r--r-- | images/advanced.msg.xml | 17 | ||||
-rw-r--r-- | images/help.msg.xml | 21 | ||||
-rwxr-xr-x | images/make_boot_img | 834 | ||||
-rwxr-xr-x | images/update_kernel | 80 |
7 files changed, 1235 insertions, 0 deletions
diff --git a/images/.perl_checker b/images/.perl_checker new file mode 100644 index 000000000..6d167b870 --- /dev/null +++ b/images/.perl_checker @@ -0,0 +1 @@ +XML::Parser diff --git a/images/Makefile b/images/Makefile new file mode 100644 index 000000000..69dc5ab9a --- /dev/null +++ b/images/Makefile @@ -0,0 +1,57 @@ +include ../Makefile.config + +VERSION=1.54 +PRODUCT=drakx-installer-images +KERNELS=$(shell rpm -qf /lib/modules/2.*) + +IMAGES_DEST = $(ROOTDEST)/install/images + +all: images + +images: all.kernels + DISTRIB_DESCR=$(DISTRIB_DESCR) ./make_boot_img + rm -rf images/alternatives + if [ `ls images/*.img-* 2>/dev/null | wc -l` -gt 0 ]; then \ + mkdir images/alternatives; cd images/alternatives; mv ../*.img-* .; md5sum *.img-* > MD5SUM; \ + fi + cd images ; md5sum *.{img,iso}* > MD5SUM + +all.kernels: update_kernel ../kernel/list_modules.pm + ./update_kernel $(KERNELS) + +dist: tar +tar: + @rm -rf $(PRODUCT)*.tar* $(PRODUCT)-$(VERSION) + @if [ -e ".svn" ]; then \ + $(MAKE) dist-svn; \ + elif [ -e "../.git" ]; then \ + $(MAKE) dist-git; \ + else \ + echo "Unknown SCM (not SVN nor GIT)";\ + exit 1; \ + fi; + $(info $(PRODUCT)-$(VERSION).tar.bz2 is ready) + +dist-svn: + mkdir -p $(PRODUCT)-$(VERSION) + svn export -q -rBASE . $(PRODUCT)-$(VERSION)/images + svn export -q -rBASE ../kernel $(PRODUCT)-$(VERSION)/kernel + cp ../Makefile.config $(PRODUCT)-$(VERSION)/ + tar cfa $(PRODUCT)-$(VERSION).tar.xz $(PRODUCT)-$(VERSION) + rm -rf $(PRODUCT)-$(VERSION) + +dist-git: + @cd ..; git archive --prefix=$(PRODUCT)-$(VERSION)/ HEAD images kernel Makefile.config | bzip2 >images/$(PRODUCT)-$(VERSION).tar.bz2; + +clean: + rm -rf images isolinux all.kernels modules.description + find . -name "*~" -o -name ".#*" | xargs rm -f + +install: + install -d $(IMAGES_DEST) + rm -rf $(IMAGES_DEST)/alternatives + cp -r images/* $(IMAGES_DEST) + ifneq (,$(findstring $(ARCH), i386 x86_64)) + rm -rf $(ROOTDEST)/isolinux + cp -af isolinux $(ROOTDEST) + endif diff --git a/images/NEWS b/images/NEWS new file mode 100644 index 000000000..abf60aab0 --- /dev/null +++ b/images/NEWS @@ -0,0 +1,225 @@ +Version 1.54 - 20 May 2011 by Olivier Blin +- add ums-* (USB mass storage) modules in disk/usb category +- merge mkdosfs patch from packages SVN + (to replace mkdosfs-with-dir which requires obsolete perl-suid) + +Version 1.53 - 5 May 2011 by Anne Nicolas +- make boot.iso isohybrid + +Version 1.52 - 25 Apr 2011, by Thomas Backlund +- add sdhci-pci to card-reader list +- add xhci-hcd (usb3 support) + +Version 1.51 - 2 Apr 2011, by Thomas Backlund + +- update modules list needed for md raid456 and dm-raid 4/5/6 target +- compress tarball with xz + +Version 1.50 - 13 Oct 2010, by Thierry Vignaud + +- 2011.0 build + +Version 1.49 - 27 May 2010, by Olivier Blin + +- disable restore option + +Version 1.48 - 28 February 2010, by Thierry Vignaud + +- handle new SCSI driver: mpt2sas (#57833) + +Version 1.47 - 4 January 2010, by Pascal Terjan + +- use /bin/busybox.static + +Version 1.46 - 12 October 2009, by Olivier Blin + +- properly fix FileHandle issue + +Version 1.45 - 12 October 2009, by Thierry Vignaud + +- fix firmware again (#53220) + +Version 1.44 - 6 October 2009, by Thierry Vignaud + +- do not do anything anymore with bootsplash.cfg + +Version 1.43 - 22 September 2009, by Olivier Blin + +- fix firmware loading (#49195) +- revert squashfs-lzma and sqlzma inclusion (this breaks install) +- list asix module in network/usb group + +Version 1.42 - 9 September 2009, by Pascal Terjan + +- include squashfs-lzma and sqlzma kernel modules in all.rdz +- add /dev/ptmx (for screen to work) +- drop duplicated code including busybox, ka version is better than + the one of DEBUGSTAGE1 +- embed all firmwares that are needed by the modules we embed + +Version 1.40 - 14 April 2009, by Pascal Terjan + +- handle firmware loading in stage2 too + +Version 1.39 - 6 April 2009, by Pascal Terjan + +- fix firmware helper generation + +Version 1.38 - 3 April 2009, by Thierry Vignaud + +- include firmwares for most common network cards (#49195) +- pass restore instead of --restore option +- add a userspace helper to load firmwares + +Version 1.37 - 3 April 2009, by Pascal Terjan + +- fix crypto module names when arch is not i586 (#46814) + +Version 1.36 - 9 March 2009, by Thierry Vignaud + +- add /dev/random and /dev/urandom (for curl) + +Version 1.35 - 18 February 2009, by Thierry Vignaud + +- pass --restore instead of restore option + +Version 1.34 - 10 February 2009, by Thierry Vignaud + +- enable to select restore option + +Version 1.33 - 23 January 2009, by Christophe Fergeau + +- adjust to new syslinux 3.72 gfxboot COM32 module + +Version 1.32 - 15 January 2008, by Thierry Vignaud + +- include: + o network drivers: enic, et131x, qlge, smsc95xx, sxg & w35und + o IDE driver: tx4939ide +- ext4dev was renamed as ext4 in 2.6.29-rc1 (keep ext4dev for older kernels) + +Version 1.31 - 19 September 2008, by Pascal "pixel" Rigaux + +- add modules "sha256_generic cbc amd768_rng" for crypsetup/LUKS + +Version 1.30 - 12 June 2008, by Olivier "blino" Blin + +- handle ide-cd being renamed as ide-cd_mod + +Version 1.29 - 2 April 2008, by Olivier "blino" Blin + +- use "Mdv Boot ISO" as label for boot.iso + +Version 1.28 - 12 February 2008, by Olivier "blino" Blin + +- restore full modules.alias (depmod keeps only available modules in + modules.alias, but we want them all) + +Version 1.27 - 12 February 2008, by Olivier "blino" Blin + +- add modules in /modules/`uname -r` and use depmod to build + modules.dep and modules.alias +- remove symlinks in toplevel /modules +- fix custom bootsplash theme support + +Version 1.26 - 21 December 2007, by Olivier "blino" Blin + +- rebuild with list_modules to handle atl2 ethernet driver +- fix live stage2 support + +Version 1.25 - 12 December 2007, by Pascal "Pixel" Rigaux + +- rebuild for new list_modules + +Version 1.24 - 15 October 2007, by Olivier "blino" Blin + +- rebuild for new list_modules (to include ipw3945) + +Version 1.23 - 17 September 2007, by Pascal "Pixel" Rigaux + +- add dm-zero for dmraid + +Version 1.22 - 11 September 2007, by Olivier "blino" Blin + +- add /lib/module-init-tools/ldetect-lst-modules.alias + +Version 1.21 - 7 September 2007, by Olivier "blino" Blin + +- add jmicron driver +- provide /usr/share/ldetect-lst/*-modules.alias in installer images + +Version 1.20 - 31 August 2007, by Pascal "Pixel" Rigaux + +- dynamically determine the size of all.img + +Version 1.19 - 27 August 2007, by Olivier "blino" Blin + +- add raid456 module + +Version 1.18 - 21 August 2007, by Olivier "blino" Blin + +- release with latest scripts from drakx/kernel + +Version 1.17 - 21 August 2007, by Olivier "blino" Blin + +- keep modules without dependencies in modules.dep + +Version 1.16 - 21 August 2007, by Olivier "blino" Blin + +- build with new list_modules + +Version 1.15 - 15 August 2007, by Olivier "blino" Blin + +- add pcitable, usbtable and pci.ids +- fix typos affecting mtab and /var/run creation +- add a /lib/modules symlink + +Version 1.14 - 9 August 2007, by Pascal "Pixel" Rigaux + +- update_kernel: now require install rpms or rpm files as arguments + (this allow specifying precisely which installed kernels are used) + +Version 1.13 - 8 August 2007, by Pascal "Pixel" Rigaux + +- add modules.alias in /modules/<version> as required by stage2 with new libldetect +- add unionfs module +- revert isolinux starting install by default instead of booting on harddrive (#32040) + +Version 1.12 - 17 July 2007, by Olivier "blino" Blin + +- add ide-disk module + +Version 1.11 - 29 June 2007, by Pascal "Pixel" Rigaux + +- increase all.img size to 10.5MB +- default to theme Mandriva-Free, and allow setting another one through THEME + environment variable + +Version 1.9 - 3 April 2007, by Pascal "Pixel" Rigaux + +- include mmc_block for card readers + +Version 1.8 - 23 March 2007, by Pascal "Pixel" Rigaux + +- restore F1 & F2 in boot.iso (#29766) + +Version 1.6 - 14 March 2007, by Olivier Blin + +- add tifm modules (Titi) + +Version 1.5 - 9 March 2007, by Pascal "Pixel" Rigaux + +- copy isolinux images for x86_64 as well + +Version 1.4 - 8 March 2007, by Pascal "Pixel" Rigaux + +- restore vga= and automatic= default options. + also restore noacpi, alt0, vgalo, vgahi, text entries + (all this is needed when gfxboot is not working or not there) + +Version 1.3 - 16 February 2007, by Pascal "Pixel" Rigaux + +- rely on gfxboot for options (vga=, automatic=...) +- really use memtest instead of memtest.bin + (with file name "memtest.bin" it fails with error 8000, with "memtest" it works) + (it seems to be an ancient bug as far as google says) diff --git a/images/advanced.msg.xml b/images/advanced.msg.xml new file mode 100644 index 000000000..9f0bb1818 --- /dev/null +++ b/images/advanced.msg.xml @@ -0,0 +1,17 @@ +<document> +The following install types may be used instead of previously notified : + o <white>vgahi</white> for high resolution graphical installation. + o <white>vga16</white> for 640x480 in 16 colors graphical installation. + +The following options may be added on the command line : + o <white>readonly=1</white> to disable editing disk partitions. + o <white>display=ackbar:0</white> to export display to <blue>ackbar</blue> machine screen 0 during + installation (only for network installations). + o <white>noauto</white> to disable automatic detection. + o <white>nodmraid</white> to disable BIOS software RAID. + o <white>updatemodules</white> to use the special update floppy containing modules updates. + o <white>patch</white> to use a patch from the floppy (file named <blue>patch.pl</blue>). + o <white>auto_install=floppy</white> to enable auto_install using <blue>auto_inst.cfg</blue> file on the + floppy. + o <white>memtest</white> to test your computer RAM for faulty memory modules. +</document> diff --git a/images/help.msg.xml b/images/help.msg.xml new file mode 100644 index 000000000..358dcf248 --- /dev/null +++ b/images/help.msg.xml @@ -0,0 +1,21 @@ +<document> + <green>Welcome to <blue>Mageia</blue> install help</green> + +In most cases, the best way to get started is to simply press the <yellow><Enter></yellow> key. +If you experience problems with standard install, try one of the following +install types (type the highlighted text and press <yellow><Enter></yellow>): + + o <white>text</white> for text installation instead of the graphical one. + o <white>linux</white> for standard graphical installation at normal resolution. + o <white>linux vga=785</white> for low resolution graphical installation. + + +To repair an already installed system type <white>rescue</white> followed +by <yellow><Enter></yellow>. + +You can also pass some <white><specific kernel options></white> to the Linux kernel. +For example, try <white>linux noapic</white> if your system has trouble operating +your network adapter correctly. +<red>NOTE</red>: You cannot pass options to modules (SCSI, ethernet card) or devices +such as CD-ROM drives in this way. If you need to do so, use noauto mode. +</document> diff --git a/images/make_boot_img b/images/make_boot_img new file mode 100755 index 000000000..5b6fbc5f2 --- /dev/null +++ b/images/make_boot_img @@ -0,0 +1,834 @@ +#!/usr/bin/perl + +use Config; +use FileHandle; +use MDK::Common; +use POSIX; + +Config->import; +my ($arch) = $Config{archname} =~ /(.*?)-/; + +my $default_append = ''; +my $default_acpi = ''; +my $default_vga = "vga=788 splash=silent"; +my $timeout = 150; +my $isolinux_bin = $arch eq 'x86_64' ? '/usr/lib/syslinux/isolinux-x86_64.bin' : '/usr/lib/syslinux/isolinux-i586.bin'; +my $lib = $arch eq 'x86_64' ? 'lib64' : 'lib'; + +my $tmp_mnt = '/tmp/drakx_mnt'; +my $tmp_initrd = '/tmp/drakx_initrd'; + +my $sudo; +if ($>) { + $sudo = "sudo"; + $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; +} + +sub __ { print @_, "\n"; system(@_) } +sub _ { __ @_; $? and die } +sub mke2fs { + my ($f) = @_; + _ "/sbin/mke2fs -q -m 0 -F -s 1 $f"; + _ "/sbin/tune2fs -c 0 -U clear -T 1970010101 $f"; +} + +_ "mkdir -p $tmp_mnt"; +mkdir "images"; + +my @kernels = chomp_(cat_('all.kernels/.list')); + +my @all_images = ( + if_($arch =~ /i.86/, 'isolinux', 'boot.iso', 'all.img', 'hd_grub.img'), + if_($arch =~ /x86_64/, 'isolinux', 'boot.iso', 'all.img', 'hd_grub.img'), + if_($arch =~ /ia64/, 'all.img'), + if_($arch =~ /ppc/, 'all.img'), + ); + +my @images = @ARGV ? @ARGV : map { "images/$_" } @all_images; + +foreach my $img (@images) { + my ($type, $I, $extension) = $img =~ m!([^/]*)(64)?\.([^.]*)$!; + + if ($img =~ /hd_grub/) { + hd_grub($img); + } elsif ($img =~ /isolinux/) { + isolinux(\@kernels); + + if (my ($tftpboot) = grep { -e $_ } qw(/tftpboot /var/lib/tftpboot)) { + system("/bin/cp -f isolinux/alt0/* $tftpboot"); + } + } elsif ($img =~ /boot.iso/) { + boot_iso($img, \@kernels); + } elsif ($extension eq 'rdz') { + initrd($type, $I, "$img-$_") foreach @kernels; + } elsif ($extension eq 'img') { + print STDERR "calling boot_img_$arch for $img\n"; + $::{"boot_img_$arch"}->($type, $I, "$img-$_", "all.kernels/$_/vmlinuz") foreach @kernels; + rename("$img-$kernels[0]", $img); + } else { + die "unknown image $img"; + } +} + +sub syslinux_color { + "0" . { + default => '7', + blue => '9', + green => 'a', + red => 'c', + yellow => 'e', + white => 'f', + }->{$_[0]} || die "unknown color $_[0]\n"; +} + +sub syslinux_msg { + my ($msg_xml_file, @more_text) = @_; + + require XML::Parser; + + sub xml_tree2syslinux { + my ($current_color, $tree) = @_; + my (undef, @l) = @$tree; + join('', map { + my ($type, $val) = @$_; + if ($type eq '0') { + $val; + } else { + syslinux_color($type) . xml_tree2syslinux($type, $val) . syslinux_color($current_color); + } + } group_by2(@l)); + } + + print "parsing $msg_xml_file\n"; + my $tree = XML::Parser->new(Style => 'Tree')->parsefile($msg_xml_file); + $tree->[0] eq 'document' or die "bad file $msg_xml_file\n"; + my $text = xml_tree2syslinux('default', $tree->[1]); + + pack("C*", 0x0E, 0x80, 0x03, 0x00) . "" + . $text . join('', @more_text) + . "\n" . syslinux_color('red') . "[F1-Help] [F2-Advanced Help]" . syslinux_color('default') . "\n"; +} + +sub syslinux_cfg { + my ($entries, $b_gfxboot) = @_; + my $default = 'linux'; + + my $header = <<EOF; +default $default +prompt 1 +timeout $timeout +display help.msg +implicit 1 +EOF + my $header_gfxboot = <<EOF; +ui gfxboot.com bootlogo +label harddisk + localboot 0x80 +EOF + my $header_non_gfxboot = <<EOF; +F1 help.msg +F2 advanced.msg +F3 boot.msg +EOF + + my @l = map { + $_->{append} =~ s/\s+/ /g; + "label $_->{label}\n" . + " kernel $_->{kernel}\n" . + ($_->{initrd} ? " append initrd=$_->{initrd} $_->{append}\n" : ''); + } @$entries; + + $header . ($b_gfxboot ? $header_gfxboot : $header_non_gfxboot) . join('', @l); +} + +sub initrd { + my ($type, $I, $img) = @_; + my $stage1_root = $ENV{DEBUGSTAGE1} ? "../mdk-stage1" : "/usr/$lib/drakx-installer-binaries"; + my ($ext) = $img =~ /rdz-(.*)/ or die "bad initrd name ($img)"; + + _ "rm -rf $tmp_initrd"; + mkdir_p("$tmp_initrd$_") foreach qw(/etc /firmware /lib /modules /sbin /tmp /var); + symlink "../modules", "$tmp_initrd/lib/modules"; + symlink "../firmware", "$tmp_initrd/lib/firmware"; + + symlink "/proc/mounts", "$tmp_initrd/etc/mtab"; + symlink "../tmp", "$tmp_initrd/var/run"; + _ "install -D /usr/share/terminfo/l/linux $tmp_initrd/usr/share/terminfo/l/linux"; + foreach ('pcitable', 'usbtable') { + _ "install -D /usr/share/ldetect-lst/$_.gz $tmp_initrd/usr/share/ldetect-lst/$_.gz"; + } + _ "install -D /usr/share/pci.ids $tmp_initrd/usr/share/pci.ids"; + foreach ("/usr/share/ldetect-lst/fallback-modules.alias", "/lib/module-init-tools/ldetect-lst-modules.alias") { + _ "install -D $_ $tmp_initrd$_"; + } + foreach my $firm (glob_("all.kernels$I/$ext/firmware/*")) { + my $dest=$firm; + $dest =~ s|all.kernels$I/$ext/||; + _ "cp -a $firm $tmp_initrd/$dest"; + }; + + output("$tmp_initrd/hotplug", q{#!/bin/sh +if [ "$SUBSYSTEM" = firmware ] && [ "$ACTION" = add ] && [ -n "$FIRMWARE" ] ; then + if [ ! -e /sys$DEVPATH/loading ]; then + exit 1 + fi + if [ -e "/lib/firmware/$FIRMWARE" ]; then + echo 1 > /sys$DEVPATH/loading + cat "/lib/firmware/$FIRMWARE" > /sys$DEVPATH/data + echo 0 > /sys$DEVPATH/loading + exit 0 + fi + echo -1 > /sys$DEVPATH/loading + exit 1 +fi +}); + _ "chmod 755 $tmp_initrd/hotplug"; + symlink "../hotplug", "$tmp_initrd/sbin/hotplug"; + _ "install $stage1_root/init $tmp_initrd/"; + foreach ('stage1', 'pppd', 'pppoe') { + _ "install $stage1_root/$_ $tmp_initrd/sbin/"; + } + + if ($arch !~ /ppc|ia64/) { + mkdir_p("$tmp_initrd/etc/pcmcia"); + _ "cp -a /etc/pcmcia/config.opts $tmp_initrd/etc/pcmcia"; + } + { + my $modz = "all.kernels$I/$ext"; + mkdir_p("$tmp_initrd/modules/$ext"); + __ "tar xC $tmp_initrd/modules/$ext -f $modz/${type}_modules.tar"; + _ "depmod -b $tmp_initrd $ext"; + # depmod keeps only available modules in modules.alias, but we want them all + _ "cp -f $modz/modules.alias $modz/modules.description $tmp_initrd/modules/$ext"; + } + # ka deploy need some files in all.rdz + { + mkdir_p("$tmp_initrd/$_") foreach qw(dev ka proc var/tmp tmp/stage2); + symlink("/sbin", "$tmp_initrd/bin"); + cp_af("/usr/bin/ka-d-client", "$tmp_initrd/ka/ka-d-client"); + cp_af("/bin/busybox.static", "$tmp_initrd/sbin/busybox"); + my @funct = map { /functions:/ .. /^$/ ? do { s/\s//g; split /,/ } : () } `busybox.static`; + shift @funct; + symlink('busybox', $tmp_initrd . "/sbin/$_") foreach @funct; + } + + my $devs = sprintf "ls /dev/{%s}", join(',', qw(console fb0 fd0 loop3 mem null ppp ptmx ptyp0 ram3 random tty[0-7] ttyp0 ttyS0 urandom)); + + _ "(cd $tmp_initrd; (find . ; $devs) | cpio -o -c --quiet) | gzip -9 > $img"; + _ "rm -rf $tmp_initrd"; +} + +sub entries_append { + my ($type) = @_; + + my $automatic = $type =~ /cdrom/ ? 'automatic=method:cdrom ' : ''; + $automatic .= 'changedisk ' if $type =~ /changedisk/; + + my @simple_entries = ( + linux => $default_vga, + vgalo => "vga=785", + vgahi => "vga=791", + text => "text", +# patch => "patch $default_vga", + rescue => "rescue", + ); + my @entries = ( + (map { $_->[0] => "$automatic$default_acpi $_->[1]" } group_by2(@simple_entries)), + noacpi => "$automatic$default_vga acpi=off", +# restore => "$automatic$default_vga restore", + ); + + map { { label => $_->[0], append => join(' ', grep { $_ } $default_append, $_->[1]) } } + group_by2(@entries); +} + +sub syslinux_cfg_all { + my ($type, $b_gfxboot) = @_; + + syslinux_cfg([ + (map { + { kernel => 'alt0/vmlinuz', initrd => 'alt0/all.rdz', %$_ }; + } entries_append($type)), + (map_index { + { label => "alt$::i", kernel => "alt$::i/vmlinuz", initrd => "alt$::i/all.rdz", + append => join(' ', grep { $_ } $default_append, $default_acpi, $default_vga) }; + } @kernels), + { label => 'memtest', kernel => 'memtest' }, + ], $b_gfxboot); +} +sub remove_ending_zero { + my ($img) = @_; + _(q(perl -0777 -pi -e 's/\0+$//' ) . $img); +} + +sub boot_img_i386 { + my ($type, $I, $img, $kernel) = @_; + + _ "rm -rf $tmp_mnt"; mkdir $tmp_mnt; + _ "cat $kernel > $tmp_mnt/vmlinuz"; + + output("$tmp_mnt/help.msg", syslinux_msg('help.msg.xml')); + output("$tmp_mnt/advanced.msg", syslinux_msg('advanced.msg.xml')); + + (my $rdz = $img) =~ s/\.img/.rdz/; + (my $initrd_type = $type) =~ s/-changedisk//; + initrd($initrd_type, $I, $rdz); + my $short_type = substr($type, 0, 8); + + output("$tmp_mnt/syslinux.cfg", + syslinux_cfg([ map { + { kernel => 'vmlinuz', initrd => "$short_type.rdz", %$_ }; + } entries_append($type) ])); + + _ "cp -f $rdz $tmp_mnt/$short_type.rdz"; + unlink $rdz; + + # mtools wants the image to be a power of 32 + my $size = max((ceil(chomp_(`du -s -k $tmp_mnt`) / 32) * 32) + 128, 1440); + _ "dd if=/dev/zero of=$img bs=1k count=$size"; + + _ "/sbin/mkdosfs $img"; + _ "mcopy -i $img $tmp_mnt/* ::"; + _ "syslinux $img"; + _ "rm -rf $tmp_mnt"; +} + +# alias to x86 variant, slightly bigger with images though +sub boot_img_x86_64 { &boot_img_i386 } + +sub boot_img_alpha { + my ($type, $I, $img) = @_; + + __ "$sudo umount $tmp_mnt 2>/dev/null"; + _ "dd if=/dev/zero of=$img bs=1k count=1440"; + mke2fs($img); + _ "/sbin/e2writeboot $img /boot/bootlx"; + _ "$sudo mount -t ext2 $img $tmp_mnt -o loop"; + _ "cp -f vmlinux.gz $tmp_mnt"; + -f "$type.rdz" ? _ "cp -f $type.rdz $tmp_mnt" : initrd($type, $I, "$tmp_mnt/$type.rdz"); + + mkdir "$tmp_mnt/etc", 0777; + output("$tmp_mnt/etc/aboot.conf", +"0:vmlinux.gz initrd=$type.rdz rw $default_append $type +1:vmlinux.gz initrd=$type.rdz rw $default_append text $type +"); + _ "sync"; + _ "df $tmp_mnt"; +} + +sub boot_img_ia64 { + my ($type, $_I, $img, $kernel) = @_; + my $rdz = $img; $rdz =~ s/\.img/.rdz/; + + __ "$sudo umount $tmp_mnt 2>/dev/null"; + _ "dd if=/dev/zero of=$img bs=1k count=16384"; + _ "mkdosfs $img"; + _ "$sudo mount -t vfat $img $tmp_mnt -o loop,umask=000"; + _ "$sudo cp -f $kernel $tmp_mnt/vmlinux"; + _ "cp -f $rdz $tmp_mnt/$type.rdz"; + _ "$sudo cp -f tools/ia64/elilo.efi $tmp_mnt"; + output("$tmp_mnt/elilo.conf", qq( +prompt +timeout=50 + +image=vmlinux + label=linux + initrd=$type.rdz + append=" ramdisk_size=120000" + read-only + +image=vmlinux + label=rescue + initrd=$type.rdz + append=" rescue ramdisk_size=120000" +")); + _ "sync"; + _ "df $tmp_mnt"; + +} + +sub boot_img_sparc { + my ($type, $I, $_img) = @_; + if ($type =~ /^live(.*)/) { + #- hack to produce directly into /export the needed file for cdrom boot. + my $dir = "/export"; + my $boot = "boot"; #- non-absolute pathname only! + + _ "mkdir -p $dir/$boot"; + _ "cp -f /boot/cd.b /boot/second.b $dir/$boot"; + _ "cp -f vmlinux$1 $dir/$boot/vmlinux$1"; + -f "live$1.rdz" ? _ "cp -f live$1.rdz $dir/$boot" : initrd($type, $I, "$dir/$boot/live$1.rdz"); + + output("$dir/$boot/silo.conf", qq( +partition=1 +default=linux +timeout=100 +read-write +message=/$boot/boot.msg +image="cat /$boot/boot.msg" + label=1 + single-key +image="cat /$boot/general.msg" + label=2 + single-key +image="cat /$boot/expert.msg" + label=3 + single-key +image="cat /$boot/rescue.msg" + label=4 + single-key +image="cat /$boot/kickit.msg" + label=5 + single-key +image="cat /$boot/param.msg" + label=6 + single-key +image[sun4c,sun4d,sun4m]=/$boot/vmlinux + label=linux + alias=install + initrd=/$boot/live.rdz + append="ramdisk_size=128000" +image[sun4c,sun4d,sun4m]=/$boot/vmlinux + label=text + initrd=/$boot/live.rdz + append="ramdisk_size=128000 text" +image[sun4c,sun4d,sun4m]=/$boot/vmlinux + label=expert + initrd=/$boot/live.rdz + append="ramdisk_size=128000 expert" +image[sun4c,sun4d,sun4m]=/$boot/vmlinux + label=ks + initrd=/$boot/live.rdz + append="ramdisk_size=128000 ks" +image[sun4c,sun4d,sun4m]=/$boot/vmlinux + label=rescue + initrd=/$boot/live.rdz + append="ramdisk_size=128000 rescue" +image[sun4u]=/$boot/vmlinux64 + label=linux + alias=install + initrd=/$boot/live64.rdz + append="ramdisk_size=128000" +image[sun4u]=/$boot/vmlinux64 + label=text + initrd=/$boot/live64.rdz + append="ramdisk_size=128000 text" +image[sun4u]=/$boot/vmlinux64 + label=expert + initrd=/$boot/live64.rdz + append="ramdisk_size=128000 expert" +image[sun4u]=/$boot/vmlinux64 + label=ks + initrd=/$boot/live64.rdz + append="ramdisk_size=128000 ks" +image[sun4u]=/$boot/vmlinux64 + label=rescue + initrd=/$boot/live64.rdz + append="ramdisk_size=128000 rescue" +")); + + output("$dir/$boot/README", " +To Build a Bootable CD-ROM, try: + genisoimage -R -o t.iso -s /$boot/silo.conf /export +"); + } elsif ($type =~ /^tftprd(.*)/) { + my $dir = "/export"; + my $boot = "images"; + my $setarch = $1 ? "sparc64" : "sparc32"; + + _ "mkdir -p $dir/$boot"; + -f "$type.rdz" or initrd($type, $I, "$type.rdz"); + _ "cp -f vmlinux$1.aout $dir/$boot/$type.img"; + _ "$setarch kernel$1/src/arch/sparc$1/boot/piggyback $dir/$boot/$type.img kernel$1/boot/System.map $type.rdz"; + } elsif ($type =~ /^tftp(.*)/) { + my $dir = "/export"; + my $boot = "images"; + + _ "mkdir -p $dir/$boot"; + _ "cp -f vmlinux$1.aout $dir/$boot/$type.img"; + } else { + my $dir = "floppy"; + __ "$sudo umount $tmp_mnt 2>/dev/null"; + _ "rm -rf $dir"; + _ "mkdir -p $dir"; + _ "cp -f /boot/fd.b /boot/second.b $dir"; + _ "cp -f vmlinuz$I $dir/vmlinux$I.gz"; + -f "$type.rdz" ? _ "cp -f $type.rdz $dir" : initrd($type, $I, "$dir/$type.rdz"); + + output("$dir/boot.msg", " +Welcome to Mageia 1 + +Press <Enter> to install or upgrade a system 7mMageia7m +"); + + output("$dir/silo.conf", qq( +partition=1 +default=linux +timeout=100 +read-write +message=/boot.msg +image=/vmlinux$I.gz + label=linux + initrd=/$type.rdz + append="ramdisk_size=128000 $type" +")); + _ "genromfs -d $dir -f /dev/ram -A 2048,/.. -a 512 -V 'DrakX boot disk'"; + _ "$sudo mount -t romfs /dev/ram $tmp_mnt"; + _ "silo -r $tmp_mnt -F -i /fd.b -b /second.b -C /silo.conf"; + _ "$sudo umount $tmp_mnt"; + _ "dd if=/dev/ram of=$type.img bs=1440k count=1"; + _ "sync"; + _ "$sudo mount -t romfs /dev/ram $tmp_mnt"; + _ "df $tmp_mnt"; + } +} + +sub boot_img_ppc { + my ($_type, $I, $_img, $_kernel) = @_; + foreach (glob("all.kernels/*")) { + my $ext = basename($_); + if ($ext =~ /legacy/) { + initrd("all", $I, "images/all.rdz-$ext"); + _ "mv images/all.rdz-$ext images/all.rdz-legacy"; + _ "cp $_/vmlinuz images/vmlinux-legacy"; + } + elsif ($ext =~ /2.6/) { + initrd("all", $I, "images/all.rdz-$ext"); + _ "mv images/all.rdz-$ext images/all.rdz"; + _ "cp $_/vmlinuz images/vmlinux"; + } + } + _ "cp -f /usr/lib/yaboot/yaboot images/yaboot"; + + output("images/ofboot.b", '<CHRP-BOOT> +<COMPATIBLE> +MacRISC +</COMPATIBLE> +<DESCRIPTION> +Mageia PPC bootloader +</DESCRIPTION> +<BOOT-SCRIPT> +" screen" output +load-base release-load-area +dev screen +" "(0000000000aa00aa0000aaaaaa0000aa00aaaa5500aaaaaa)" drop 0 8 set-colors +" "(5555555555ff55ff5555ffffff5555ff55ffffff55ffffff)" drop 8 8 set-colors +device-end +3 to foreground-color +0 to background-color +" "(0C)" fb8-write drop +" Booting Mageia PPC..." fb8-write drop 100 ms +boot cd:,\boot\yaboot +</BOOT-SCRIPT> +<OS-BADGE-ICONS> +1010 +000000000000F8FEACF6000000000000 +0000000000F5FFFFFEFEF50000000000 +00000000002BFAFEFAFCF70000000000 +0000000000F65D5857812B0000000000 +0000000000F5350B2F88560000000000 +0000000000F6335708F8FE0000000000 +00000000005600F600F5FD8100000000 +00000000F9F8000000F5FAFFF8000000 +000000008100F5F50000F6FEFE000000 +000000F8F700F500F50000FCFFF70000 +00000088F70000F50000F5FCFF2B0000 +0000002F582A00F5000008ADE02C0000 +00090B0A35A62B0000002D3B350A0000 +000A0A0B0B3BF60000505E0B0A0B0A00 +002E350B0B2F87FAFCF45F0B2E090000 +00000007335FF82BF72B575907000000 +000000000000ACFFFF81000000000000 +000000000081FFFFFFFF810000000000 +0000000000FBFFFFFFFFAC0000000000 +000000000081DFDFDFFFFB0000000000 +000000000081DD5F83FFFD0000000000 +000000000081DDDF5EACFF0000000000 +0000000000FDF981F981FFFF00000000 +00000000FFACF9F9F981FFFFAC000000 +00000000FFF98181F9F981FFFF000000 +000000ACACF981F981F9F9FFFFAC0000 +000000FFACF9F981F9F981FFFFFB0000 +00000083DFFBF981F9F95EFFFFFC0000 +005F5F5FDDFFFBF9F9F983DDDD5F0000 +005F5F5F5FDD81F9F9E7DF5F5F5F5F00 +0083DD5F5F83FFFFFFFFDF5F835F0000 +000000FBDDDFACFBACFBDFDFFB000000 +000000000000FFFFFFFF000000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFF0000000000 +0000000000FFFFFFFFFFFFFF00000000 +00000000FFFFFFFFFFFFFFFFFF000000 +00000000FFFFFFFFFFFFFFFFFF000000 +000000FFFFFFFFFFFFFFFFFFFFFF0000 +000000FFFFFFFFFFFFFFFFFFFFFF0000 +000000FFFFFFFFFFFFFFFFFFFFFF0000 +00FFFFFFFFFFFFFFFFFFFFFFFFFF0000 +00FFFFFFFFFFFFFFFFFFFFFFFFFFFF00 +00FFFFFFFFFFFFFFFFFFFFFFFFFF0000 +000000FFFFFFFFFFFFFFFFFFFF000000 +</OS-BADGE-ICONS> +</CHRP-BOOT> +'); + + output("images/yaboot.conf", ' +init-message = "\nWelcome to Mageia PPC!\nHit <TAB> for boot options.\n\n" +timeout = 150 +device=cd: +default = install-gui +message=/boot/yaboot.msg + +image = /boot/vmlinux + label = install-gui + initrd = /boot/all.gz + initrd-size = 34000 + append = " ramdisk_size=128000" + +image = /boot/vmlinux-power4 + label = install-gui-power4 + initrd = /boot/all-power4.gz + initrd-size = 34000 + append = " ramdisk_size=128000" + +image = /boot/vmlinux + label = install-text + initrd = /boot/all.gz + initrd-size = 34000 + append = " text ramdisk_size=128000" + +image = /boot/vmlinux-power4 + label = install-text-power4 + initrd = /boot/all-power4.gz + initrd-size = 34000 + append = " text ramdisk_size=128000" + +image = /boot/vmlinux + label = install-gui-old + initrd = /boot/all.gz + initrd-size = 34000 + append = " gui-old ramdisk_size=128000" + +image = /boot/vmlinux-power4 + label = install-gui-old-power4 + initrd = /boot/all-power4.gz + initrd-size = 34000 + append = " gui-old ramdisk_size=128000" + +image = enet:0,vmlinux + label = install-net + initrd = enet:0,all.gz + initrd-size = 34000 + append = " ramdisk_size=128000" + +image = enet:0,vmlinux-power4 + label = install-net-power4 + initrd = enet:0,all-power4.gz + initrd-size = 34000 + append = " ramdisk_size=128000" + +image = enet:0,vmlinux + label = install-net-text + initrd = enet:0,all.gz + initrd-size = 34000 + append = " text ramdisk_size=128000" + +image = enet:0,vmlinux-power4 + label = install-net-text-power4 + initrd = enet:0,all-power4.gz + initrd-size = 34000 + append = " text ramdisk_size=128000" + +image = /boot/vmlinux + label = rescue + initrd = /boot/all.gz + initrd-size = 34000 + append = " rescue ramdisk_size=128000" + +image = /boot/vmlinux-power4 + label = rescue-power4 + initrd = /boot/all-power4.gz + initrd-size = 34000 + append = " rescue ramdisk_size=128000" + +image = enet:0,vmlinux + label = rescue-net + initrd = enet:0,all.gz + initrd-size = 34000 + append = " rescue ramdisk_size=128000" + +image = enet:0,vmlinux-power4 + label = rescue-net-power4 + initrd = enet:0,all-power4.gz + initrd-size = 34000 + append = " rescue ramdisk_size=128000" +'); + + output("images/yaboot.msg", ' +Thanks for choosing Mageia PPC. The following is a short +explanation of the various options for booting the install CD. + +All options ending with "-power4" use the BOOT kernel for ppc 9xx and POWER4. +The default syntax with no suffix uses the BOOT kernel for ppc 6xx 7xx and 7xxx. +The default if you just hit enter is "install-gui". + +install-gui: uses Xorg fbdev mode +install-text: text based install +install-net: allows you to use a minimal boot CD, + pulling the rest of the install from + a network server +install-net-text: text mode network install +rescue: boots the rescue image +rescue-net: boots the rescue image from a network server + +'); + +} + +sub VERSION { + my ($kernels) = @_; + + map { "$_\n" } + $ENV{DISTRIB_DESCR}, + scalar gmtime(), + '', @$kernels; +} + +sub syslinux_all_files { + my ($dir, $kernels) = @_; + + eval { rm_rf($dir) }; mkdir_p($dir); + + @$kernels or die "syslinux_all_files: no kernel\n"; + + $default_vga =~ /788/ or die 'we rely on vga=788 for bootsplash'; + my $theme = $ENV{THEME} || 'Mageia-Free'; + + each_index { + mkdir "$dir/alt$::i", 0777; + _ "cp all.kernels/$_/vmlinuz $dir/alt$::i"; + initrd('all', '', "images/all.rdz-$_"); + rename("images/all.rdz-$_", "$dir/alt$::i/all.rdz"); + } @$kernels; + + _ "install -m 644 -D /boot/memtest* $dir/memtest"; + + output("$dir/help.msg", syslinux_msg('help.msg.xml')); + output("$dir/advanced.msg", syslinux_msg('advanced.msg.xml', + "\nYou can choose the following kernels :\n", + map_index { " o " . syslinux_color('white') . "alt$::i" . syslinux_color('default') . " is kernel $_\n" } @$kernels)); +} + +sub isolinux { + my ($kernels) = @_; + + syslinux_all_files('isolinux', $kernels); + + _ "cp $isolinux_bin isolinux/isolinux.bin"; + _ "cp /usr/lib/syslinux/gfxboot.com isolinux/gfxboot.com"; + output("isolinux/isolinux.cfg", syslinux_cfg_all('cdrom', 1)); + + xbox_stage1() if arch() =~ /i.86/; +} + +sub xbox_stage1() { + my $xbox_kernel = find { /xbox/ } all('all.kernels') or return; + + my $dir = 'isolinux/xbox'; + eval { rm_rf($dir) }; mkdir_p($dir); + + _ "cp all.kernels/$xbox_kernel/vmlinuz $dir"; + initrd('all', '', "images/all.rdz-$xbox_kernel"); + rename("images/all.rdz-$xbox_kernel", "$dir/initrd"); + + _ "cp /usr/share/cromwell/xromwell-installer.xbe $dir/default.xbe"; + output("$dir/linuxboot.cfg", <<EOF); +kernel $dir/vmlinuz +initrd $dir/initrd +append root=/dev/ram3 ramdisk_size=36000 automatic=method:cdrom +EOF +} + +sub boot_iso { + my ($iso, $kernels) = @_; + + syslinux_all_files('.boot_iso/isolinux', $kernels); + + output('.boot_iso/VERSION', VERSION($kernels)); + + # for the boot iso, use standard isolinux + _ "cp /usr/lib/syslinux/isolinux.bin .boot_iso/isolinux/isolinux.bin"; + + my $with_gfxboot = 0; + _ "cp /usr/share/gfxboot/themes/Mageia/install/* .boot_iso/isolinux" if $with_gfxboot; +# _ "cp /home/pixel/cooker/soft/theme/mandriva-gfxboot-theme/inst/* .boot_iso/isolinux" if $with_gfxboot; + #_ "cp /home/teuf/mdv/src/mandriva-gfxboot-theme/inst/* .boot_iso/isolinux" if $with_gfxboot; + _ "cp /usr/lib/syslinux/gfxboot.com .boot_iso/isolinux/gfxboot.com" if $with_gfxboot; + + output('.boot_iso/isolinux/isolinux.cfg', syslinux_cfg_all('', $with_gfxboot)); + + _ "genisoimage -r -f -J -cache-inodes -V 'Mga Boot ISO' -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o $iso .boot_iso"; + _ "isohybrid $iso"; + rm_rf('.boot_iso'); +} + +sub hd_grub { + my ($img) = @_; + my $mapfile = '/tmp/device.map.tmp'; + + my ($grub_dir) = glob("/lib/grub/*-*"); + my @grub_files = map { "$grub_dir/$_" } qw(stage1 stage2); + + # mtools wants the image to be a power of 32 + my $size = ceil((40_000 + sum(map { -s $_ } @grub_files)) / 32 / 1024) * 32; + + _ "dd if=/dev/zero of=$img bs=1k count=$size"; + + _ "rm -rf $tmp_mnt"; mkdir $tmp_mnt; + _ "cp @grub_files $tmp_mnt"; + + output("$tmp_mnt/menu.lst", <<EOF); +timeout 10 +default 0 +fallback 1 + +title Mageia Install + +root (hd0,0) +kernel /cooker/isolinux/alt0/vmlinuz $default_append $default_acpi $default_vga automatic=method:disk +initrd /cooker/isolinux/alt0/all.rdz + +title Help + +pause To display the help, press <space> until you reach "HELP END" +pause . +pause Please see http://qa.mandriva.com/hd_grub.cgi for a friendlier solution +pause . +pause To specify the location where Mageia is copied, +pause choose "Mageia Install", and press "e". +pause Then change "root (hd0,0)". FYI: +pause - (hd0,0) is the first partition on first bios hard drive (usually hda1) +pause - (hd0,4) is the first extended partition (usually hda5) +pause - (hd1,0) is the first partition on second bios hard drive +pause Replace /cauldron to suit the directory containing Mageia +pause . +pause HELP END +EOF + + _ "/sbin/mkdosfs $img"; + _ "mcopy -i $img $tmp_mnt/* ::"; + _ "rm -rf $tmp_mnt"; + + output($mapfile, "(fd0) $img\n"); + + open(my $G, "| grub --device-map=$mapfile --batch"); + print $G <<EOF; +root (fd0) +install /stage1 d (fd0) /stage2 p /menu.lst +quit +EOF + close $G; + unlink $mapfile; +} diff --git a/images/update_kernel b/images/update_kernel new file mode 100755 index 000000000..37084b39f --- /dev/null +++ b/images/update_kernel @@ -0,0 +1,80 @@ +#!/usr/bin/perl + +# this script takes command kernel rpms (either installed rpms or rpm files) +# and create various files in all_kernels/: +# all.kernels/VER/all_modules.tar (used for all.rdz) +# all.kernels/VER/modules.dep +# all.kernels/VER/modules.alias +# all.kernels/VER/vmlinuz + +use lib '../kernel'; +use MDK::Common; +use list_modules; + +(my $karch = arch()) =~ s/^i.86$/i586/; +my $rpm = 'rpm --nosignature'; + + +@ARGV or die "usage: ./update_kernel [--move] (<kernel rpm> ... | <installed kernel name> ...)\n"; + +eval { rm_rf('all.kernels') }; #- remove old things +mkdir 'all.kernels'; + +my @kernels = map { + my $kern_ver = rpm2version($_); + if (/\.rpm$/) { + extract_kernel($_, $kern_ver); + } else { + extract_installed_rpm('', $kern_ver); + } + $kern_ver; +} @ARGV; + +output('all.kernels/.list', map { "$_\n" } @kernels); + +sub system_verbose { print join(' ', @_), "\n"; system(@_) } +sub sys { &system_verbose; $? and die } + +sub rpm2version { + my ($kernel_rpm) = @_; + my $opt = -e $kernel_rpm ? '-qpl' : '-ql'; + `$rpm $opt $kernel_rpm` =~ m!/boot/vmlinuz-(.*)! && $1 or die "can't find vmlinuz in $kernel_rpm (is it installed?)\n"; +} + +sub extract_kernel { + my ($kernel_rpm, $kern_ver) = @_; + + my $dir = "all.kernels/$kern_ver"; + + warn "Extracting kernel $kern_ver\n"; + + eval { rm_rf($dir) }; + mkdir_p("$dir/modules"); + sys("rpm2cpio $kernel_rpm | (cd $dir ; cpio -id)"); + + extract_installed_rpm($dir, $kern_ver); + + eval { rm_rf("$dir$_") } foreach qw(/boot /lib /usr); +} + +sub extract_installed_rpm { + my ($installed_dir, $kern_ver) = @_; + my $local_dir = "all.kernels/$kern_ver"; + mkdir_p("$local_dir/modules"); + + sys('cp', "$installed_dir/boot/vmlinuz-$kern_ver", "$local_dir/vmlinuz"); + sys("cp $installed_dir/lib/modules/$kern_ver/modules.* $local_dir"); + + open(my $F, "find $installed_dir/lib/modules/$kern_ver -name '*.ko.gz' |"); + my $file; while ($file = <$F>) { + chomp($file); + system('cp', $file, "$local_dir/modules/" . basename($file)) == 0 + or warn "conflict for $file\n"; + } + + sys('perl', '../kernel/modules.pl', 'remove_unneeded_modules', $kern_ver); + sys('perl', '../kernel/modules.pl', 'get_firmwares', $kern_ver); + sys('perl', '../kernel/modules.pl', 'make_modules_per_image', $kern_ver); + + rm_rf("$local_dir/modules"); +} |