mirror of
https://github.com/fspc/gbootroot.git
synced 2025-03-03 19:43:22 -05:00
Now files for uml_exclusively are made in create_expect_uml which is
effectively known as the create stage. This avoids the unecessary previous requirement of having to select the copy stage again just to create a file for /dev/ubd/0. The file created is sparse, got this idea from a discussion Jeff had with a user on uml-user.
This commit is contained in:
parent
9c2a97b875
commit
93b5f23410
@ -1122,7 +1122,9 @@ sub space_check {
|
||||
########################
|
||||
|
||||
# This is really copy for normal users, uml_exclusively, and genext2fs
|
||||
# since everything goes into a source directory.
|
||||
# since everything goes into a source directory. I've also moved dd
|
||||
# to create_expect_uml which is really create for uml_exclusively.
|
||||
# fs creation on loopback devices occurs ..
|
||||
sub create_filesystem {
|
||||
|
||||
my ($filename, $fs_size, $mnt, $strip_lib,
|
||||
@ -1144,7 +1146,7 @@ sub create_filesystem {
|
||||
# normal user as ubd1, then a <=8192 root_fs created by the
|
||||
# user can be booted as ubd0, and the ubd1 is given a filesystem,
|
||||
# after which everything is copied over from loopback to
|
||||
# the new mounted filesystem ubd1. I'll automate this in the future.
|
||||
# the new mounted filesystem ubd1.
|
||||
# --freesource
|
||||
|
||||
|
||||
@ -1160,22 +1162,23 @@ sub create_filesystem {
|
||||
|
||||
|
||||
# Allow smaller than 8192 if exclusive.
|
||||
if ( $uml_exclusively == 1 ) {
|
||||
## if ( $uml_exclusively == 1 ) {
|
||||
## sync();
|
||||
## info(1,"dd if=/dev/zero of=$device bs=1k count=$fs_size\n");
|
||||
## sys("dd if=/dev/zero of=$device bs=1k count=$fs_size");
|
||||
## sync();
|
||||
## }
|
||||
## elsif ( $> != 0 && $fs_size > 8192 && $fs_type eq "genext2fs" ) {
|
||||
## sync();
|
||||
## info(1,"dd if=/dev/zero of=$device bs=1k count=$fs_size\n");
|
||||
## sys("dd if=/dev/zero of=$device bs=1k count=$fs_size");
|
||||
## sync();
|
||||
## }
|
||||
if ( $fs_type ne "genext2fs" && $uml_exclusively != 1) {
|
||||
sync();
|
||||
info(1,"dd if=/dev/zero of=$device bs=1k count=$fs_size\n");
|
||||
sys("dd if=/dev/zero of=$device bs=1k count=$fs_size");
|
||||
sync();
|
||||
}
|
||||
elsif ( $> != 0 && $fs_size > 8192 && $fs_type eq "genext2fs" ) {
|
||||
sync();
|
||||
info(1,"dd if=/dev/zero of=$device bs=1k count=$fs_size\n");
|
||||
sys("dd if=/dev/zero of=$device bs=1k count=$fs_size");
|
||||
sync();
|
||||
}
|
||||
elsif ( $fs_type ne "genext2fs" ) {
|
||||
sync();
|
||||
info(1,"dd if=/dev/zero of=$device bs=1k count=$fs_size\n");
|
||||
sys("dd if=/dev/zero of=$device bs=1k count=$fs_size");
|
||||
info(0,"Making sparse file for loopback at $device\n");
|
||||
info(1,"dd if=/dev/zero of=$device bs=1k count=1 seek=$fs_size\n");
|
||||
sys("dd if=/dev/zero of=$device bs=1k count=1 seek=$fs_size");
|
||||
sync();
|
||||
}
|
||||
|
||||
@ -1408,7 +1411,7 @@ sub create_filesystem {
|
||||
# For root loop devices this will just ldconfig and umount.
|
||||
sub create_expect_uml {
|
||||
|
||||
my ($fs_size, $mnt) = @_;
|
||||
my ($fs_size, $mnt, $filename) = @_;
|
||||
|
||||
my $fs_type = (split(/\s/,$main::makefs))[0];
|
||||
my $error;
|
||||
@ -1438,6 +1441,25 @@ sub create_expect_uml {
|
||||
}
|
||||
|
||||
|
||||
# From this point things have failed for a normal user
|
||||
# in the previous function if they tried to create a fs > 8192 using
|
||||
# genext2fs or something else. Now uml_exclusively comes to the rescue,
|
||||
# or genext2fs which doesn't require a dd image for ubd/0.
|
||||
|
||||
if ( basename($mount_point) ne "loopback" ) {
|
||||
$mount_point = "$mnt/loopback";
|
||||
}
|
||||
|
||||
if ( $uml_exclusively == 1 ) {
|
||||
$device = "$mnt/$filename";
|
||||
sync();
|
||||
info(0,"Making sparse file for /dev/ubd/0 at $device\n");
|
||||
info(1,"dd if=/dev/zero of=$device bs=1k count=1 seek=$fs_size\n");
|
||||
sys("dd if=/dev/zero of=$device bs=1k count=1 seek=$fs_size");
|
||||
sync();
|
||||
}
|
||||
|
||||
|
||||
if ( $fs_type ne "genext2fs" && $uml_exclusively == 0 ) {
|
||||
## Probably will want to umount here
|
||||
return "ERROR" if errum(sys("umount $mount_point")) == 2;
|
||||
@ -1480,7 +1502,7 @@ sub create_expect_uml {
|
||||
info(0,"$command_line\n\n");
|
||||
|
||||
# add error correction
|
||||
# I'll allow the GUI to lock-xup for big copies and fs creation.
|
||||
# I'll allow the GUI to lock-up for big copies and fs creation.
|
||||
open(EXPECT,"$command_line|");
|
||||
while (<EXPECT>) {
|
||||
info(1,"$x_count $_");
|
||||
@ -1488,6 +1510,7 @@ sub create_expect_uml {
|
||||
while (Gtk->events_pending) { Gtk->main_iteration; }
|
||||
}
|
||||
|
||||
# This will just keep appending, but that's o.k.
|
||||
|
||||
if ( $fs_type eq "mkcramfs" || $fs_type eq "genromfs" ||
|
||||
$fs_type eq "mkfs.jffs" || $fs_type eq "mkfs.jffs2") {
|
||||
|
@ -902,7 +902,7 @@ sub create {
|
||||
|
||||
sub create_uml {
|
||||
|
||||
create_expect_uml($filesystem_size, $tmp);
|
||||
create_expect_uml($filesystem_size, $tmp, $filename);
|
||||
|
||||
|
||||
}
|
||||
|
8
Changes
8
Changes
@ -1,4 +1,12 @@
|
||||
|
||||
Now files for uml_exclusively are made in create_expect_uml which is
|
||||
effectively known as the create stage. This avoids the unecessary previous
|
||||
requirement of having to select the copy stage again just to create a file
|
||||
for /dev/ubd/0. The file created is sparse, got this idea from a discussion
|
||||
Jeff had with a user on uml-user.
|
||||
|
||||
Made dd create sparse files.
|
||||
|
||||
Added jffs/jffs2 image construction.
|
||||
|
||||
1.3.5 - 02/13/2002
|
||||
|
Loading…
x
Reference in New Issue
Block a user