Raspberry Pi config.txt

It seems that the Raspberry Pi config.txt file is sensitive in its format, and can catch the unwary quite easily.

Recently the IMP OS kernel needed to be checked that it could run on its own, outside of the use of bootloader07. In order to achieve this, a simple change was required to the config.txt file, introducing the following line:

kernel_address = 0x3b000000

Spot the problem?

Unfortunately, after running a few checks on a Pi 3B+, it appears if there is white-space present, the Pi – upon boot – will essentially discard the directive; and quietly at that. This behaviour can have a subtle yet significant side-effect.

In this particular example, the IMP OS kernel continued to be loaded (as a 64-bit kernel) at the default address of 0x80000, rather than the expected 0x3b000000. The end result was a form of semi-chaotic kernel initialisation. (The kernel set VBAR correctly, but the vector table content was not loaded in the corresponding high memory area, so as soon as the first interrupt was triggered, the ARM – via VBAR – was directed at a vector table in memory containing undefined content. Mayhem ensued.)

The Pi – upon boot – essentially discards the directive; and quietly at that.

A quick check of the official Raspberry Pi web site article on config.txt file did not make this particular requirement obvious. This is fine – nobody is perfect – and serves to demonstrate how such things can become a personal source of frustration: when something like this happens, where the available documentation isn’t quite clear, and where there is no obvious feedback at run-time, how will this ever work? Self-doubt creeps in. And self-doubt is a bit like adrenaline: in small, controlled amounts it can stimulate alertness, heighten curiosity. But – unchecked – it can lead to frustration, anxiety, and instigate thoughts of abandonment (“this is never going to work – just give up now”).

At times like this, turning the situation away from being a “problem” is where the mindset needs to be. It gives hope to the possibility of payback. So the trick, if there is one, is to endeavour in consciously adjusting such situations from being “a problem” to being “a learning experience”. Standing atop the self-doubt, and reaching that point where a solution – often suddenly – presents itself, needs to be the goal. The time required for this can vary greatly: some experiences might take a couple of hours, others can require a lot longer. Prepare for the long game, on every occasion.

Prepare for the long game, on every occasion.

On this particular occasion, having spent over two hours digging into the cause of the problem, there was no option but to succumb to the age-old advice of “just walk away for a while”. It was actually the end of a day. The situation was incredibly frustrating: the behaviours witnessed didn’t quite match expectation, obvious things had been checked, a lot of intense thought had already taken place, yet there was also a recognition that the answer was simply not about to materialise, and time spent in front of the keyboard had become less than productive. Objectively, there was nothing to do but retire to bed for the night.

Time passes…

The next morning arrived. The root cause was spotted within five minutes.

This was one of those moments that, as a developer, is sometimes better experienced than explained. A solution suddenly presents itself and a kind of alchemy occurs, turning all of the self-doubt, all of the negativity, all of those “just give up” thoughts, into a single moment best described with just two words: “got it”.

Moral of the Story

So the IMP OS kernel now runs on its own. No need for bootloader07. And the moral of this story? If there is one, it’s that self-doubt is a natural and perhaps necessary thing but, where possible, is best kept in check. More importantly though, the ability to walk away from a problem – to have the patience and maturity of mind to realise that “today is not the day” – is an incredibly difficult thing to learn. But it’s also a valuable thing to learn.

And it really can make the difference between success and failure.