Browse Source

This does the complete depmod thing. Next KEYSYMS will have to be added, better

cleanup, and better size check after depmod is run, preferably in initrd_size.
master
freesource 23 years ago
parent
commit
0a896d4ebe
  1. 30
      gbootroot

30
gbootroot

@ -84,6 +84,7 @@ use BootRoot::YardBox;
use BootRoot::Error; use BootRoot::Error;
use File::Basename; use File::Basename;
use File::Find; use File::Find;
use File::Path;
init Gtk; init Gtk;
set_locale Gtk; set_locale Gtk;
@ -244,7 +245,7 @@ use constant ABS_APPEND => 11 ;
use constant MOD_STRIP => 12 ; use constant MOD_STRIP => 12 ;
my @original_container; my @original_container;
my $file_dialog; my $file_dialog;
my ($kernel,$root_image,$device,$size); my ($kernel,$root_image,$device,$size,$kernel_version);
my $mtab; my $mtab;
my ($tmp,$mnt); my ($tmp,$mnt);
my $norm_root_device; my $norm_root_device;
@ -2613,7 +2614,7 @@ sub kernel_modules {
undef $kernel_version_choice if defined $kernel_version_choice eq ""; undef $kernel_version_choice if defined $kernel_version_choice eq "";
undef $kernel_version_choice if !$kernel_version_choice; undef $kernel_version_choice if !$kernel_version_choice;
my $kernel_version = kernel_version_check($container[KERNEL], $kernel_version = kernel_version_check($container[KERNEL],
$kernel_version_choice); $kernel_version_choice);
#----------------------------- #-----------------------------
# METHOD -> 2 DISK COMPRESSION # METHOD -> 2 DISK COMPRESSION
@ -2687,14 +2688,19 @@ sub initrd_size {
my $dir_size = 9 + 1; my $dir_size = 9 + 1;
my $initrd_size = $dir_size + $linuxrc_size; my $initrd_size = $dir_size + $linuxrc_size;
# modules # modules
my @modules = kernel_modules(); my @modules = kernel_modules();
if (@modules) {
my $ds = mkpath("$tmp/initrd_mnt/lib/modules/$kernel_version");
$initrd_size = $initrd_size + $ds;
foreach (@modules) { foreach (@modules) {
($path,$value) = stripper($_,"mod"); ($path,$value) = stripper($_,"mod");
$initrd_size = $initrd_size + ((stat($path))[12]/2); $initrd_size = $initrd_size + ((stat($path))[12]/2);
unlink($path) if $value == 1; unlink($path) if $value == 1;
} }
}
# This and libs should be user accessible # This and libs should be user accessible
# add other executables here # add other executables here
@ -2818,11 +2824,13 @@ sub initrd {
pb($I,3); pb($I,3);
info(0, "Mounting initrd in $tmp/initrd_mnt\n"); info(0, "Mounting initrd in $tmp/initrd_mnt\n");
# moved this from initrd() to help with testing
if (!-d "$tmp/initrd_mnt") { if (!-d "$tmp/initrd_mnt") {
return if errmk(sys("mkdir $tmp/initrd_mnt")) == 2; return if errmk(sys("mkdir $tmp/initrd_mnt")) == 2;
} }
return if errm(sys("mount -o loop -t ext2 $tmp/$initrd $tmp/initrd_mnt")) return if errm(sys("mount -o loop -t ext2 $tmp/$initrd $tmp/initrd_mnt"))
== 2; == 2;
pb($I,4); pb($I,4);
info(0, "Putting everything together\n"); info(0, "Putting everything together\n");
@ -2848,16 +2856,28 @@ sub initrd {
info(0, ".. the modules\n"); info(0, ".. the modules\n");
my @modules = kernel_modules(); my @modules = kernel_modules();
if (@modules) {
mkpath("$tmp/initrd_mnt/lib/modules/$kernel_version");
foreach my $stuff (@modules) { foreach my $stuff (@modules) {
($path,$value) = stripper($stuff,"bin"); ($path,$value) = stripper($stuff,"bin");
$value == 0 ? ($tool = "cp -a") : ($tool = "mv"); $value == 0 ? ($tool = "cp -a") : ($tool = "mv");
if (!$path) { if (!$path) {
info(1,"gBootRoot Error: Couldn't find $stuff\n"); info(1,"gBootRoot Error: Couldn't find $stuff\n");
} }
info(0,"HEREIAM $tmp/initrd_mnt$stuff\n"); return if
return if errcp(sys("$tool $path $tmp/initrd_mnt")) == 2; errcp(sys("$tool $path $tmp/initrd_mnt/lib/modules/$kernel_version")) == 2;
} }
info(1, "depmod -ae -b $tmp/initrd_mnt/lib/modules/$kernel_version $kernel_version\n");
return if err_custom("depmod -ae -b $tmp/initrd_mnt $kernel_version",
"gBootRoot: ERROR: depmod failed") == 2;
}
info(0, ".. the bins\n"); info(0, ".. the bins\n");
my @initrd_stuff; my @initrd_stuff;
if (@modules) { if (@modules) {

Loading…
Cancel
Save