droidix
Posts: 7
Joined: Mon Apr 02, 2012 9:34 pm

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 5:10 am

Greetings,

Is the source code to bootcode.bin available somewhere?  I looked through the github repo and couldn't find it.  If I remember correctly, this runs on the GPU so the instructions are not in standard ARM machine code format (objdump produces something incoherent).

Would it be possible to boot Linux directly from a modified bootcode.bin without loading the GPU firmware blob?  The Pi would clearly lack any kind of video output or GPU related functionality, but hopefully remote work with SSH would still be possible.

Thanks!

User avatar
jbeale
Posts: 3494
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 5:56 am

As I recall you can't do anything without the GPU, it comes up first and then the ARM processor is started from the GPU

User avatar
rew
Posts: 423
Joined: Fri Aug 26, 2011 3:25 pm

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 6:21 am

How do you think the Linux kernel gets loaded?

The GPU has a boot ROM. It accesses the SD card, loads bootcode.bin, accesses the SD card again, loads start.elf, accesses the SD card again, loads kernel.img, and THEN starts the ARM processor.

The GPU is essential in the boot process of the RPI.

Why do you want to bypass the GPU?
Check out our raspberry pi addons: https://www.bitwizard.nl/shop/

User avatar
Gert van Loo
Posts: 2485
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 8:46 am

droidix said:

....
Would it be possible to boot Linux directly from a modified bootcode.bin without loading the GPU firmware blob?  ....



The answer is simple: No!

Not because of secrecy but because you just can't. The GPU has to release the ARM from reset so it is simply not possible.

hippy
Posts: 5962
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 11:33 am

droidix said:

Would it be possible to boot Linux directly from a modified bootcode.bin without loading the GPU firmware blob?
Noting what Gert said ( "No" ), I'd have thought you could achieve something though to what end I'm not sure.

You could simply put a 0x00 over a byte in bootcode.bin and as long as it doesn't affect the part which instructs the GPU to load the SD card to RAM and releases the CPU from reset that should work though the GPU itself could become borked. The trick would be in executing the parts needed but preventing the GPU doing anything else.

Taken to extremes, you could probably have a bootcode.bin mostly zeroed but still doing what is required for bootloading Linux. You'd still be loading a GPU 'blob' but a blob which simply idle-loops or similar. Depending on how the file is formatted or used it might be possible to reduce its size.

If you could do it, I'm not sure what the point or gain would be beyond possibly reducing the size of the blob.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 1:03 pm

Just out of curiosity, mind you, but it seems like the answer to the OP's first and core question could be "Yes".  That question being "Is the source code for bootcode.bin available - and can I get it?"  As I understand it, only start.elf is "secret".

What they (the OP) would do with it is, of course, up for grabs...
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23682
Joined: Sat Jul 30, 2011 7:41 pm

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 1:34 pm

I think you should be able to boot whatever you like with the standard bootcode.bin. Just replace the Linux image with something else with the same format.

Having the source for bootcode.bin (presuming it runs on the GPU) is fairly pointless, since you won't be able to compile/assemble it without the tools, which are not available to the general public.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 1:47 pm

JamesH said:  


Having the source for bootcode.bin (presuming it runs on the GPU) is fairly pointless, since you won't be able to compile/assemble it without the tools, which are not available to the general public.



Details, details...
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

droidix
Posts: 7
Joined: Mon Apr 02, 2012 9:34 pm

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 2:31 pm


As I recall you can't do anything without the GPU, it comes up first and then the ARM processor is started from the GPU



Correct, I was hoping that bootcode.bin (with modifications/additions) would be able to setup enough of the GPU (release the ARM, etc…). This probably all happens in start.elf now, but maybe the bare bones setup routines could be made public along with the bootcode.bin source code.


The GPU is essential in the boot process of the RPI.

Why do you want to bypass the GPU?



Not completely bypass it, just bare-bones enough to understand the entire boot process from bootcode.bin to whatever OS kernel is loaded. It could be an interesting learning exercise.


Having the source for bootcode.bin (presuming it runs on the GPU) is fairly pointless, since you won't be able to compile/assemble it without the tools, which are not available to the general public.



I think the community would produce an assembler in short order. We already have the binary, having the source would be enough to put at least some pieces together. Look at how fast assemblers and compilers were produced after the DCPU-16 spec was released by Notch

I know the GPU architecture is several orders of magnitude more complex than the DCPU-16 (and none of us mere mortals outside of Broadcom are supposed to be able to comprehend it), but surely the boot process without all of the video stuff could be grasped by some of us.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23682
Joined: Sat Jul 30, 2011 7:41 pm

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 3:09 pm

