- Size of VM after running
./build_bela.sh
: 27.52GB - Size of
bela-image-builder
folder after running./build_bela.sh
: 12GB
- Install VirtualBox
- Download an Ubuntu image
- Set up an Ubuntu VM in VirtualBox (you will need ≥30GB disk and ≥2GB RAM)
- Boot the VM and install the image
- Let Ubuntu run some updates, then run
sudo apt-get update && sudo apt-get upgrade
- For convenience, add some apps to favourites (dock): Settings, TextEditor, Terminal
- Install git and setup global config
sudo apt-get install git git-core
git config --global user.email johndoe@example.com
git config --global user.name "John Doe"
If you want to git clone the image builder repo rather than just download it, set up ssh
https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/
(Optionally) set up a decent shell (setting up zsh
on Ubuntu: https://gist.github.com/tsabat/1498393)
sudo apt-get install curl zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
chsh -s `which zsh`
sudo shutdown -r 0
Ubuntu does not come with a text editor, so you may also want to install something like Sublime Text: https://www.sublimetext.com/docs/3/linux_repositories.html
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt-get update
sudo apt-get install sublime-text
Install some necessary dependencies:
- The build script will complain about the absence of
qemu-arm-static
when it meansqemu-user-static
libtool-bin
is required becauselibtool
doesn't install binaries for some reason
sudo apt-get install qemu qemu-user-static dh-autoreconf daemontools binutils-arm-linux-gnueabihf lzma lzop libtool-bin debootstrap kpartx bison flex pkg-config libncurses5-dev:amd64
If you can't find all the above packages, find alternatives:
sudo apt-get install apt-file
sudo apt-file update
sudo apt-file search PACKAGE_NAME
For example in this case I used the following alternatives compared to what the build script asked for:
autoreconf -> dh-autoreconf
setuidgid -> daemontools
arm-linux-gnueabihf-ranlib -> binutils-arm-linux-gnueabihf
Clone the repo somewhere (e.g. ~/Documents/git/
)
git clone git@github.com:BelaPlatform/bela-image-builder.git
Now try running the script as root
cd path/to/bela-image-builder
sudo ./build_bela.sh
Eventually you will get a ~3.9GB file bela.img
. At this point you should take a Snapshot of your VM.
To transfer this file to your host machine, you may want to first compress it (use -k
to prevent deleting the original file, and --verbose
for progress updates):
xz -k --verbose bela.img
Or you may not, since this could take longer than just copying it to your host and compressing it there if required.
In the case that your host is a Mac, you will need to set up Guest Additions which is somewhat involved: https://matthewpalmer.net/blog/2017/12/10/install-virtualbox-mac-high-sierra/index.html
Note on above: I couldn't access the folder from my user so had to use sudo cp
to copy to the shared folder.
To use the image file, follow this article: https://github.com/BelaPlatform/Bela/wiki/Manage-your-SD-card#flashing-an-sd-card
The build process is slow. There are three steps in the build process that take the longest (after the first run, which is the one that does all the downloads, including the KERNEL):
- Building the kernel
- Building the base debian image (the
debootstrap
command, which readspackages.txt
) - The
scripts/chroot.sh
part. This runs inside achroot
, usingqemu
, so everything that happens in here is usingqemu
to emulate the ARM architecture.
The first two steps can normally be skipped when you re-build an image, as the kernel version is frozen anyhow, and debootstrap
takes forever (and requires a lot of network bandwidth).
Most of the changes these days happen either in:
packages.txt
in which case you need to re-rundebootstrap
, so you can run, e.g.:sudo ./build_bela.sh --no-kernel --no-bootloader --no-build-xenomai --no-downloads
- Or in
chroot.sh
or inmisc/rootfs/
(files that are manually created on the file system, so you can run, e.g.sudo ./build_bela.sh --no-kernel --cached-fs --no-bootloader --no-build-xenomai --no-downloads
It could be tempting for you to add your packages to packages.txt
, but I'd suggest maybe you add them as an apt-get install ...
line at the bottom of scripts/chroot.sh
, so you can more quickly iterate the builds and test
Hey,
We are trying to run a bela image in a virtualbox. Is this what this document is doing?