Cross Compiling Orangepizero OS Image

There are some images from the manufacturer for the low cost little board orangepizero is available but i liked the dietpi OS because it is lightweight and they provided a tasksel like tool to easily install other application software and configure those.

But at present, the support of dietpi for orangepizero has been stopped. However the team of dietpi are not irresponsible cause they have provided a shell script to convert/cross compile any debian or raspbian installation into the dietpi OS for orangepizero. Sounds promising, lets try it and see how far we can go.

At first, install virtualbox, Then download netinstall image of debian from debian website.

Then create a virtual machine with necessary resources, Then select a your downloaded debian iso image as the sata drive to boot from that and install it.

Then start the machine and install debian. While installing, deselect desktop environment and print server option by selecting menu and a press of spacebar. This was done to ensure the os is kept as light as possible.

After installation finished and reboted, issue the following command to install ssh.

apt install openssh-server openssh-client

Then shutdown the machine, change network settings as bridged and select the interface your computer is connected to the internet.

Start the virtual machine again. after login as root, aply following command:

apt install openssh-server openssh-client
ssh-keygen -A
systemctl start sshd
ip a

Then a output like the image above will shown. in my case, the ip of the machine is 192.168.43.149. Lets connect to the machine using putty like following:

Then login as root using following command:

su root

Then apply the following command to install prerequisites of diet pi script:

apt-get update; apt-get install -y systemd-sysv ca-certificates sudo wget locales --reinstall
export PATH=$PATH:/usr/sbin

Download dietpi script using the following command:

wget https://raw.githubusercontent.com/MichaIng/DietPi/master/PREP_SYSTEM_FOR_DIETPI.sh -O PREP_SYSTEM_FOR_DIETPI.sh

Make the script executable and run it:

chmod +x PREP_SYSTEM_FOR_DIETPI.sh
./PREP_SYSTEM_FOR_DIETPI.sh

Then i’ve did the following:

  1. Git branch: master selected
  2. Your name : Md. Khairul Hasan
  3. An url : https://github.com/MichaIng/DietPi/issues/1285
  4. Device: Orange Pi Zero (H2+)
  5. I require wifi functionality
  6. Buster stable release

After this message “Completed, disk can now be saved to .img for later use, or, reboot system to start first run of DietPi.” appears, the preparation of dietpi has been finished.

Now shut down the virtual machine, dont reboot. The .vdi image of the virtual box needs to be converted into a .img file to write on a memory card and use it on the orangepiero. I’ve issued the following command to windows command prompt to convert the image.

D:\Vbox\deb>pushd "C:\Program Files\Oracle\VirtualBox"
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe clonehd "D:\Vbox\deb\deb.vdi" "D:\Vbox\deb.img" --format RAW

Leave a Reply

Your email address will not be published. Required fields are marked *