From f7921951e1c508f54e1e2870e10e6687cc4f42db Mon Sep 17 00:00:00 2001 From: freesource Date: Tue, 5 Mar 2002 07:20:58 +0000 Subject: [PATCH] This keeps a nice size ration for $mtd_total_size, and automatically checks if the root_fs is real. --- BootRoot/BootRoot.pm | 36 ++++++++++++++++++++++++++++++++---- Changes | 6 ++++++ 2 files changed, 38 insertions(+), 4 deletions(-) diff --git a/BootRoot/BootRoot.pm b/BootRoot/BootRoot.pm index b558be3..e6ef1fc 100644 --- a/BootRoot/BootRoot.pm +++ b/BootRoot/BootRoot.pm @@ -136,7 +136,8 @@ my ($ea1,$ea2,$ea3,$ea4,$ea5,$ea6); # entry advanced boot my ($ear1,$ear2,$ear2_save,$ear3,$ear4); # entry advanced root my ($eab1,$eab2,$eab3,$eab4); # entry advanced uml my ($mtd_radio, $mtd_fs_type, $mtd_fs_type_combo, @fs_types, - $mtd_radio_mtdram, $mtd_radio_blkmtd, $mtd_check); # mtd uml box + $mtd_radio_mtdram, $mtd_radio_blkmtd, $mtd_check, $mtd_size, + $mtd_total_size); # mtd uml box my $uml_window; my $table_advanced; my $table_advanced_root; @@ -1662,7 +1663,7 @@ sub uml_box { label_advanced("total size:",1,2,5,6,$table_uml); my $mtd_adj = Gtk::Adjustment->new( 8192.0, 0.0, 1000000000.0, 128.0, 1024.0, 0.0 ); - my $mtd_size = Gtk::SpinButton->new( $mtd_adj, 0, 0 ); + $mtd_size = Gtk::SpinButton->new( $mtd_adj, 0, 0 ); $table_uml->attach($mtd_size,2,3,5,6, ['shrink','fill','expand'],['fill','shrink'], 0,0); @@ -1673,15 +1674,41 @@ sub uml_box { $mtd_size->set_numeric( $true ); $mtd_size->set_shadow_type( 'in' ); $mtd_size->show(); - + # Watch size if an actual file on open + if ( -f "$tmp/$entry_advanced[4]" ) { + my $stat_size = (stat("$tmp/$entry_advanced[4]"))[12]/2; + my $blocks = ($stat_size + ( $stat_size * 0.30 ))/1024; + $blocks = sprintf("%.f",$blocks); + $mtd_total_size = $blocks * 1024; + } + $eab3->signal_connect( "changed", sub { + my $root_fs = (split(/ubd0=/,$entry_advanced[10]))[1]; + if ( -f $root_fs ) { + my $stat_size = (stat("$root_fs"))[12]/2; + my $blocks = ($stat_size + ( $stat_size * 0.30 ))/1024; + $blocks = sprintf("%.f",$blocks); + $mtd_total_size = $blocks * 1024; + } + if ( $mtd_size ) { + $mtd_size->set_value($mtd_total_size) if $mtd_total_size; + } + }); + $mtd_adj->signal_connect( "value_changed", sub { + $mtd_total_size = $mtd_size->get_value_as_int(); + }); + $mtd_size->set_value($mtd_total_size) if $mtd_total_size; + - # erasure size + # erasure size $entry_advanced[15] label_advanced("erasure size:",3,4,5,6,$table_uml); my $mtd_erasure = entry_advanced(4,5,5,6,15,$table_uml); $tooltips->set_tip( $mtd_erasure, "Choose the erasure size for the mtd device.", "" ); + + #---------------------------------- + # Separators my $mtd_separator1 = Gtk::HSeparator->new(); $table_uml->attach($mtd_separator1,0,5,3,4, ['shrink','fill','expand'],['fill','shrink'], @@ -1695,6 +1722,7 @@ sub uml_box { 0,5); $mtd_separator2->show(); + $table_uml->set_row_spacing( 6, 8); diff --git a/Changes b/Changes index afb056f..25c6cbc 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,9 @@ +If a fs is being made with mkcramfs, genromfs, mkfs.jffs or mkfs.jffs2 and +the directories /dev or /initrd don't exist, they are automatically are +created during the create stage. Initrd dir is needed for mtd emulation +testing, and dev is also required. Devfs will always be used on /dev, and +won't be an option. + Added cad "Ctrl-Alt-Del" to mconsole interface, and documented it. Now looks for mconsole at both Locations /tmp/uml/$umid/mconsole and