Browse Source

Support linux in manual fetchurl test

cached_fs_rom
Christian Helmuth 4 months ago
parent
commit
ccafba4ff8

+ 34
- 9
repos/libports/run/fetchurl.inc View File

@@ -4,16 +4,39 @@
4 4
 # \date   2016-06-05
5 5
 #
6 6
 
7
-if {[have_spec linux] || [have_spec rpi3] ||
7
+if {[have_spec rpi3] ||
8 8
     [expr [have_spec imx53] && [have_spec trustzone]]} {
9 9
 	puts "Run script does not support this platform."
10 10
 	exit 0
11 11
 }
12 12
 
13
-proc socket_fs_plugin {} {
14
-	global use_lxip
15
-	if { $use_lxip } { return lxip }
16
-	return lwip
13
+if {[get_cmd_switch --autopilot] && [have_spec linux]} {
14
+	puts "Autopilot mode is not supported on this platform."
15
+	exit 0
16
+}
17
+
18
+#
19
+# This run script works on Linux with NAT setup from tap0 to uplink
20
+# device uplink0 like follows.
21
+#
22
+# iptables -t nat -A POSTROUTING -o uplink0 -j MASQUERADE
23
+# iptables -A FORWARD -i tap0    -o uplink0 -j ACCEPT
24
+# iptables -A FORWARD -i uplink0 -o tap0    -m state --state RELATED,ESTABLISHED -j ACCEPT
25
+# echo 1 > /proc/sys/net/ipv4/ip_forward
26
+#
27
+
28
+proc socket_fs_plugin { } {
29
+	set result "<[ip_stack]"
30
+
31
+	if {[have_spec linux]} {
32
+		append result { ip_addr="10.0.2.55" netmask="255.255.255.0"}
33
+		append result { gateway="10.0.2.1" nameserver="1.1.1.1"}
34
+	} else {
35
+		append result { dhcp="yes"}
36
+	}
37
+
38
+	append result {/>}
39
+	return $result
17 40
 }
18 41
 
19 42
 create_boot_directory
@@ -29,7 +52,7 @@ import_from_depot [depot_user]/src/[base_src] \
29 52
                   [depot_user]/src/libssl \
30 53
                   [depot_user]/src/report_rom \
31 54
                   [depot_user]/src/vfs \
32
-                  [depot_user]/src/vfs_[socket_fs_plugin] \
55
+                  [depot_user]/src/vfs_[ip_stack] \
33 56
                   [depot_user]/src/zlib
34 57
 
35 58
 install_config {
@@ -82,16 +105,18 @@ install_config {
82 105
 					<log/> <null/> <inline name="rtc">2000-01-01 00:00</inline>
83 106
 					<inline name="random">01234567890123456789</inline>
84 107
 				</dir>
85
-				<dir name="socket"> <} [socket_fs_plugin] { dhcp="yes"/> </dir>
108
+				<dir name="socket"> } [socket_fs_plugin] { </dir>
86 109
 			</vfs>
87
-			<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc" socket="/socket"/>
110
+			<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"
111
+			      rng="/dev/random" socket="/socket"/>
88 112
 			<fetch url="https://genode.org/about/LICENSE" path="/dev/log" retry="3"/>
89 113
 		</config>
90 114
 	</start>
91 115
 </config>
92 116
 }
93 117
 
94
-build_boot_image {}
118
+build            { }
119
+build_boot_image { }
95 120
 
96 121
 proc qemu_nic_model {} {
97 122
 	if [have_spec x86]         { return e1000 }

+ 1
- 1
repos/libports/run/fetchurl_lwip.run View File

@@ -1,2 +1,2 @@
1
-set use_lxip 0
1
+proc ip_stack { } { return lwip }
2 2
 source ${genode_dir}/repos/libports/run/fetchurl.inc

+ 1
- 1
repos/libports/run/fetchurl_lxip.run View File

@@ -1,2 +1,2 @@
1
-set use_lxip 1
1
+proc ip_stack { } { return lxip }
2 2
 source ${genode_dir}/repos/libports/run/fetchurl.inc

Loading…
Cancel
Save