1

I'm following Baking Pi and am just on lesson 1, which is the simple introductory ARMv6 code to turn on the OK LED on the Pi. I have compiled the code I've written and now the tutorial says to use an existing SD Card with a Linux distro on it, and replace kernel.img on that SD, with the kernel.img created from our tiny program.

While I could download one (and will, of course, if it is necessary) I don't have an existing Linux distro on the card right now. It's just a blank card. I'd also like to get a better understanding for what the Pi does when it is powered on. I assume the reason this tutorial uses an existing Linux installation and replaces the kernel with our own is purely because it doesn't want to have to introduce the concept of a bootloader, and GRUB or LILO will be on the card.

I tend to learn more effectively by diverging from what tutorials tell you and exploring by myself.

Given a bootloader is just code that is executed when the Pi is powered on (I assume), is it strictly necessary to install Linux just so I can run my 352 byte program on the hardware, or can I flash this straight to the card and have it run when I power on the machine?

I guess my ignorance here comes from the fact I don't know the technical details of what a bootloader actually does... I mean, whether or not it is arbitrary code that sits in the MBR, or if it has to conform to some sort of standard, which my program obviously won't do.

1
  • Since you seem to be interested in low-level coding on the Pi, have you had a chance to check out Craig Bamford's DexBasic?
    – Jim Green
    Jun 17, 2013 at 12:41

2 Answers 2

1

The answer is both "Yes" and "No".

Yes, because the executable code obviously could be run straight from the SD card (Raspberry Pi firmware reads the bootloader from the SD card), and it's very possible to create your own bootloader and copy it to the SD card.

On the other hand, it's No, because 1) your tutorial build system does not produce the code, that can be used as a bootloader, you will need a different set of libraries/make files and 2) the process of writing bootloader to the SD card is much more involving and generally unsafer, than copying the kernel.img file.

Overall, using SD card without writing a Linux image there first is possible, but considering that it takes only about 2-3 minutes, it's just not worth the trouble.

0

in addition you will have to know the technical details of all the Bancom and other hardware registers to get anything to work at all. Building an application from scratch is not a trivial task at all. Been there, doing that for 20 years..... I would rather have had linux all those years ago....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.