Recently I wrote about creating an OpenStack Ironic deploy image with Buildroot. Doing this manually is good because it helps to understand how it’s pieced together, however it is slightly more involved.
The Ironic Python Agent (IPA) repo has some imagebuild scripts which make building the CoreOS and TinyCore images pretty trivial. I now have some patches which add support for creating the Buildroot images, too.
The patches consist of a few scripts which wrap the manual build method and a Makefile to tie it all together. Only the install-deps.sh script requires root privileges, if it detects missing dependencies, all other Buildroot tasks are run as a non-privileged user. It’s one of the great things about the Buildroot method!
Build
Again, I have included documentation in the repo, so please see there for more details on how to build and customise the image. However in short, it is as simple as:
git clone https://github.com/csmart/ironic-python-agent.git
cd ironic-python-agent/imagebuild/buildroot
make
# or, alternatively:
./build-buildroot.sh --all
These actions will perform the following tasks automatically:
- Fetch the Buildroot Git repositories
- Load the default IPA Buildroot configuration
- Download and verify all source code
- Build the toolchain
- Use the toolchain to build:
- System libraries and packages
- Linux kernel
- Python Wheels for IPA and dependencies
- Create the kernel, initramfs and ISO images
The default configuration points to the upstream IPA Git repository, however you can change this to point to any repo and commit you like. For example, if you’re working on IPA itself, you can point Buildroot to your local Git repo and then build and boot that image to test it!
The following finalised images will be found under ./build/output/images:
- bzImage (kernel)
- rootfs.cpio.xz (ramdisk)
- rootfs.iso9660 (ISO image)
These files can be uploaded to Glance for use with Ironic.
Help
To see available Makefile targets, simply run the help target:
make help
Help is also available for the shell scripts if you pass the –help option:
./build-buildroot.sh --help
./clean-buildroot.sh --help
./customise-buildroot.sh --help
Customisation
As with the manual Buildroot method, customising the build is pretty easy:
make menuconfig
# do buildroot changes, e.g. change IPA Git URL
make
I created the kernel config from scratch (via tinyconfig) and deliberately tried to balance size and functionality. It should boot on most Intel based machines (BIOS and UEFI), however hardware support like hard disk and ethernet controllers is deliberately limited. The goal was to start small and add more support as needed.
Customising the Linux kernel is also pretty easy, though:
make linux-menuconfig
# do kernel changes
make
Each time you run make, it’ll pick up where you left off and re-create your images.
Really happy for anyone to test it out and let me know what you think!
3 thoughts on “Patches for OpenStack Ironic Python Agent to create Buildroot images with Make”
I wanted to build a mitaka IPA, so I followed the instructions above (which are very helpful). The only wart I found is that I needed to cherry pick commit b5aba328aa820cd88374d51c7721a9d3f6b59d83 into the stable/mitaka branch before kicking off the build.
Oh, and I used a ubuntu 4.10 kernel config by extracting a deb from the ubuntu kernel team PPA. I needed to install flex, libdb-dev to get it to compile though. I also needed to disable the qedi driver for some reason.
K, not sure about Ubuntu stuff, but if you’re using Ubuntu’s kernel config you’ll probably also want to add their /lib/firmware into the overlay so that it matches what the modules are expecting.