summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorJiaojinxing <jiaojinxing1987@gmail.com>2015-05-13 06:46:03 (GMT)
committer Jiaojinxing <jiaojinxing1987@gmail.com>2015-05-13 06:46:03 (GMT)
commit38b55044550ae56b1271a123a97fb146e920e668 (patch)
tree0753f7c94688a8564f3b99016af96ccbcabd703b
parentc69ee58262d496ac7d69107b97455ccd5de7c47e (diff)
downloadqemu-mini2440-38b55044550ae56b1271a123a97fb146e920e668.zip
qemu-mini2440-38b55044550ae56b1271a123a97fb146e920e668.tar.gz
qemu-mini2440-38b55044550ae56b1271a123a97fb146e920e668.tar.bz2
Add ubuntu-12.04 support.
-rw-r--r--.gitignore1
-rw-r--r--mini2440_run.sh2
-rw-r--r--nandCreator.c47
-rw-r--r--nandCreator.sh3
-rw-r--r--ubuntu-12.04/interfaces14
-rw-r--r--ubuntu-12.04/qemu-ifdown11
-rw-r--r--ubuntu-12.04/qemu-ifup15
7 files changed, 93 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..10b8f03
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/nand.bin
diff --git a/mini2440_run.sh b/mini2440_run.sh
new file mode 100644
index 0000000..5abf238
--- /dev/null
+++ b/mini2440_run.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./qemu-system-arm -M mini2440 -show-cursor -kernel ../bspmini2440/Debug/bspmini2440.bin -serial stdio -mtdblock nand.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0
diff --git a/nandCreator.c b/nandCreator.c
new file mode 100644
index 0000000..6ac1151
--- /dev/null
+++ b/nandCreator.c
@@ -0,0 +1,47 @@
+
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char* argv[])
+{
+ FILE *fp;
+ long i;
+ unsigned char buf[4096];
+ long size;
+ int write_size;
+ int oob_size;
+ char name[128];
+ int ret;
+
+ strcpy(name, "nand.bin");
+
+ size = 128; /* MB */
+
+ write_size = 2048; /* Byte */
+
+ oob_size = 64; /* Byte */
+
+ size = size * 1024 * 1024 / write_size * (write_size + oob_size);
+
+ fp = fopen(name, "wb");
+ if (fp) {
+ for (i = 0; i < sizeof(buf); i++) {
+ buf[i] = 0xFF;
+ }
+
+ for (i = 0; i < size/sizeof(buf); i++) {
+ fwrite(buf, sizeof(buf), 1, fp);
+ }
+
+ fwrite(buf, size%sizeof(buf), 1, fp);
+
+ fclose(fp);
+
+ printf("create %s success\n", name);
+
+ } else {
+ printf("failed to create %s\n", name);
+ }
+ return 0;
+}
+
diff --git a/nandCreator.sh b/nandCreator.sh
new file mode 100644
index 0000000..07237ea
--- /dev/null
+++ b/nandCreator.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+gcc nandCreator.c -o nandCreator
+./nandCreator
diff --git a/ubuntu-12.04/interfaces b/ubuntu-12.04/interfaces
new file mode 100644
index 0000000..2a85fed
--- /dev/null
+++ b/ubuntu-12.04/interfaces
@@ -0,0 +1,14 @@
+# This file describes the network interfaces available on your system
+# and how to activate them. For more information, see interfaces(5).
+
+# The loopback network interface
+auto lo
+iface lo inet loopback
+
+# The primary network interface
+auto eth0
+#NetworkManager#iface eth0 inet dhcp
+
+auto br0
+iface br0 inet dhcp
+ bridge_ports eth0
diff --git a/ubuntu-12.04/qemu-ifdown b/ubuntu-12.04/qemu-ifdown
new file mode 100644
index 0000000..8f9d41f
--- /dev/null
+++ b/ubuntu-12.04/qemu-ifdown
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+echo sudo brctl delif br0 $1
+sudo brctl delif br0 $1
+
+echo sudo tunctl -d $1
+sudo tunctl -d $1
+
+echo brctl show
+brctl show
+
diff --git a/ubuntu-12.04/qemu-ifup b/ubuntu-12.04/qemu-ifup
new file mode 100644
index 0000000..083e7c4
--- /dev/null
+++ b/ubuntu-12.04/qemu-ifup
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+echo sudo tunctl -u $(id -un) -t $1
+sudo tunctl -u $(id -un) -t $1
+
+echo sudo ifconfig $1 0.0.0.0 promisc up
+sudo ifconfig $1 0.0.0.0 promisc up
+
+echo sudo brctl addif br0 $1
+sudo brctl addif br0 $1
+
+echo brctl show
+brctl show
+
+sudo ifconfig br0 192.168.7.20