Browse Source

Added a new stage button in the Yard Box called Copy. Create is now Copy, and

the uml_exclusively and genext2fs behavior are handled by Create, this is
much nicer because a new filsystem type can be created without having to wait
for everything to be copied again to the sources directory.
master
freesource 23 years ago
parent
commit
209f162b71
  1. 132
      BootRoot/Yard.pm
  2. 54
      BootRoot/YardBox.pm
  3. 8
      Changes

132
BootRoot/Yard.pm

@ -37,8 +37,8 @@ use Exporter;
read_contents_file extra_links library_dependencies hard_links read_contents_file extra_links library_dependencies hard_links
space_check create_filesystem find_file_in_path sys device_table space_check create_filesystem find_file_in_path sys device_table
text_insert error warning warning_test logadj *LOGFILE text_insert error warning warning_test logadj *LOGFILE
which_tests create_fstab ars2 root_filename make_link_absolute which_tests create_fstab ars2 root_filename create_expect_uml
make_link_relative cleanup_link yard_glob); make_link_absolute make_link_relative cleanup_link yard_glob);
# these last four added for tests # these last four added for tests
use strict; use strict;
@ -1209,6 +1209,11 @@ sub create_filesystem {
if ( $fs_type ne "genext2fs" && if ( $fs_type ne "genext2fs" &&
$uml_exclusively == 0 ) { $uml_exclusively == 0 ) {
# If it is mounted it should just be automatically unmounted here
# since the create stage has been broken up into the copy and
# create stage. This is cool because the loop device can be
# scooped, just like the sources directory by rooot.
return "ERROR" if errm(mount_device($device,$mount_point)) == 2; return "ERROR" if errm(mount_device($device,$mount_point)) == 2;
##### lost+found on a ramdisk is pointless ##### lost+found on a ramdisk is pointless
sys("rm -rf $mount_point/lost+found"); sys("rm -rf $mount_point/lost+found");
@ -1363,18 +1368,132 @@ sub create_filesystem {
} }
info(0,"Done with the Copy stage\n");
=pod
# This could be run as another stage, its only complicated
# when root is using a loop device, in figuring out the verbosity.
if (@Libs) { if (@Libs) {
info(0, "Re-generating /etc/ld.so.cache on root fs.\n"); info(0, "\nRe-generating /etc/ld.so.cache on root fs.\n");
info(1, "Ignore warnings about missing directories\n"); info(1, "Ignore warnings about missing directories\n");
sys("ldconfig -v -r $mount_point"); sys("ldconfig -v -r $mount_point");
} }
# This could be run as another stage, its only complicated if ( $uml_exclusively == 0 ) {
# when root is using a loop device, in figuring out the verbosity. info(0, "\nFinished creating root filesystem.\n");
}
if ( $fs_type ne "genext2fs" && $uml_exclusively == 0 ) {
## Probably will want to umount here
return "ERROR" if errum(sys("umount $mount_point")) == 2;
}
# This is fun.
else {
# The -D option is unique to the newest unreleased version of
# genextfs modified by BusyBox maintainer Erick Andersen
# August 20, 2001.
my $device_table = "$mnt/device_table.txt";
if ( $uml_exclusively ) {
my $expect_program = "/usr/lib/bootroot/expect_uml";
my $version = "2.4";
my $ubd0 =
"ubd0=/usr/lib/bootroot/root_filesystem/root_fs_helper";
my $ubd1 = "ubd1=$device";
my $options = "root=/dev/ubd0"; # need to keep this 1
my $filesystem;
if ( $fs_type eq "genext2fs" ) {
$filesystem = "mke2fs -m0";
}
else {
$filesystem = $main::makefs;
}
my $x_count = 1;
my $command_line = "$expect_program $ubd0 $ubd1 $options " .
"$mount_point $preserve_ownership $filesystem";
info(0,"\nUsing helper root_fs to $fs_type the filesystem:\n\n");
info(0,"$command_line\n\n");
# add error correction
# I'll allow the GUI to lock-xup for big copies and fs creation.
open(EXPECT,"$command_line|");
while (<EXPECT>) {
info(1,"$x_count $_");
$x_count++;
while (Gtk->events_pending) { Gtk->main_iteration; }
}
if ( $fs_type eq "mkcramfs" || $fs_type eq "genromfs" ) {
# Will just keep appending _cramfs .. leaving it to the
# user to realize this is happening, that way the user
# has control over the dd file.
$fs_type eq "mkcramfs" ? ($device = $device . "_cramfs") :
($device = $device . "_romfs");
my $cramfs_name = basename($device);
# If somebody closes ARS, this won't get updated,
# but that is a minor matter.
$ear2->set_text($cramfs_name) if $ear2;
$mount_point = dirname($device);
}
}
elsif (
sys("/usr/lib/bootroot/$main::makefs -b $fs_size -d $mount_point -D $device_table $device") !~
/^0$/ ) {
$error = error("Cannot $fs_type filesystem.\n");
return "ERROR" if $error && $error eq "ERROR";
}
}
info(0, "\nDone making the root filesystem. $Warnings warnings.\n",
"$device is now umounted from $mount_point\n\n");
#info(0, "All done!\n");
#info(0, "You can run more tests with the UML kernel\n",
# "or construct a distribution by using this root\n",
# "filesystem with a boot method.");
=cut
} # end sub create_filesystem
# The real create - uml_exclusively and genext2fs
# For root loop devices this will just ldconfig and umount.
sub create_expect_uml {
my ($fs_size, $mnt) = @_;
my $fs_type = (split(/\s/,$main::makefs))[0];
my $error;
if (@Libs) {
info(0, "\nRe-generating /etc/ld.so.cache on root fs.\n");
info(1, "Ignore warnings about missing directories\n");
sys("ldconfig -v -r $mount_point");
}
if ( $uml_exclusively == 0 ) { if ( $uml_exclusively == 0 ) {
@ -1464,7 +1583,8 @@ sub create_filesystem {
# "or construct a distribution by using this root\n", # "or construct a distribution by using this root\n",
# "filesystem with a boot method."); # "filesystem with a boot method.");
} # end sub create_filesystem
} # end sub create_expect_uml
####################################### #######################################
##### Utility subs for make_root_fs.pl ##### Utility subs for make_root_fs.pl

54
BootRoot/YardBox.pm

@ -39,7 +39,7 @@ my $true = 1;
my $false = 0; my $false = 0;
#my $error; #my $error;
my ($continue_button,$close_button,$save_button); my ($continue_button,$close_button,$save_button);
my($check,$dep,$space,$create,$test); my($check,$dep,$space,$create,$create_expect_uml,$test);
my($filename,$filesystem_size,$kernel,$template_dir,$template,$tmp,$mnt); my($filename,$filesystem_size,$kernel,$template_dir,$template,$tmp,$mnt);
my ($text, $changed_text, $changed_text_from_template); my ($text, $changed_text, $changed_text_from_template);
my $save_as; my $save_as;
@ -601,6 +601,7 @@ my $continue = {
check => 0, check => 0,
dep => 0, dep => 0,
space => 0, space => 0,
copy => 0,
create => 0, create => 0,
test => 0, test => 0,
}; };
@ -614,7 +615,7 @@ sub which_stage {
my($widget,$name) = @_; my($widget,$name) = @_;
my ($thing,$name_cmp); my ($thing,$name_cmp);
@check_boxes = ($check, $dep, $space, $create, $test); @check_boxes = ($check, $dep, $space, $create, $create_expect_uml, $test);
if ($stages_bool eq "one-by-one" or $stages_bool eq "continuous") { if ($stages_bool eq "one-by-one" or $stages_bool eq "continuous") {
foreach $thing (@check_boxes) { foreach $thing (@check_boxes) {
@ -664,7 +665,7 @@ sub which_stage {
} }
} }
} }
elsif ($name eq "test") { elsif ($name eq "create_expect_uml") {
foreach $name_cmp (%$continue) { foreach $name_cmp (%$continue) {
if ($name_cmp ne "check" && $name_cmp ne "dep" && if ($name_cmp ne "check" && $name_cmp ne "dep" &&
$name_cmp ne "space" && $name_cmp ne "create") { $name_cmp ne "space" && $name_cmp ne "create") {
@ -672,6 +673,15 @@ sub which_stage {
} }
} }
} }
elsif ($name eq "test") {
foreach $name_cmp (%$continue) {
if ($name_cmp ne "check" && $name_cmp ne "dep" &&
$name_cmp ne "space" && $name_cmp ne "create" &&
$name_cmp ne "create_expect_uml") {
$continue->{$name_cmp} = 0;
}
}
}
# for (keys %$continue) { print $_, "=>", $continue->{$_}, "\n"; } # for (keys %$continue) { print $_, "=>", $continue->{$_}, "\n"; }
@ -726,13 +736,26 @@ sub continue {
$continue->{space} = 1; $continue->{space} = 1;
return if $stages_bool eq "one-by-one"; return if $stages_bool eq "one-by-one";
} }
if ( $continue->{create} == 0 ) { if ( $continue->{copy} == 0 ) {
create(); create();
foreach $thing (@check_boxes) { foreach $thing (@check_boxes) {
$thing->hide(); $thing->hide();
$thing->active($false); $thing->active($false);
$thing->show(); $thing->show();
} }
$create_expect_uml->hide();
$create_expect_uml->active($true);
$create_expect_uml->show();
$continue->{copy} = 1;
return if $stages_bool eq "one-by-one";
}
if ( $continue->{create} == 0 ) {
create_uml();
foreach $thing (@check_boxes) {
$thing->hide();
$thing->active($false);
$thing->show();
}
$test->hide(); $test->hide();
$test->active($true); $test->active($true);
$test->show(); $test->show();
@ -777,6 +800,12 @@ sub continue {
$create->active($false); $create->active($false);
$create->show(); $create->show();
} }
if ($create_expect_uml->get_active()) {
create_uml();
$create_expect_uml->hide();
$create_expect_uml->active($false);
$create_expect_uml->show();
}
if ($test->get_active()) { if ($test->get_active()) {
test(); test();
$test->hide(); $test->hide();
@ -786,7 +815,7 @@ sub continue {
} }
} } # end sub continue
sub check { sub check {
@ -851,6 +880,7 @@ sub space_left {
} }
# This is the copy stage
sub create { sub create {
$lib_bool = "" if $lib_bool eq 0; $lib_bool = "" if $lib_bool eq 0;
@ -867,6 +897,13 @@ sub create {
} }
sub create_uml {
create_expect_uml($filesystem_size, $tmp);
}
######### #########
# TESTS # # TESTS #
######### #########
@ -1331,11 +1368,16 @@ sub yard_box {
$vbox->pack_start( $space, $true, $true, 0 ); $vbox->pack_start( $space, $true, $true, 0 );
show $space; show $space;
$create = new Gtk::CheckButton("Create"); $create = new Gtk::CheckButton("Copy");
$create->signal_connect("clicked", \&which_stage, "create"); $create->signal_connect("clicked", \&which_stage, "create");
$vbox->pack_start( $create, $true, $true, 0 ); $vbox->pack_start( $create, $true, $true, 0 );
show $create; show $create;
$create_expect_uml = new Gtk::CheckButton("Create");
$create_expect_uml->signal_connect("clicked", \&which_stage, "create");
$vbox->pack_start( $create_expect_uml, $true, $true, 0 );
show $create_expect_uml;
$test = new Gtk::CheckButton("Test"); $test = new Gtk::CheckButton("Test");
$test->signal_connect("clicked", \&which_stage, "test"); $test->signal_connect("clicked", \&which_stage, "test");
$vbox->pack_start( $test, $true, $true, 0 ); $vbox->pack_start( $test, $true, $true, 0 );

8
Changes

@ -1,3 +1,11 @@
1.3.1 - 12/23/2001
------------------
Added a new stage button in the Yard Box called Copy. Create is now Copy, and
the uml_exclusively and genext2fs behavior are handled by Create, this is
much nicer because a new filsystem type can be created without having to wait
for everything to be copied again to the sources directory.
Updated the documentation and graphics to reflect the new changes, and provide Updated the documentation and graphics to reflect the new changes, and provide
a new exercise. a new exercise.

Loading…
Cancel
Save