How to do it...

We are going to access our target system via the network. QEMU provides a virtual network interface for the emulated machine, and we can use it without connecting to a real network. In order to do so, we need to figure out an IP address to use and make sure that the SSH server is running in our virtual environment:

In your native operating system environment, work out the IP address of your machine. Open a Terminal window or PowerShell. Run ifconfig on macOS, or Linux, or ipconfig for Windows, and check its output.

In the next steps, we will use 192.168.1.5 as a template IP address; you will need to replace it with your actual IP address.

  1. Switch to the Raspberry Pi emulator and enable SSH services by running the following command:
$ sudo systemctl start ssh
  1. Switch to the Ubuntu window and install the SSH client:
# apt install -y ssh
  1. Now, we can copy the hello executable to the target system:
# scp -P22023 /mnt/hello [email protected]:~
  1. When asked for a password, type raspberry. Switch back to the Raspberry Pi emulator window. Check that the executable we just copied is there:
$ ls hello
hello
  1. Now, run the program:
$ ./hello

 As we can see, the program is now running as expected.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.100.42