|
@ -30,6 +30,7 @@ use Exporter; |
|
|
@EXPORT = qw(start); |
|
|
@EXPORT = qw(start); |
|
|
|
|
|
|
|
|
use strict; |
|
|
use strict; |
|
|
|
|
|
use POSIX; |
|
|
use BootRoot::Yard; |
|
|
use BootRoot::Yard; |
|
|
use BootRoot::YardBox; |
|
|
use BootRoot::YardBox; |
|
|
use BootRoot::Error; |
|
|
use BootRoot::Error; |
|
@ -1765,39 +1766,13 @@ sub uml_box { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# MTD? |
|
|
# MTD? |
|
|
if ( $mtd_check->get_active() ) { |
|
|
######### |
|
|
|
|
|
|
|
|
# Check for the existence of root=/dev/ram0 |
|
|
|
|
|
for ( $entry_advanced[9],$entry_advanced[10] ) { |
|
|
|
|
|
info(0,"$_"); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
unless ($pid = fork) { |
|
|
|
|
|
unless (fork) { |
|
|
|
|
|
if ($pid == 0) { |
|
|
|
|
|
sys("$entry_advanced[8] $entry_advanced[5] $entry_advanced[9] $entry_advanced[10]"); |
|
|
|
|
|
Gtk->_exit($pid); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
waitpid($pid,0); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# MTD? .. testing location |
|
|
|
|
|
if ( $mtd_check->get_active() ) { |
|
|
if ( $mtd_check->get_active() ) { |
|
|
|
|
|
|
|
|
# Everything becomes an option for Initrd to parse |
|
|
# Everything becomes an option for Initrd to parse |
|
|
# and is put on the options[9] line |
|
|
# and is put on the options[9] line |
|
|
|
|
|
|
|
|
my ($initrd, $ram, $mem); |
|
|
my ($initrd, $ram, $mem, $root, $ramdisk_size); |
|
|
|
|
|
|
|
|
for ( $entry_advanced[10],$entry_advanced[9] ) { |
|
|
for ( $entry_advanced[10],$entry_advanced[9] ) { |
|
|
|
|
|
|
|
@ -1807,6 +1782,15 @@ sub uml_box { |
|
|
$ram = 1; |
|
|
$ram = 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Check for the existence of root=/dev/ram0 |
|
|
|
|
|
if ( m,ramdisk_size=, ) { |
|
|
|
|
|
$ramdisk_size = 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# Check for the existence of root= |
|
|
|
|
|
if ( m,root=, ) { |
|
|
|
|
|
$root = 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
# Check for the existence of initrd= |
|
|
# Check for the existence of initrd= |
|
|
if ( m,initrd=, ) { |
|
|
if ( m,initrd=, ) { |
|
@ -1839,7 +1823,6 @@ sub uml_box { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
# Set a ram block if necessary |
|
|
# Set a ram block if necessary |
|
|
|
|
|
|
|
|
if ( !$ram ) { |
|
|
if ( !$ram ) { |
|
|
for ( $entry_advanced[10],$entry_advanced[9] ) { |
|
|
for ( $entry_advanced[10],$entry_advanced[9] ) { |
|
|
if ( m,root=, ) { |
|
|
if ( m,root=, ) { |
|
@ -1847,6 +1830,21 @@ sub uml_box { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
if ( !$root ) { |
|
|
|
|
|
$entry_advanced[9] = "root=/dev/ram0 " . $entry_advanced[9]; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Decide what to do with initrd |
|
|
|
|
|
if ( !$initrd ) { |
|
|
|
|
|
|
|
|
|
|
|
$initrd = "initrd=Initrd"; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
undef $initrd; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Will use this format |
|
|
# Will use this format |
|
@ -1855,41 +1853,72 @@ sub uml_box { |
|
|
# Tell initrd whether it is mtdram or blkmtd, and |
|
|
# Tell initrd whether it is mtdram or blkmtd, and |
|
|
if ( $mtd_radio_mtdram->get_active() ) { |
|
|
if ( $mtd_radio_mtdram->get_active() ) { |
|
|
|
|
|
|
|
|
# default mem required by mtdram equaling total size |
|
|
# ramdisk_size |
|
|
if ( !$mem ) { |
|
|
if ( !$ramdisk_size ) { |
|
|
|
|
|
$ramdisk_size = "ramdisk_size=$total_size"; |
|
|
$mem = "mem=$total_size" . "K"; |
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
undef $mem; |
|
|
undef $ramdisk_size; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ( !$initrd ) { |
|
|
# Memory needs to be figure out in 8192K blocks |
|
|
|
|
|
# otherwise it fails, and it needs to be at least 16384 |
|
|
|
|
|
# for uml. |
|
|
|
|
|
|
|
|
$initrd = "initrd=Initrd"; |
|
|
# mem |
|
|
|
|
|
my $mem_size; |
|
|
|
|
|
if ( $total_size < 16384 ) { |
|
|
|
|
|
$mem_size = 16384; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
$mem_size = 8192 * ceil($mtd_total_size / 8192); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$entry_advanced[9] = "$initrd $mem " . |
|
|
if ( !$mem ) { |
|
|
"mtd=mtdram,$fs_type,$total_size,$erasure_size " . |
|
|
$mem = "mem=$mem_size" . "K"; |
|
|
$entry_advanced[9]; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
|
|
|
undef $mem; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if ( !$initrd ) { |
|
|
$entry_advanced[9] = "$initrd $mem $ramdisk_size " . |
|
|
|
|
|
"mtd=mtdram,$fs_type,$total_size,$erasure_size " . |
|
|
|
|
|
$entry_advanced[9]; |
|
|
|
|
|
|
|
|
$initrd = "initrd=Initrd"; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
# blkmtd |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
$entry_advanced[9] = "$initrd " . |
|
|
$entry_advanced[9] = "$initrd " . |
|
|
"mtd=blkmtd,$fs_type,$total_size,$erasure_size " . |
|
|
"mtd=blkmtd,$fs_type,$total_size,$erasure_size " . |
|
|
$entry_advanced[9]; |
|
|
$entry_advanced[9]; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
info(0,"$entry_advanced[9]\n$entry_advanced[10]\n"); |
|
|
#info(0,"$entry_advanced[9]\n$entry_advanced[10]\n"); |
|
|
|
|
|
|
|
|
} # mtd preparations |
|
|
} # mtd preparations |
|
|
|
|
|
############# |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
unless ($pid = fork) { |
|
|
|
|
|
unless (fork) { |
|
|
|
|
|
if ($pid == 0) { |
|
|
|
|
|
sys("$entry_advanced[8] $entry_advanced[5] $entry_advanced[9] $entry_advanced[10]"); |
|
|
|
|
|
Gtk->_exit($pid); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
waitpid($pid,0); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# MTD .. testing location |
|
|
|
|
|
|
|
|
if (!$entry_advanced[8]) { |
|
|
if (!$entry_advanced[8]) { |
|
|
error_window("gBootRoot Error: " . |
|
|
error_window("gBootRoot Error: " . |
|
|