VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/mkdsk.sh@ 19420

Last change on this file since 19420 was 8155, checked in by vboxsync, 16 years ago

The Big Sun Rebranding Header Change

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1#!/bin/sh
2#
3# Copyright (C) 2006-2007 Sun Microsystems, Inc.
4#
5# This file is part of VirtualBox Open Source Edition (OSE), as
6# available from http://www.virtualbox.org. This file is free software;
7# you can redistribute it and/or modify it under the terms of the GNU
8# General Public License (GPL) as published by the Free Software
9# Foundation, in version 2 as it comes in the "COPYING" file of the
10# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
11# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
12#
13# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
14# Clara, CA 95054 USA or visit http://www.sun.com if you need
15# additional information or have any questions.
16#
17
18if [ "x$3" == "x" ]; then
19
20 echo "syntax error"
21 echo "syntax: $0 imagename <size-in-KBs> <init prog> [tar files]"
22 echo ""
23 echo "Simples qemu boot image is archived by only specifying an statically"
24 echo "linked init program and using the dev.tar.gz file to create devices."
25 echo "The boot linux in qemu specifying the image as -hda. Use the -kernel"
26 echo "option to specify a bzImage kernel image to use, and specify"
27 echo "-append root=/dev/hda so the kernel will mount /dev/hda and look"
28 echo "for /sbin/init there."
29 echo ""
30 echo "Example:"
31 echo " sh ./mkdsk.sh foo.img 2048 ~/VBox/Tree/out/linux/debug/bin/tstProg1 dev.tar.gz"
32 echo " qemu -hda foo.img -m 32 -kernel ~/qemutest/linux-test/bzImage-2.4.21 -append root=/dev/hda"
33 exit 1
34fi
35
36image=$1
37size=$2
38init=$3
39
40sizebytes=`expr $size '*' 1024`
41cyls=`expr 8225280 / $sizebytes`
42echo $cyls
43
44echo "* Creating $image of $size kb...."
45rm -f $image
46dd if=/dev/zero of=$image count=$size bs=1024 || exit 1
47
48echo "* Formatting with ext2..."
49/sbin/mkfs.ext2 $image || exit 1
50
51echo "* Mounting temporarily at ./tmpmnt..."
52mkdir -p tmpmnt
53sudo mount $image ./tmpmnt -t ext2 -o loop=/dev/loop7 || exit 1
54
55# init
56echo "* Copying $init to sbin/init..."
57mkdir tmpmnt/sbin
58sudo cp $init tmpmnt/sbin/init
59sudo chmod 755 tmpmnt/sbin/init
60
61shift
62shift
63shift
64while [ "x$1" != "x" ];
65do
66 echo "* Untarring $1 to disk..."
67 sudo tar -xzv -C tmpmnt -f $1
68 shift
69done
70
71echo "* Unmouning tmpmnt..."
72sudo umount tmpmnt
73rmdir tmpmnt
74echo "* Done! (Perhaps even successfully so...)"
75echo " 'root=/dev/hda' remember :-)"
76exit 0
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette