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!
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
# or, alternatively:
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.
To see available Makefile targets, simply run the help target:
Help is also available for the shell scripts if you pass the –help option:
As with the manual Buildroot method, customising the build is pretty easy:
# do buildroot changes, e.g. change IPA Git URL
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:
# do kernel changes
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!