my $quiet;
my $kernel;
my $prebuild;
-my $kernel_gcc_args="";
+use vars qw($kernel_gcc_args);
+$kernel_gcc_args="";
my $lufsmnt_bin;
if ($0 eq "lufsmnt" || $0=~m#/lufsmnt$#) {
return $r;
}
+sub _writefile
+{
+my($filename,@content)=@_;
+
+ local *F;
+ open F,($filename=~/^[|]/ ? "" : ">").$filename or confess "rewrite \"$filename\": $!";
+ print F @content;
+ close F or confess "close \"$filename\": $!"; # Do not &cluck as it may be pipe result
+}
+
sub _system
{
my(@args)=@_;
}
local $_;
-for (<$modbindir/*-$uname_r/*.o>,<$modbindir/*-${uname_r_base}/*.o>,<$modbindir/*/*.o>) {
+for (<$modbindir/*-$uname_r*/*.o>,<$modbindir/*-${uname_r_base}*/*.o>,<$modbindir/*/*.o>) {
next if _system "rmmod lufs 2>/dev/null; insmod -o lufs -p $_ 2>/dev/null";
do { cluck "Failed to symlink $_"; next; } if _system "rm -rf $moduledir; mkdir -p $moduledir; ln -s $_ $moduledir/lufs.o";
_pass 1;
do { $kdebug=$_ if !/^@/; } for ('@KDEBUG_FLAGS@');
my $cmdline="gcc"
.($quiet ? " 2>/dev/null" : "")
- ." -O2 -pipe -fomit-frame-pointer -fno-strict-aliasing -mpreferred-stack-boundary=2 -Wall"
+ ." -Wall -Wstrict-prototypes -Wno-trigraphs"
+ ." -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mpreferred-stack-boundary=2"
+ #." -march=i586"
." -D__KERNEL__ -DMODULE -DLINUX -DKBUILD_MODNAME=lufs"
." ".$kdebug
." ".$kernel_gcc_args
do { $dir||=$_ if -d $_; } for ($tmp_dir."/usr/src/linux-$uname_r");
do { $dir||=$_ if -d $_; } for ($tmp_dir."/usr/src/linux-$uname_r_base"); # older RedHat kernels
$dir or confess "Kernel source tree not found in: $rpm";
- prebuild_kernel $dir,$vendor,$uname_r;
+ _writefile "| patch $dir/include/linux/rhconfig.h",<<'RHCONFIG_H_NOBOOT_EOF';
+--- ./include/linux/rhconfig.h-orig Thu Aug 21 14:50:16 2003
++++ ./include/linux/rhconfig.h Thu Aug 21 14:59:22 2003
+@@ -10,7 +10,7 @@
+ * /boot/kernel.h - initscripts should create it for us
+ */
+
+-#include "/boot/kernel.h"
++/* lufs: #include "/boot/kernel.h" */
+
+ #if defined(__BOOT_KERNEL_SMP) && (__BOOT_KERNEL_SMP == 1)
+ #define __module__smp
+RHCONFIG_H_NOBOOT_EOF
+ for my $smp ("","smp") {
+ my @archs=qw(i386 i586 i686 athlon);
+ for my $arch (@archs) {
+ my %boot=(
+ "__BOOT_KERNEL_SMP"=>$smp,
+ map({ ("__MODULE_KERNEL_$_"=>($arch eq $_)); } @archs),
+ "__BOOT_KERNEL_BOOT"=>0,
+ "__BOOT_KERNEL_BOOTSMP"=>0,
+ "__BOOT_KERNEL_ENTERPRISE"=>0,
+ "__BOOT_KERNEL_BIGMEM"=>0,
+ "__BOOT_KERNEL_DEBUG"=>0,
+ );
+ local $kernel_gcc_args=join(" ",map({ " -D$_=".($boot{$_} ? 1 : 0); } keys(%boot)))
+ ." -march=$arch"
+ ." ".$kernel_gcc_args;
+ prebuild_kernel $dir,$vendor,$uname_r.$smp.".".$arch;
+ }
+ }
_system "rm -rf $tmp_dir" and confess "Deletion of: $tmp_dir";
}