Tech: Kernel Builder

2022, Dec 11    

In a 'no pictures' look back to 2009, where my hair was spiky and my coding skills were similar to those of a crazed cat on LSD, I recall one of my more useful projects that saved me a significant amount of time and effort for many years, the automated kernel builder.

Many years ago I spent a large portion of my time (both in and out of work) working on building / developing for / tweaking the Linux kernel, especially for embedded devices (but on occasion for some enterprise hardware). In an effort to save time (and my sanity) I decided to put my scripting to the test to automate as much of the process as possible.

As anyone who has worked on embedded hardware can attest to, building for different hardware (especially when the WRT project was in its infancy) is not an easy task. Combine that with needing to patch / build / deploy / rework / repeat, and doing things manually becomes dire...

What started as a simple project grew significantly, with the premise of having the following attributes:

  • Support multiple build platforms / cross compiling
  • Support common / platform-specific patching
  • Support automated pushing / deployment (a.k.a. success hooks)
  • Be as fast as possible
  • Be as friendly as possible

Functionality grew as the months passed by, covering everything from downloading / unpacking / configuring cross-compilers, analysing the top ten symbols to determine bloat, to multi-arch patching and failure-handling. The amount of manual effort required for testing was reduced significantly, and my ability to support multiple platforms grew.

To my amazement, running the code recently to build a new kernel for the Bifferboard actually worked. Some rough edges along the way, but it did exactly what it was supposed to do. While there are more flexible systems available to use today, I'm still somewhat impressed that it didn't catch fire.

Full disclosure, in spending 30 minutes going over the code that I wrote in 2009 (and was only maintained until 2011) I have come to realise that my coding skills at the time was mediocre at best, and saying I have improved over the years is an understatement!

Perhaps I will find a few hours to rework the code into something that shellcheck doesn't show many hundreds of errors for...