Skip to content

Commit 21c7ea9

Browse files
committed
ia32-generic-qemu: move network setup to quickstart
So far it was in ports/azure_sdk.md JIRA: COG-42
1 parent 5c93577 commit 21c7ea9

File tree

4 files changed

+91
-90
lines changed

4 files changed

+91
-90
lines changed

ports/azure_sdk.md

Lines changed: 7 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -42,99 +42,16 @@ are: `busybox`, `openssl`, `curl` and `azure_sdk`.
4242
[Here](https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/script.md) you can find more about
4343
building scripts.
4444

45-
Next, you will need an internet connection. Here is an example of how to set up a network connection on
46-
`ia32-generic-qemu`:
45+
Next, you will need an internet connection.
46+
[Here](../quickstart/ia32-generic-qemu.md#network-setup-on-ia32-generic-qemu)
47+
is an example of how to set up a network connection on `ia32-generic-qemu`.
4748

48-
## Network setup on ia32-generic-qemu
49+
- To complete the configuration please set the current date using `date` applet, like below:
4950

50-
- Note: This guide was tested on `Ubuntu 20.04 LTS` host OS.
51+
![Image](_images/azure_date.png)
5152

52-
There are few steps to follow:
53-
54-
1. Create and set up `vibr0` bridge on a host using `qemu-bridge-helper`:
55-
56-
- Install the required package and ensure that `libvirtd` is running:
57-
58-
```bash
59-
sudo apt-get update
60-
sudo apt-get install qemu-system-common
61-
systemctl enable libvirtd.service
62-
systemctl start libvirtd.service
63-
```
64-
65-
- Start the default network bridge, and configure it to run on startup.
66-
67-
```bash
68-
sudo virsh net-autostart --network default
69-
sudo virsh net-start --network default
70-
```
71-
72-
- After that verify that the IP range `192.168.122.1/24` is reported by the `vibr0` bridge:
73-
74-
```bash
75-
ip addr show virbr0
76-
```
77-
78-
- The expected output:
79-
80-
```bash
81-
virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
82-
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
83-
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
84-
valid_lft forever preferred_lft forever
85-
```
86-
87-
- Set up `qemu-bridge-helper` (`chmod` is used here to allow running QEMU without root privileges)
88-
89-
```bash
90-
echo "allow virbr0" > /etc/qemu/bridge.conf
91-
sudo chmod a+rw /etc/qemu/bridge.conf
92-
```
93-
94-
- If `/etc/qemu` directory does not exist, create it and provide required privileges:
95-
96-
```bash
97-
sudo mkdir /etc/qemu
98-
sudo chmod a+rw /etc/qemu
99-
echo "allow virbr0" > /etc/qemu/bridge.conf
100-
sudo chmod a+rw /etc/qemu/bridge.conf
101-
```
102-
103-
![Image](_images/azure_sdk_vibr_setup.png)
104-
105-
- Sources: <https://apiraino.github.io/qemu-bridge-networking/>,
106-
<https://mike42.me/blog/2019-08-how-to-use-the-qemu-bridge-helper-on-debian-10>
107-
108-
2. Launch `qemu` using a starting script with `net` suffix:
109-
110-
```bash
111-
./scripts/ia32-generic-qemu-net.sh
112-
```
113-
114-
3. Configure network and run `ash` (Busybox applet) using `rc` script:
115-
116-
- Note: By default `IP` is assigned using `DHCP`. For other possibilities please check the configuration file
117-
located in `_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.conf.d/network`
118-
119-
- Note: There are other programs executed by the script. For more information please check the content of the `rc`
120-
file for `ia32-generic-qemu` in `_projects/ia32-generic-qemu/rootfs-overlay/etc/rc`
121-
122-
```bash
123-
/linuxrc
124-
```
125-
126-
- As you can see, the advanced version of `Phoenix-RTOS` with `POSIX` shell has been started:
127-
128-
![Image](_images/azure_linuxrc.png)
129-
130-
- Now you can check the internet connection using the `ping` applet.
131-
132-
- To complete the configuration please set the current date using `date` applet, like below:
133-
134-
![Image](_images/azure_date.png)
135-
136-
- Note: The required argument entered after `@` is EPOCH (POSIX time format) - you can gt it for example from
137-
[here](https://www.epochconverter.com/).
53+
- Note: The required argument entered after `@` is EPOCH (POSIX time format) - you can gt it for example from
54+
[here](https://www.epochconverter.com/).
13855

13956
## Running the IoThub Client sample
14057

File renamed without changes.

quickstart/ia32-generic-qemu.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,90 @@ The number of detected cores is presented during kernel initialization.
124124

125125
![Image](_images/qemu-ia32-generic-smp.png)
126126

127+
## Network setup on `ia32-generic-qemu`
128+
129+
- Note: This guide was tested on `Ubuntu 20.04 LTS` host OS.
130+
131+
There are few steps to follow:
132+
133+
1. Create and set up `vibr0` bridge on a host using `qemu-bridge-helper`:
134+
135+
- Install the required package and ensure that `libvirtd` is running:
136+
137+
```bash
138+
sudo apt-get update
139+
sudo apt-get install qemu-system-common
140+
systemctl enable libvirtd.service
141+
systemctl start libvirtd.service
142+
```
143+
144+
- Start the default network bridge, and configure it to run on startup.
145+
146+
```bash
147+
sudo virsh net-autostart --network default
148+
sudo virsh net-start --network default
149+
```
150+
151+
- After that verify that the IP range `192.168.122.1/24` is reported by the `vibr0` bridge:
152+
153+
```bash
154+
ip addr show virbr0
155+
```
156+
157+
- The expected output:
158+
159+
```bash
160+
virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
161+
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
162+
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
163+
valid_lft forever preferred_lft forever
164+
```
165+
166+
- Set up `qemu-bridge-helper` (`chmod` is used here to allow running QEMU without root privileges)
167+
168+
```bash
169+
echo "allow virbr0" > /etc/qemu/bridge.conf
170+
sudo chmod a+rw /etc/qemu/bridge.conf
171+
```
172+
173+
- If `/etc/qemu` directory does not exist, create it and provide required privileges:
174+
175+
```bash
176+
sudo mkdir /etc/qemu
177+
sudo chmod a+rw /etc/qemu
178+
echo "allow virbr0" > /etc/qemu/bridge.conf
179+
sudo chmod a+rw /etc/qemu/bridge.conf
180+
```
181+
182+
![Image](_images/ia32_sdk_vibr_setup.png)
183+
184+
- Sources: <https://apiraino.github.io/qemu-bridge-networking/>,
185+
<https://mike42.me/blog/2019-08-how-to-use-the-qemu-bridge-helper-on-debian-10>
186+
187+
2. Launch `qemu` using a starting script with `net` suffix:
188+
189+
```bash
190+
./scripts/ia32-generic-qemu-net.sh
191+
```
192+
193+
3. Configure network and run `ash` (Busybox applet) using `rc` script:
194+
195+
- Note: By default `IP` is assigned using `DHCP`. For other possibilities please check the configuration file
196+
located in `_projects/ia32-generic-qemu/rootfs-overlay/etc/rc.conf.d/network`
197+
198+
- Note: There are other programs executed by the script. For more information please check the content of the `rc`
199+
file for `ia32-generic-qemu` in `_projects/ia32-generic-qemu/rootfs-overlay/etc/rc`
200+
201+
```bash
202+
/linuxrc
203+
```
204+
205+
- As you can see, the advanced version of `Phoenix-RTOS` with `POSIX` shell has been started:
206+
207+
![Image](_images/ia32_linuxrc.png)
208+
209+
- Now you can check the internet connection using the `ping` applet.
210+
127211
## Running image on regular hardware
128212

129213
To run the image on regular hardware please be sure that a target system is equipped with an ATA disk supporting the

0 commit comments

Comments
 (0)