@ -1122,7 +1122,9 @@ sub space_check {
########################
########################
# This is really copy for normal users, uml_exclusively, and genext2fs
# 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 {
sub create_filesystem {
my ( $ filename , $ fs_size , $ mnt , $ strip_lib ,
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
# 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,
# user can be booted as ubd0, and the ubd1 is given a filesystem,
# after which everything is copied over from loopback to
# 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
# --freesource
@ -1160,22 +1162,23 @@ sub create_filesystem {
# Allow smaller than 8192 if exclusive.
# Allow smaller than 8192 if exclusive.
if ( $ uml_exclusively == 1 ) {
## if ( $uml_exclusively == 1 ) {
sync ( ) ;
## sync();
info ( 1 , "dd if=/dev/zero of=$device bs=1k count=$fs_size\n" ) ;
## 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" ) ;
## sys("dd if=/dev/zero of=$device bs=1k count=$fs_size");
sync ( ) ;
## sync();
}
## }
elsif ( $> != 0 && $ fs_size > 8192 && $ fs_type eq "genext2fs" ) {
## 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 ( ) ;
sync ( ) ;
info ( 1 , "dd if=/dev/zero of=$device bs=1k count=$fs_size\n" ) ;
info ( 0 , "Making sparse file for loopback at $device\n" ) ;
sys ( "dd if=/dev/zero of=$device bs=1k count=$fs_size" ) ;
info ( 1 , "dd if=/dev/zero of=$device bs=1k count=1 seek=$fs_size\n" ) ;
sync ( ) ;
sys ( "dd if=/dev/zero of=$device bs=1k count=1 seek=$fs_size" ) ;
}
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" ) ;
sync ( ) ;
sync ( ) ;
}
}
@ -1408,7 +1411,7 @@ sub create_filesystem {
# For root loop devices this will just ldconfig and umount.
# For root loop devices this will just ldconfig and umount.
sub create_expect_uml {
sub create_expect_uml {
my ( $ fs_size , $ mnt ) = @ _ ;
my ( $ fs_size , $ mnt , $ filename ) = @ _ ;
my $ fs_type = ( split ( /\s/ , $ main:: makefs ) ) [ 0 ] ;
my $ fs_type = ( split ( /\s/ , $ main:: makefs ) ) [ 0 ] ;
my $ error ;
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 ) {
if ( $ fs_type ne "genext2fs" && $ uml_exclusively == 0 ) {
## Probably will want to umount here
## Probably will want to umount here
return "ERROR" if errum ( sys ( "umount $mount_point" ) ) == 2 ;
return "ERROR" if errum ( sys ( "umount $mount_point" ) ) == 2 ;
@ -1480,7 +1502,7 @@ sub create_expect_uml {
info ( 0 , "$command_line\n\n" ) ;
info ( 0 , "$command_line\n\n" ) ;
# add error correction
# add error correction
# I'll allow the GUI to lock-x up for big copies and fs creation.
# I'll allow the GUI to lock-up for big copies and fs creation.
open ( EXPECT , "$command_line|" ) ;
open ( EXPECT , "$command_line|" ) ;
while ( <EXPECT> ) {
while ( <EXPECT> ) {
info ( 1 , "$x_count $_" ) ;
info ( 1 , "$x_count $_" ) ;
@ -1488,6 +1510,7 @@ sub create_expect_uml {
while ( Gtk - > events_pending ) { Gtk - > main_iteration ; }
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" ||
if ( $ fs_type eq "mkcramfs" || $ fs_type eq "genromfs" ||
$ fs_type eq "mkfs.jffs" || $ fs_type eq "mkfs.jffs2" ) {
$ fs_type eq "mkfs.jffs" || $ fs_type eq "mkfs.jffs2" ) {