From 209f162b71d9ecb4b6c13ef28c8e4afd62d520e5 Mon Sep 17 00:00:00 2001 From: freesource Date: Sat, 22 Dec 2001 21:44:40 +0000 Subject: [PATCH] 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. --- BootRoot/Yard.pm | 134 +++++++++++++++++++++++++++++++++++++++++--- BootRoot/YardBox.pm | 54 ++++++++++++++++-- Changes | 8 +++ 3 files changed, 183 insertions(+), 13 deletions(-) diff --git a/BootRoot/Yard.pm b/BootRoot/Yard.pm index 4a8c96f..83388f1 100644 --- a/BootRoot/Yard.pm +++ b/BootRoot/Yard.pm @@ -37,8 +37,8 @@ use Exporter; read_contents_file extra_links library_dependencies hard_links space_check create_filesystem find_file_in_path sys device_table text_insert error warning warning_test logadj *LOGFILE - which_tests create_fstab ars2 root_filename make_link_absolute - make_link_relative cleanup_link yard_glob); + which_tests create_fstab ars2 root_filename create_expect_uml + make_link_absolute make_link_relative cleanup_link yard_glob); # these last four added for tests use strict; @@ -1209,6 +1209,11 @@ sub create_filesystem { if ( $fs_type ne "genext2fs" && $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; ##### lost+found on a ramdisk is pointless sys("rm -rf $mount_point/lost+found"); @@ -1363,20 +1368,23 @@ 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) { - 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"); sys("ldconfig -v -r $mount_point"); } - # This could be run as another stage, its only complicated - # when root is using a loop device, in figuring out the verbosity. - - if ( $uml_exclusively == 0 ) { info(0, "\nFinished creating root filesystem.\n"); } @@ -1463,9 +1471,121 @@ sub create_filesystem { #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 ) { + 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 () { + 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."); + + +} # end sub create_expect_uml + ####################################### ##### Utility subs for make_root_fs.pl ####################################### diff --git a/BootRoot/YardBox.pm b/BootRoot/YardBox.pm index 7633c67..211e161 100644 --- a/BootRoot/YardBox.pm +++ b/BootRoot/YardBox.pm @@ -39,7 +39,7 @@ my $true = 1; my $false = 0; #my $error; 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 ($text, $changed_text, $changed_text_from_template); my $save_as; @@ -601,6 +601,7 @@ my $continue = { check => 0, dep => 0, space => 0, + copy => 0, create => 0, test => 0, }; @@ -614,7 +615,7 @@ sub which_stage { my($widget,$name) = @_; 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") { 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) { if ($name_cmp ne "check" && $name_cmp ne "dep" && $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"; } @@ -726,13 +736,26 @@ sub continue { $continue->{space} = 1; return if $stages_bool eq "one-by-one"; } - if ( $continue->{create} == 0 ) { + if ( $continue->{copy} == 0 ) { create(); foreach $thing (@check_boxes) { $thing->hide(); $thing->active($false); $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->active($true); $test->show(); @@ -777,6 +800,12 @@ sub continue { $create->active($false); $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()) { test(); $test->hide(); @@ -786,7 +815,7 @@ sub continue { } -} +} # end sub continue sub check { @@ -851,6 +880,7 @@ sub space_left { } +# This is the copy stage sub create { $lib_bool = "" if $lib_bool eq 0; @@ -867,6 +897,13 @@ sub create { } +sub create_uml { + + create_expect_uml($filesystem_size, $tmp); + + +} + ######### # TESTS # ######### @@ -1331,11 +1368,16 @@ sub yard_box { $vbox->pack_start( $space, $true, $true, 0 ); show $space; - $create = new Gtk::CheckButton("Create"); + $create = new Gtk::CheckButton("Copy"); $create->signal_connect("clicked", \&which_stage, "create"); $vbox->pack_start( $create, $true, $true, 0 ); 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->signal_connect("clicked", \&which_stage, "test"); $vbox->pack_start( $test, $true, $true, 0 ); diff --git a/Changes b/Changes index c69f8a2..1b97292 100644 --- a/Changes +++ b/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 a new exercise.