diff options
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | kernel/update_kernel | 70 | ||||
-rwxr-xr-x | make_boot_img | 10 | ||||
-rw-r--r-- | perl-install/Makefile | 2 | ||||
-rwxr-xr-x | rescue/make_rescue_img | 2 |
5 files changed, 49 insertions, 37 deletions
@@ -49,6 +49,8 @@ install_only: clean: rm -rf images +# force taking new rpms from repository + rm -rf kernel/RPMS for i in $(DIRS); do make -C $$i clean; done find . -name "*~" -o -name ".#*" | xargs rm -f diff --git a/kernel/update_kernel b/kernel/update_kernel index adef926d9..a32878339 100755 --- a/kernel/update_kernel +++ b/kernel/update_kernel @@ -1,9 +1,20 @@ #!/usr/bin/perl +# this script takes kernels rpms from RPMS/ and create various files in all_kernels/ +# for each rpms in RPMS, it does: +# RPMS/kernel-VER-*.rpm -> +# all.kernels/VER/all_modules.tar (used for all.rdz) +# all.kernels/VER/*.mar (used for other rdz) +# all.kernels/VER/modules.cz (used for stage2) +# all.kernels/VER/modules.dep +# all.kernels/VER/vmlinuz +# +# if RPMS is empty, this script tries to find kernels in $main_repository + use MDK::Common; use list_modules; -my $RPMS = '/export/media/main'; +my $main_repository = '/export/media/main'; my $rpm = 'rpm --nosignature'; @@ -11,22 +22,21 @@ my $MOVE = $ARGV[0] eq '--move' && shift; @ARGV <= 1 or die "usage: ./update_kernel [--move] [<kernel rpm>]\n"; +eval { rm_rf('all.kernels') }; #- remove old things +mkdir 'all.kernels'; -mkdir 'all.kernels'; # make sure "all.kernels" directory exists -eval { rm_rf('all.modules') }; #- not used anymore - -my $main = chomp_(cat_('all.kernels/.main')); -my $main_BOOT = chomp_(cat_('all.kernels/.main-BOOT')); +my $main = chomp_(cat_('RPMS/.main')); +my $main_BOOT = chomp_(cat_('RPMS/.main-BOOT')); if (@ARGV) { install_kernel($ARGV[0]); -} else { - update_kernel_from_repository($RPMS, '2.6', 0); - update_kernel_from_repository($RPMS, '2.6', 1); -# update_kernel_from_repository($RPMS, '2.4', 1); - install_kernel(glob("$RPMS/kernel-xbox*"), 1) if arch() =~ /i.86/; +} elsif (! -d 'RPMS') { + update_kernel_from_repository($main_repository, '2.6', 0); + update_kernel_from_repository($main_repository, '2.6', 1); + install_kernel(glob("$main_repository/kernel-xbox*"), 1) if arch() =~ /i.86/; } +extract_kernel($_) foreach glob("RPMS/*.rpm"); sub system_verbose { print join(' ', @_), "\n"; system(@_) } sub sys { &system_verbose; $? and die } @@ -37,33 +47,37 @@ sub rpm2version { } sub update_kernel_from_repository { - my ($RPMS, $main_ver, $is_BOOT) = @_; + my ($repository, $main_ver, $is_BOOT) = @_; my $rpm_wildcard = 'kernel-' . ($is_BOOT ? 'BOOT-' : (arch() =~ /i.86/ ? 'i586-up-1GB-' : '')) . $main_ver . '*.rpm'; - my @kernels = glob("$RPMS/$rpm_wildcard"); + my @kernels = glob("$repository/$rpm_wildcard"); install_kernel($_, 1) foreach @kernels; } sub install_kernel { - my ($kernel_rpm, $o_update) = @_; + my ($kernel_rpm) = @_; + my $basename = basename($kernel_rpm); + warn "Installing rpm $basename in RPMS\n"; + mkdir 'RPMS'; + cp_af($kernel_rpm, "RPMS/$basename"); + + if (!$main) { + $main = rpm2version($kernel_rpm); + output('RPMS/.main', "$main\n"); + } + if (!$main_BOOT && $kernel_rpm =~ /BOOT/) { + $main_BOOT = rpm2version($kernel_rpm); + output('RPMS/.main-BOOT', "$main_BOOT\n"); + } +} + +sub extract_kernel { + my ($kernel_rpm) = @_; my $kern_ver = rpm2version($kernel_rpm); my $dir = "all.kernels/$kern_ver"; - -d $dir and return if $o_update; - - my $is_BOOT = $kern_ver =~ /BOOT/; - - if (!$main || !-d "all.kernels/$main") { - $main = $kern_ver; - output('all.kernels/.main', "$main\n"); - } - if ($is_BOOT && (!$main_BOOT || !-d "all.kernels/$main_BOOT")) { - $main_BOOT = $kern_ver; - output('all.kernels/.main-BOOT', "$main_BOOT\n"); - } - - warn "Installing kernel $kern_ver\n"; + warn "Extracting kernel $kern_ver\n"; eval { rm_rf($dir) }; mkdir_p("$dir/modules"); diff --git a/make_boot_img b/make_boot_img index 702fd27bf..a1e46bbf7 100755 --- a/make_boot_img +++ b/make_boot_img @@ -5,10 +5,6 @@ use MDK::Common; Config->import; my ($arch) = $Config{archname} =~ /(.*?)-/; -# move stuff to new "kernel" directory --d 'kernel' or die "directory kernel is missing\n"; -rename 'all.kernels', 'kernel/all.kernels'; - my $default_append = "ramdisk_size=128000"; # full acpi support for x86_64, enough acpi support for x86 ht, no acpi for others my $default_acpi = $arch =~ /i.86/ ? "acpi=ht" : $arch =~ /x86_64/ ? "" : "acpi=off"; @@ -36,9 +32,9 @@ sub mke2fs { _ "$sudo mkdir -p $tmp_mnt $tmp_mnt_initrd"; mkdir "images"; -my $main = chomp_(cat_('kernel/all.kernels/.main')); -my $main_BOOT = chomp_(cat_('kernel/all.kernels/.main-BOOT')); -my @kernels = grep { /^2/ } grep { !/xbox/ } all('kernel/all.kernels'); +my $main = chomp_(cat_('kernel/RPMS/.main')); +my $main_BOOT = chomp_(cat_('kernel/RPMS/.main-BOOT')); +my @kernels = grep { !/xbox/ } all('kernel/all.kernels'); my @kernels_BOOT = grep { /BOOT/ } @kernels; my @all_images = ( diff --git a/perl-install/Makefile b/perl-install/Makefile index e4c7b87d3..50944f882 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -131,7 +131,7 @@ endif ifeq (y,$(USE_PCMCIA)) install -s /sbin/cardmgr $(DEST)/sbin cp -a /etc/pcmcia $(DEST)/etc - ../tools/patch_pcmcia_config.pl $(DEST)/etc/pcmcia/config ../kernel/all.kernels/`cat ../kernel/all.kernels/.main`/modules.dep + ../tools/patch_pcmcia_config.pl $(DEST)/etc/pcmcia/config ../kernel/all.kernels/`cat ../kernel/RPMS/.main`/modules.dep endif install -d $(MEDIA_INFO_DEST) diff --git a/rescue/make_rescue_img b/rescue/make_rescue_img index b350218ca..174dbb8bc 100755 --- a/rescue/make_rescue_img +++ b/rescue/make_rescue_img @@ -51,7 +51,7 @@ substInFile { s/DISTRIB_DESCR/$ENV{DISTRIB_DESCR}/ } "$tmp/etc/issue"; _ "cd ../mdk-stage1 && make rescue-gui dhcp-client"; -e "../kernel/all.kernels" or die "use ./update_kernel in gi/kernel first\n"; - $ENV{MAIN_KERNEL} = chomp_(`cat ../kernel/all.kernels/.main`); + $ENV{MAIN_KERNEL} = chomp_(`cat ../kernel/RPMS/.main`); _ "../tools/install-xml-file-list list.xml $tmp"; } |