VirtualBox

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

Last change on this file since 74795 was 69221, checked in by vboxsync, 7 years ago

VMM: scm cleanups

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1#!/bin/sh
2## @file
3# Obsolete?
4#
5
6#
7# Copyright (C) 2006-2017 Oracle Corporation
8#
9# This file is part of VirtualBox Open Source Edition (OSE), as
10# available from http://www.virtualbox.org. This file is free software;
11# you can redistribute it and/or modify it under the terms of the GNU
12# General Public License (GPL) as published by the Free Software
13# Foundation, in version 2 as it comes in the "COPYING" file of the
14# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
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 "* Unmounting 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.

© 2023 Oracle
ContactPrivacy policyTerms of Use