|
|
@ -273,6 +273,10 @@ my $modules_directory = "/lib/modules"; |
|
|
|
if ( $> != 0 && -e "/usr/lib/bootroot/genext2fs" ) { |
|
|
|
$main::makefs = "genext2fs -z -r0 -i8192"; |
|
|
|
} |
|
|
|
# This is for experimental stuff .. basically so I can test |
|
|
|
# the boot fs as a normal user, since it's hard to create a boot disk |
|
|
|
# with enough room using genext2fs, otherwise. |
|
|
|
my $busybox = 1; |
|
|
|
|
|
|
|
|
|
|
|
# Yard Stuff |
|
|
@ -331,7 +335,9 @@ my @original_container; |
|
|
|
my $file_dialog; |
|
|
|
|
|
|
|
my $mtab; |
|
|
|
my ($tmp,$mnt); |
|
|
|
# $old_mount is used for a little swapping magic when a normal user |
|
|
|
# is using genext2fs and lilo. |
|
|
|
my ($tmp, $mnt, $old_mount); |
|
|
|
my $norm_root_device; |
|
|
|
my ($hbox_advanced); |
|
|
|
my $separator_advanced; |
|
|
@ -2707,7 +2713,7 @@ sub lilo_put_it_together { |
|
|
|
|
|
|
|
# If genext2fs is being used clean $tmp/bootdisk if any garbage is found, |
|
|
|
# and temporarily rename $mnt to that directory. |
|
|
|
my $old_mount; |
|
|
|
#my $old_mount; |
|
|
|
if ( $fs_type eq "genext2fs" ) { |
|
|
|
if (-d "$tmp/bootdisk") { |
|
|
|
sys("rm -rf $tmp/bootdisk"); |
|
|
@ -2824,7 +2830,13 @@ sub lilo_put_it_together { |
|
|
|
|
|
|
|
# Write out the HEREDOCS |
|
|
|
open(LC, ">$mnt/brlilo.conf") or die "Couldn't write $mnt/brlilo.conf\n"; |
|
|
|
if ( $> == 0 ) { |
|
|
|
print LC brlilo($container[BOOT_DEVICE]); close(LC); |
|
|
|
} |
|
|
|
else { |
|
|
|
print LC brlilo_non_root($container[BOOT_DEVICE]); close(LC); |
|
|
|
} |
|
|
|
|
|
|
|
open(M, ">$mnt/message") or die "Couldn't write $mnt/message\n"; |
|
|
|
print M message(); close(M); |
|
|
|
pb($B,5); |
|
|
@ -2844,10 +2856,15 @@ sub lilo_put_it_together { |
|
|
|
|
|
|
|
if ( $fs_type eq "genext2fs" ) { |
|
|
|
|
|
|
|
# info(0,"HERE /usr/lib/bootroot/$main::makefs -b $device_size -d $mnt -D $device_table $entry_advanced[0]"); |
|
|
|
|
|
|
|
my $error; |
|
|
|
# |
|
|
|
|
|
|
|
# When creating a fs on floppy, specifying -i causes genext2fs to fail, |
|
|
|
# its better to just let the program figure out the inode size for now. |
|
|
|
if ( |
|
|
|
sys("/usr/lib/bootroot/$main::makefs -b $device_size -d $mnt -D $device_table $entry_advanced[0]") !~ |
|
|
|
sys("/usr/lib/bootroot/genext2fs -z -b $device_size -d $mnt -D $device_table $entry_advanced[0]") !~ |
|
|
|
/^0$/ ) { |
|
|
|
$error = error("Cannot $fs_type filesystem.\n"); |
|
|
|
return "ERROR" if $error && $error eq "ERROR"; |
|
|
@ -2877,6 +2894,7 @@ sub lilo_put_it_together { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
info(0, "Configuring lilo\n"); |
|
|
|
pb($B,7); |
|
|
|
chdir("$mnt"); #"boot_root: ERROR: Could not change directories\n"; |
|
|
@ -2885,11 +2903,27 @@ sub lilo_put_it_together { |
|
|
|
# otherwise the user has to do it manually. |
|
|
|
if ($container[BOOT_DEVICE] eq $entry_advanced[0]) { |
|
|
|
# |
|
|
|
# root can happily chroot |
|
|
|
if ( $> == 0 ) { |
|
|
|
|
|
|
|
if ( err_custom("lilo -v -C brlilo.conf -r $mnt", |
|
|
|
"gBootRoot: ERROR: lilo failed") == 2 ) { |
|
|
|
chdir($pwd); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
# At this point the normal user needs to be asked first if they have |
|
|
|
# root lilo power, before going on. |
|
|
|
else { |
|
|
|
|
|
|
|
if ( err_custom("$main::sudo lilo -v -C $mnt/brlilo.conf -b $entry_advanced[0]", "gBootRoot: ERROR: lilo failed") == 2 ) { |
|
|
|
chdir($pwd); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
# |
|
|
|
} |
|
|
|
|
|
|
@ -3421,6 +3455,15 @@ sub initrd { |
|
|
|
$device = $entry_advanced[3]; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
my $fs_type = (split(/\s/,$main::makefs))[0]; |
|
|
|
|
|
|
|
if ( $fs_type eq "genext2fs" ) { |
|
|
|
if ( $compress eq "bzip2" ) { |
|
|
|
$compress = "bunzip2"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
my $broot_image = basename($root_image); |
|
|
|
open(LC, ">$tmp/linuxrc") or die "Couldn't write linuxrc to loop device\n"; |
|
|
|
print LC initrd_heredoc($broot_image,$device); close(LC); |
|
|
@ -3428,8 +3471,6 @@ sub initrd { |
|
|
|
my $size_needed = initrd_size((stat("$tmp/linuxrc"))[12]/2); |
|
|
|
unlink("$tmp/linuxrc"); |
|
|
|
|
|
|
|
my $fs_type = (split(/\s/,$main::makefs))[0]; |
|
|
|
|
|
|
|
|
|
|
|
if ( $fs_type ne "genext2fs" ) { |
|
|
|
|
|
|
@ -3495,9 +3536,11 @@ sub initrd { |
|
|
|
pb($I,6); |
|
|
|
|
|
|
|
# Hopefully, this works, but have never tested it - o.k I did |
|
|
|
if ( $fs_type ne "genext2fs" ) { |
|
|
|
if ($container[BOOT_DEVICE] !~ m,/dev/fd\d{1}$,) { |
|
|
|
return if err(sys("cp -a $container[BOOT_DEVICE] $mnt/dev")) == 2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
# DEVICES SECTION |
|
|
|
my @devices; |
|
|
@ -3619,6 +3662,8 @@ sub initrd { |
|
|
|
|
|
|
|
# Will put the stuff in sbin because the is where the kernel looks for |
|
|
|
# modprobe. |
|
|
|
if ( ! $busybox ) { |
|
|
|
|
|
|
|
foreach (@initrd_stuff) { |
|
|
|
($path,$value) = stripper(find_file_in_path($_),"bin"); |
|
|
|
$value == 0 ? ($tool = "cp -a") : ($tool = "mv"); |
|
|
@ -3685,6 +3730,48 @@ sub initrd { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} # not busybox |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
my $error; |
|
|
|
|
|
|
|
# busybox binary |
|
|
|
$tool = "cp -a"; |
|
|
|
$path = "/home/mttrader/busybox/busybox/busybox"; |
|
|
|
return if errcp(sys("$tool $path $tmp/initrd_mnt/sbin")) == 2; |
|
|
|
|
|
|
|
#Currently defined functions: |
|
|
|
# [, ash, bunzip2, busybox, echo, false, gzip, insmod, modprobe, |
|
|
|
# mount, sh, test, true, umount |
|
|
|
|
|
|
|
my $target = "$tmp/initrd_mnt/sbin/busybox"; |
|
|
|
my @busystuff = qw(ash sh bunzip2 echo gzip insmod modprobe mount |
|
|
|
umount); |
|
|
|
chdir("$tmp/initrd_mnt/sbin/"); |
|
|
|
foreach ( @busystuff ) { |
|
|
|
|
|
|
|
symlink("busybox", "$tmp/initrd_mnt/sbin/$_" ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
# uClibc |
|
|
|
mkpath("$tmp/initrd_mnt/usr/i386-linux-uclibc/lib"); |
|
|
|
$path = "/usr/i386-linux-uclibc/lib/libuClibc-0.9.5.so"; |
|
|
|
return if errcp(sys("$tool $path $tmp/initrd_mnt/usr/i386-linux-uclibc/lib")) == 2; |
|
|
|
sys("chmod 755 $tmp/initrd_mnt/usr/i386-linux-uclibc/lib/libuClibc-0.9.5.so"); |
|
|
|
chdir("$tmp/initrd_mnt/lib"); |
|
|
|
symlink("../usr/i386-linux-uclibc/lib/libuClibc-0.9.5.so", "$tmp/initrd_mnt/lib/libc.so.0" ); |
|
|
|
|
|
|
|
$path = "/usr/i386-linux-uclibc/lib/ld-uClibc-0.9.5.so"; |
|
|
|
return if errcp(sys("$tool $path $tmp/initrd_mnt/usr/i386-linux-uclibc/lib")) == 2; |
|
|
|
sys("chmod 755 $tmp/initrd_mnt/usr/i386-linux-uclibc/lib/ld-uClibc-0.9.5.so"); |
|
|
|
chdir("$tmp/initrd_mnt/usr/i386-linux-uclibc/lib"); |
|
|
|
symlink("ld-uClibc-0.9.5.so", "$tmp/initrd_mnt/usr/i386-linux-uclibc/lib/ld-uClibc.so.0" ); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
info(0, "Determine run-time link bindings\n"); |
|
|
|
# Has a return code of 0 regardless |
|
|
|
# Also, produces false alarms even when it is working. |
|
|
@ -4078,7 +4165,6 @@ INITRD |
|
|
|
|
|
|
|
} # end sub initrd_heredoc |
|
|
|
|
|
|
|
|
|
|
|
sub brlilo { |
|
|
|
|
|
|
|
my ($device) = @_; |
|
|
@ -4117,6 +4203,44 @@ LILOCONF |
|
|
|
} # end sub brlilo |
|
|
|
|
|
|
|
|
|
|
|
sub brlilo_non_root { |
|
|
|
|
|
|
|
my ($device) = @_; |
|
|
|
$entry_advanced[2] ? $entry_advanced[2] = $entry_advanced[2] |
|
|
|
: $entry_advanced[2] = $container[ABS_APPEND]; |
|
|
|
|
|
|
|
# HEREDOC |
|
|
|
my $brlilo = << "LILOCONF"; |
|
|
|
boot = $device |
|
|
|
message = $old_mount/message |
|
|
|
delay = 50 |
|
|
|
vga = normal |
|
|
|
install = $old_mount/boot/boot.b |
|
|
|
map = $old_mount/boot/map |
|
|
|
backup = /dev/null |
|
|
|
compact |
|
|
|
|
|
|
|
# bootdisk |
|
|
|
image = $old_mount/kernel |
|
|
|
append = "load_ramdisk=1 debug $entry_advanced[2]" |
|
|
|
initrd = $old_mount/$initrd |
|
|
|
root = $device |
|
|
|
label = bootdisk |
|
|
|
read-write |
|
|
|
|
|
|
|
# normalboot |
|
|
|
#image = kernel |
|
|
|
#append = "$entry_advanced[2]" |
|
|
|
#root = /dev/$norm_root_device |
|
|
|
#label = normalboot |
|
|
|
#read-only |
|
|
|
LILOCONF |
|
|
|
|
|
|
|
return $brlilo; |
|
|
|
|
|
|
|
} # end sub brlilo_non_root |
|
|
|
|
|
|
|
|
|
|
|
sub message { |
|
|
|
# HEREDOC |
|
|
|
my $message = << "MESSAGE"; |
|
|
|