I'm sure someone could reverse engineer some of the instruction set (note that isn't publicly available either), but it is 200 pages of instructions, scaler and vector, so not easy. I'm more intrigued about why they would bother. You need the GPU to run the display, so you need to at least have booted that, and once the GPU is running, anything that isn't used is tuned off automatically anyway, so there is little or no benefit to having a custom bootloader that just did a minimal boot, because the end result is pretty much the same as the standard boot anyway.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

droidix
Posts: 7
Joined: Mon Apr 02, 2012 9:34 pm

Re: Source code for bootcode.bin?

Tue Apr 24, 2012 3:19 pm

JamesH said:


I'm sure someone could reverse engineer some of the instruction set (note that isn't publicly available either), but it is 200 pages of instructions, scaler and vector, so not easy. I'm more intrigued about why they would bother. You need the GPU to run the display, so you need to at least have booted that, and once the GPU is running, anything that isn't used is tuned off automatically anyway, so there is little or no benefit to having a custom bootloader that just did a minimal boot, because the end result is pretty much the same as the standard boot anyway.



I wasn't worried about any kind of display if that added too much complexity and would just settle for a headless system accessed via SSH.  It's good to know the GPU turns off unused components to save power though.

User avatar
rew
Posts: 423
Joined: Fri Aug 26, 2011 3:25 pm

Re: Source code for bootcode.bin?

Wed Apr 25, 2012 8:12 am

It's not even that much. At 5V I measured about 20-30 mA of input power required to drive a 1920x1080 HDMI framebuffer....
Check out our raspberry pi addons: https://www.bitwizard.nl/shop/

piinthesky
Posts: 6
Joined: Thu Feb 23, 2012 9:37 pm

Re: Source code for bootcode.bin?

Wed Apr 25, 2012 7:49 pm

JamesH said:


I'm sure someone could reverse engineer some of the instruction set (note that isn't publicly available either), but it is 200 pages of instructions, scaler and vector, so not easy. I'm more intrigued about why they would bother. You need the GPU to run the display, so you need to at least have booted that, and once the GPU is running, anything that isn't used is tuned off automatically anyway, so there is little or no benefit to having a custom bootloader that just did a minimal boot, because the end result is pretty much the same as the standard boot anyway.



Isnt that the idea of the Pi though?  Provide a cheap usable "computer" and see what people do with it.  In this case you release the source and see what pops up.  Maybe nothing, but maybe something you never expected....

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23682
Joined: Sat Jul 30, 2011 7:41 pm

Re: Source code for bootcode.bin?

Wed Apr 25, 2012 8:03 pm

piinthesky said:


JamesH said:


I'm sure someone could reverse engineer some of the instruction set (note that isn't publicly available either), but it is 200 pages of instructions, scaler and vector, so not easy. I'm more intrigued about why they would bother. You need the GPU to run the display, so you need to at least have booted that, and once the GPU is running, anything that isn't used is tuned off automatically anyway, so there is little or no benefit to having a custom bootloader that just did a minimal boot, because the end result is pretty much the same as the standard boot anyway.


Isnt that the idea of the Pi though?  Provide a cheap usable "computer" and see what people do with it.  In this case you release the source and see what pops up.  Maybe nothing, but maybe something you never expected....


No, not really. The idea is to get a cheap programming/computing platform into the hands of people who don't usually get the chance.

And I'm not sure much unexpected is going to pop up from a bootloader.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

User avatar
cheery
Posts: 219
Joined: Wed Jan 25, 2012 9:39 pm

Re: Source code for bootcode.bin?

Thu Apr 26, 2012 1:01 am

I'd be happy about having all the details about the GPU as well. Though that would not add much additional value to the raspberry pi. Such tradeoffs were made that you could easily program a new kernel if you wanted to. Also, lot of care was taken to publish anything that added value to raspberry pi.

I think it's up to us to prove how we would appreciate publishing of the GPU datasheets.

User avatar
Jessie
Posts: 1754
Joined: Fri Nov 04, 2011 7:40 pm
Location: C/S CO USA

Re: Source code for bootcode.bin?

Thu Apr 26, 2012 4:19 am

Another one of these threads?  Why is this still open?

gsh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 1440
Joined: Sat Sep 10, 2011 11:43 am

Re: Source code for bootcode.bin?

Thu Apr 26, 2012 4:06 pm

Aint never going to happen, ever...

No not ever...

So don't even bother!

Gordon (Broadcom Cambridge manager)
--
Gordon Hollingworth PhD
Raspberry Pi - Director of Software Engineering

Return to “General discussion”