## Как использовать BusyBox для создания initrd ### 1. Скачайте исходный код Busybox и распакуйте его ``` shell wget https://busybox.net/downloads/busybox-1.36.1.tar.bz2 tar -xjf busybox-1.36.1.tar.bz2 ``` ### 2. Скомпилируйте BusyBox ``` shell make defconfig make menuconfig ``` **Примечание**: выберите опцию «Build static binary (no shared libs)», чтобы создать двоичный файл без зависимостей от библиотек. ### 3. Установите BusyBox Установите скомпилированный BusyBox по умолчанию в папку `_install`. ``` shell make install ``` ### 4. Настройте BusyBox ```shell cd _install mkdir proc sys dev etc etc/init.d touch etc/init.d/rcS cat >etc/init.d/rcS<<EOF #!/bin/sh mount -t proc none /proc mount -t sysfs none /sys /sbin/mdev -s EOF chmod +x etc/init.d/rcS ``` ### 5. Создайте образ initrd ```shell cd _install find . | cpio -o --format=newc > /tmp/StratoVirt-initrd ``` ### 6. Запустите StratoVirt с помощью initrd ```shell $ ./stratovirt \ -machine microvm \ -kernel /path/to/kernel \ -append "console=ttyS0 reboot=k panic=1 root=/dev/ram rdinit=/bin/sh" \ -initrd /tmp/StratoVirt-initrd \ -qmp unix:/path/to/socket,server,nowait \ -serial stdio ```