Connecting a computer and Raspberry Pi 4 B
To see the output of the examples on the computer:
Diagram for connecting the USB-UART converter and Raspberry Pi 4 B
bps = 115200
, data bits = 8
, stop bits = 1
, parity = none
, flow control = none
.To allow a computer and Raspberry Pi 4 B to interact through Ethernet:
dhcpcd.conf
file, which is found at the path <example name>/resources/...
).Preparing a bootable SD card for Raspberry Pi 4 B
A bootable SD card for Raspberry Pi 4 B can be prepared automatically or manually.
To automatically prepare the bootable SD card, connect the SD card to the computer and run the following commands:
# The following command creates an image file for the bootable
# drive (*.img).
$ sudo /opt/KasperskyOS-Community-Edition-<version>/examples/rpi4_prepare_fs_image.sh
# In the following command, path_to_img is the path to the image file
# of the bootable drive (this path is displayed upon completion
# of the previous command), [X] is the final character
# in the name of the SD card block device.
$ sudo dd bs=4M if=path_to_img of=/dev/sd[X] conv=fsync
To manually prepare the bootable SD card:
$ sudo apt install gcc-arm-linux-gnueabi gcc-arm-linux-gnueabihf git bison flex
$ git clone https://github.com/u-boot/u-boot.git u-boot-armv7
$ cd u-boot-armv7 && git checkout tags/v2020.10
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- rpi_4_32b_defconfig
# In the menu that appears when you run the following command, enable
# the 'Enable a default value for bootcmd' option. In the 'bootcmd value' field, enter
# fatload mmc 0 ${loadaddr} kos-image; bootelf ${loadaddr}.
# Then exit the menu after saving the settings.
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- u-boot.bin
$ wget https://downloads.raspberrypi.org/raspbian_lite_latest
$ unzip raspbian_lite_latest
# In the following command, [X] is the last symbol in the name of the block device
# for the SD card.
$ sudo dd bs=4M if=$(ls *raspbian*lite.img) of=/dev/sd[X] conv=fsync
# In the following commands, the path ~/mnt/fat32 is just an example. You
# can use a different path.
$ mkdir -p ~/mnt/fat32
# In the following command, [X] is the last alphabetic character in the name of the block
# device for the partition on the formatted SD card.
$ sudo mount /dev/sd[X]1 ~/mnt/fat32/
$ sudo cp u-boot.bin ~/mnt/fat32/u-boot.bin
/opt/KasperskyOS-Community-Edition-<version>/examples
and run the following commands:$ sudo cp config.txt ~/mnt/fat32/config.txt
$ sync
$ sudo umount ~/mnt/fat32
Running an example on a Raspberry Pi 4 B
To run an example on a Raspberry Pi 4 B:
# In the following command, [X] is the last alphabetic character in the name of the block
# device for the partition on the bootable SD card.
# In the following commands, the path ~/mnt/fat32 is just an example. You
# can use a different path.
$ sudo mount /dev/sd[X]1 ~/mnt/fat32/
$ sudo cp build/einit/kos-image ~/mnt/fat32/kos-image
$ sync
$ sudo umount ~/mnt/fat32
The output displayed on the computer indicates that the example started.