-
Notifications
You must be signed in to change notification settings - Fork 0
/
qemu.txt
63 lines (52 loc) · 1.69 KB
/
qemu.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#
# Author: Roberto A. Foglietta
#
# Instructions to use qemu for testing the image and update it
#
myip=10.0.2.15
brip=10.0.2.16
tcip=10.0.2.17
sudo brctl addbr brkvm
sudo ip addr add $brip/24 dev brkvm
sudo ip link set brkvm up
sudo mkdir -p /etc/qemu
sudo touch /etc/qemu/bridge.conf
echo "allow brkvm" | sudo tee /etc/qemu/bridge.conf
sudo dnsmasq --interface=brkvm --bind-interfaces --dhcp-range=$tcip,$tcip
# sudo iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
# sudo sysctl -w net.ipv4.ip_forward=1
drvboot="format=raw,file=tcl-usb.disk"
drvdata="format=raw,file=storage-10MB.disk"
sudo qemu-system-i386 --enable-kvm -m 256 -boot c -net nic -net bridge,br=brkvm -drive $drvboot -drive $drvdata
######################## UPDATE THE SYSTEM VIA SSH ########################
#
# if necessary update by hand these files before transfer them
#
# rootfs.gz sshdconfig.tgz tccustom.tgz
#
tcdir="/mnt/sda1"
sshpass -p tinycore ssh tc@$tcip "sudo root-ssh.sh; sudo unlock.sh"
list="
ntfscrea.sh
reboot.sh
root-ssh.sh
sshdconfig.tgz
sysinstall.sh
sysreset.sh
tccustom.tgz
unlock.sh
"
cd tinycore/changes
sshpass -p root scp $list root@$tcip:$tcdir/custom
sshpass -p root scp afterboot.sh root@$tcip:$tcdir
sshpass -p root scp syslinux.cfg root@$tcip:$tcdir/boot/syslinux
cd ..
cat rootfs.gz modules.gz | sshpass -p root ssh root@$tcip "dd of=$tcdir/boot/core.gz"
sshpass -p root scp vmlinuz root@$tcip:$tcdir/boot
cd ..
sshpass -p root ssh root@$tcip "dd if=/dev/zero of=$tcdir/zero; sync; rm -f $tcdir/zero; shutdown"
###########################################################################
sudo killall dnsmasq
sudo ip link set brkvm down
sudo ip addr del $brip/24 dev brkvm
sudo brctl delbr brkvm