Skip to content

Commit 9acbb28

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 b10a8cf commit 9acbb28

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
@@ -45,99 +45,16 @@ are: `busybox`, `openssl`, `curl` and `azure_sdk`.
4545
[Here](https://github.com/phoenix-rtos/phoenix-rtos-doc/blob/master/building/script.md) you can find more about
4646
building scripts.
4747

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

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

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

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

14259
## Running the IoThub Client sample
14360

File renamed without changes.

quickstart/ia32-generic-qemu.md

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

127127
![Image](_images/qemu-ia32-generic-smp.png)
128128

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

131215
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)