summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2013-12-23 21:43:27 +0200
committerDavid S. Miller <davem@davemloft.net>2014-01-28 23:56:50 -0800
commit959bd3d8dfeec81f56d950a842da0dcb80327975 (patch)
tree049a7e99aefbfd72271f222eb63a385dd2598352
parentdc9163b0b47fcd3e53bef2c6ddde52bb414de584 (diff)
downloadsilo-959bd3d8dfeec81f56d950a842da0dcb80327975.tar.gz
tilo: make root image optional
Make root image optional. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--tilo/maketilo.c35
-rwxr-xr-xtilo/tilo.sh11
2 files changed, 27 insertions, 19 deletions
diff --git a/tilo/maketilo.c b/tilo/maketilo.c
index 0a14a96..30eaef4 100644
--- a/tilo/maketilo.c
+++ b/tilo/maketilo.c
@@ -56,7 +56,7 @@ int root_tweak (char *s)
int main (int argc, char **argv)
{
int i,len,rootlen;
- FILE *f, *g;
+ FILE *f, *g = NULL;
struct ImageInfo *ii;
char *sun4_kernel_start;
@@ -112,26 +112,26 @@ int main (int argc, char **argv)
if (!sun4_kernel) {
/*fprintf (stderr, "WARNING: Kernel for Sun4 not specified\n");*/
- } else if (!sun4_size || !sun4_root) {
+ } else if (!sun4_size || (!sun4_root && root_image)) {
fprintf (stderr, "WARNING: Original size and root address must be specified for Sun4\n");
return -1;
}
if (!sun4c_kernel) {
fprintf (stderr, "WARNING: Kernel for Sun4c/m/d not specified\n");
- } else if (!sun4c_size || !sun4c_root) {
+ } else if (!sun4c_size || (!sun4c_root && root_image)) {
fprintf (stderr, "ERROR: Original size and root address must be specified for Sun4c\n");
return -1;
}
if (!sun4u_kernel) {
fprintf (stderr, "WARNING: Kernel for Sun4u not specified\n");
- } else if (!sun4u_size || !sun4u_root) {
+ } else if (!sun4u_size || (!sun4u_root && root_image)) {
fprintf (stderr, "ERROR: Original size and root address must be specified for Sun4u\n");
return -1;
}
- if (!root_image) {
+ if (!root_image && (sun4_root || sun4c_root || sun4u_root)) {
fprintf (stderr, "ERROR: Root image not specified\n");
return -1;
}
@@ -141,16 +141,19 @@ int main (int argc, char **argv)
return -1;
}
- g = fopen (root_image, "rb");
- if (!g) {
- fprintf (stderr, "Can't load %s\n", root_image);
- return -1;
+ if (root_image) {
+ g = fopen (root_image, "rb");
+ if (!g) {
+ fprintf (stderr, "Can't load %s\n", root_image);
+ return -1;
+ }
+ fseek (g, 0, SEEK_END);
+ rootlen = ftell (g);
+ fseek (g, 0, SEEK_SET);
+ } else {
+ rootlen = 0;
}
- fseek (g, 0, SEEK_END);
- rootlen = ftell (g);
- fseek (g, 0, SEEK_SET);
-
if (rootlen + sun4_size + 0x4000 + 0x10000 >= 0x330000 ||
rootlen + sun4c_size + 0x4000 + 0x10000 >= 0x330000 ||
rootlen + sun4u_size + 0x4000 + 0x10000 >= 0x330000) {
@@ -215,8 +218,10 @@ int main (int argc, char **argv)
root_image_start = sun4u_kernel_start + len;
- fread (root_image_start, 1, rootlen, g);
- fclose (g);
+ if (root_image) {
+ fread (root_image_start, 1, rootlen, g);
+ fclose (g);
+ }
output_end = root_image_start + rootlen;
diff --git a/tilo/tilo.sh b/tilo/tilo.sh
index 175dacf..41e3e6a 100755
--- a/tilo/tilo.sh
+++ b/tilo/tilo.sh
@@ -57,9 +57,11 @@ do_image () {
echo " packed size = $PSIZE"
echo " root address = $ROOTA"
if [ -n "$sun4u" ]; then
- tilo_args="$tilo_args sun4u=$KERNEL.gz size4u=$SIZE root4u=$ROOTA"
+ tilo_args="$tilo_args sun4u=$KERNEL.gz size4u=$SIZE"
+ root_addr="$root_addr root4u=$ROOTA"
else
- tilo_args="$tilo_args sun4c=$KERNEL.gz size4c=$SIZE root4c=$ROOTA"
+ tilo_args="$tilo_args sun4c=$KERNEL.gz size4c=$SIZE"
+ root_addr="$root_addr root4c=$ROOTA"
fi
}
@@ -80,7 +82,7 @@ do_root () {
fi
ROOT_SIZE=`ls -l $rootimg | awk '{print$5}'`
echo Root image packed size = $ROOT_SIZE
- tilo_args="$tilo_args root=$rootimg"
+ root_img="root=$rootimg"
}
while [ $# != 0 ]; do
@@ -112,7 +114,8 @@ if [ -z "$sun4u" -a -z "$sun4c" ]; then
exit 1
fi
-$(dirname $0)/maketilo $tilo_args out=$output
+[ -n "$root_img" ] && root_img="$root_img $root_addr"
+$(dirname $0)/maketilo $tilo_args $root_img out=$output
rm -f $to_remove