linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Sharing code between Linux and bootloader (U-boot) ?
@ 2016-05-20 14:28 Sebastian Frias
  2016-05-20 15:08 ` Grant Edwards
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Sebastian Frias @ 2016-05-20 14:28 UTC (permalink / raw)
  To: u-boot, linux-arm-kernel, LKML; +Cc: Mason

Hi,

Some bootloaders (like U-boot) support several HW devices: serial, network, NAND, USB, etc. most of which are also supported by Linux.

So the question is: is code shared? I mean, I understand that the drivers need to talk to the appropriate API, and such API could be different between Linux and U-boot.
But putting that aside, would it be naive to imagine that some "core" functionality could be shared? Or would that part be so small it is not worth the effort?

Since many companies use both, U-boot and Linux, I would figure they try their best to optimize engineering resources and share code, right?
In that case, I also wonder how do they share DT descriptions that right now are being stored in the Linux kernel tree.

We'd like to share code/DT for obvious reasons, what would you guys suggest?

Best regards,

Sebastian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sharing code between Linux and bootloader (U-boot) ?
  2016-05-20 14:28 Sharing code between Linux and bootloader (U-boot) ? Sebastian Frias
@ 2016-05-20 15:08 ` Grant Edwards
  2016-05-21  1:41 ` [U-Boot] " Tom Rini
  2016-05-30 11:35 ` Holger Schurig
  2 siblings, 0 replies; 5+ messages in thread
From: Grant Edwards @ 2016-05-20 15:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: u-boot, linux-arm-kernel

On 2016-05-20, Sebastian Frias <sf84@laposte.net> wrote:

> Some bootloaders (like U-boot) support several HW devices: serial,
> network, NAND, USB, etc. most of which are also supported by Linux.
>
> So the question is: is code shared?

A little bit -- sort of.  I've seen chunks of code that have been
copied from Linux to U-Boot, and chunks of code in Linux and U-Boot
that appear to have come from the same place at some silicon vendor or
other.  And there are bits of code I've written that ended up in both
places.

But Linux and U-Boot don't share actual files, and any changes to the
"common" code has to be done twice.

-- 
Grant Edwards               grant.b.edwards        Yow! Are we THERE yet?
                                  at               
                              gmail.com            

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [U-Boot] Sharing code between Linux and bootloader (U-boot) ?
  2016-05-20 14:28 Sharing code between Linux and bootloader (U-boot) ? Sebastian Frias
  2016-05-20 15:08 ` Grant Edwards
@ 2016-05-21  1:41 ` Tom Rini
  2016-05-23 13:22   ` Sebastian Frias
  2016-05-30 11:35 ` Holger Schurig
  2 siblings, 1 reply; 5+ messages in thread
From: Tom Rini @ 2016-05-21  1:41 UTC (permalink / raw)
  To: Sebastian Frias; +Cc: u-boot, linux-arm-kernel, LKML, Mason

[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]

On Fri, May 20, 2016 at 04:28:23PM +0200, Sebastian Frias wrote:

> Hi,
> 
> Some bootloaders (like U-boot) support several HW devices: serial,
> network, NAND, USB, etc. most of which are also supported by Linux.
> 
> So the question is: is code shared? I mean, I understand that the
> drivers need to talk to the appropriate API, and such API could be
> different between Linux and U-boot.
> But putting that aside, would it be naive to imagine that some "core"
> functionality could be shared? Or would that part be so small it is
> not worth the effort?
> 
> Since many companies use both, U-boot and Linux, I would figure they
> try their best to optimize engineering resources and share code,
> right?
> In that case, I also wonder how do they share DT descriptions that
> right now are being stored in the Linux kernel tree.
> 
> We'd like to share code/DT for obvious reasons, what would you guys
> suggest?

So, in all cases, Linux is always the primary.  In some cases in U-Boot
we port drivers over (NAND is a good example here).  In other cases,
things are similar enough that it's having done it in one place it's
easy enough to do it again in the other.

-- 
Tom

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [U-Boot] Sharing code between Linux and bootloader (U-boot) ?
  2016-05-21  1:41 ` [U-Boot] " Tom Rini
@ 2016-05-23 13:22   ` Sebastian Frias
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Frias @ 2016-05-23 13:22 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, linux-arm-kernel, LKML, Mason

Hi Tom,

On 05/21/2016 03:41 AM, Tom Rini wrote:
> On Fri, May 20, 2016 at 04:28:23PM +0200, Sebastian Frias wrote:
> 
>> Hi,
>>
>> Some bootloaders (like U-boot) support several HW devices: serial,
>> network, NAND, USB, etc. most of which are also supported by Linux.
>>
>> So the question is: is code shared? I mean, I understand that the
>> drivers need to talk to the appropriate API, and such API could be
>> different between Linux and U-boot.
>> But putting that aside, would it be naive to imagine that some "core"
>> functionality could be shared? Or would that part be so small it is
>> not worth the effort?
>>
>> Since many companies use both, U-boot and Linux, I would figure they
>> try their best to optimize engineering resources and share code,
>> right?
>> In that case, I also wonder how do they share DT descriptions that
>> right now are being stored in the Linux kernel tree.
>>
>> We'd like to share code/DT for obvious reasons, what would you guys
>> suggest?
> 
> So, in all cases, Linux is always the primary.  

For drivers and DT?

>In some cases in U-Boot
> we port drivers over (NAND is a good example here). 

>From your message, I get that first you write the driver for Linux and then port to U-boot, is that right?
I would have thought that the opposite way could be easier, since the U-boot driver could be simpler (maybe no DMA) w.r.t the one in Linux.

> In other cases,
> things are similar enough that it's having done it in one place it's
> easy enough to do it again in the other.
> 

So, basically people just do it again, duplicating code?

Best regards,

Sebastian

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Sharing code between Linux and bootloader (U-boot) ?
  2016-05-20 14:28 Sharing code between Linux and bootloader (U-boot) ? Sebastian Frias
  2016-05-20 15:08 ` Grant Edwards
  2016-05-21  1:41 ` [U-Boot] " Tom Rini
@ 2016-05-30 11:35 ` Holger Schurig
  2 siblings, 0 replies; 5+ messages in thread
From: Holger Schurig @ 2016-05-30 11:35 UTC (permalink / raw)
  To: Sebastian Frias, u-boot, linux-arm-kernel, LKML; +Cc: Mason

Sebastian Frias <sf84@laposte.net> writes:

Barebox shares a good amount of code. For example, when you look at SPI
at AT24/AT25 you'll see that many things are almost identical.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-05-30 11:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-20 14:28 Sharing code between Linux and bootloader (U-boot) ? Sebastian Frias
2016-05-20 15:08 ` Grant Edwards
2016-05-21  1:41 ` [U-Boot] " Tom Rini
2016-05-23 13:22   ` Sebastian Frias
2016-05-30 11:35 ` Holger Schurig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).