Skip to contentSkip to conversation

Conditional patches on kernel depending on board, how to maintain?

DISCUSSION Daniel Hilst Selli 4 participants 5 messages Jun 12, 2014

lore
Share & tools
lore
#0 lore raw

I have a SoM which will be used on several boards, this SoM has a base kernel for it, with its board-*.c file. In each board I may have different peripherals, so I have to patch the same board-*.c file depending on my target board, and that patches may be conflicting one each other. For example, I could have a RF on first SPI bus on one board, and on another board a SD card on same first SPI bus.

So basically I will have a different kernel(uImage) and rootfs (with kernel modules) for each board.

I think to create a layer for each target board, with the linux-SoM.bbappend including the patches for that board..., so I enable the layer depending on target board I'm creating, but is too much file editions, or have a build directory for each target board, enabling the right layer on each local.conf, but this means mantaining build directories, or at last local.conf, which doesn't seem a good idea for me...

Would be possible to do this relying only new layers and its configurations?

Thanks in advance
Cheers!

#1 lore raw

Can you compile the different device drivers as modules and load them at runtime?
Can you compile the different device drivers statically and probe them based on a devicetree file?

--wpd

Quoted 26 lines · Daniel Hilst Selli

I have a SoM which will be used on several boards, this SoM has a base kernel for it, with its board-*.c file. In each board I may have different peripherals, so I have to patch the same board-*.c file depending on my target board, and that patches may be conflicting one each other. For example, I could have a RF on first SPI bus on one board, and on another board a SD card on same first SPI bus.

So basically I will have a different kernel(uImage) and rootfs (with kernel modules) for each board.

I think to create a layer for each target board, with the linux-SoM.bbappend including the patches for that board..., so I enable the layer depending on target board I'm creating, but is too much file editions, or have a build directory for each target board, enabling the right layer on each local.conf, but this means mantaining build directories, or at last local.conf, which doesn't seem a good idea for me...

Would be possible to do this relying only new layers and its configurations?

Thanks in advance
Cheers!
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#2 lore raw
Quoted 4 lines · Patrick Doyle

Can you compile the different device drivers as modules and load them at runtime?
Can you compile the different device drivers statically and probe them based on a devicetree file?

Yes I do compile the device drivers as modules, but yet I have to register the *_board_info structs on board-*.c file, here is an example:

http://pastebin.com/GMSDQERB

Thanks in advance,
Cheers!

Quoted 32 lines

--wpd

Quoted 26 lines · Daniel Hilst Selli

I have a SoM which will be used on several boards, this SoM has a base kernel for it, with its board-*.c file. In each board I may have different peripherals, so I have to patch the same board-*.c file depending on my target board, and that patches may be conflicting one each other. For example, I could have a RF on first SPI bus on one board, and on another board a SD card on same first SPI bus.

So basically I will have a different kernel(uImage) and rootfs (with kernel modules) for each board.

I think to create a layer for each target board, with the linux-SoM.bbappend including the patches for that board..., so I enable the layer depending on target board I'm creating, but is too much file editions, or have a build directory for each target board, enabling the right layer on each local.conf, but this means mantaining build directories, or at last local.conf, which doesn't seem a good idea for me...

Would be possible to do this relying only new layers and its configurations?

Thanks in advance
Cheers!
--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#3 lore raw
In reply to Daniel Hilst Selli
Quoted 10 lines · Daniel Hilst Selli

I have a SoM which will be used on several boards, this SoM has a base kernel for it, with its board-*.c file. In each board I may have different peripherals, so I have to patch the same board-*.c file depending on my target board, and that patches may be conflicting one each other. For example, I could have a RF on first SPI bus on one board, and on another board a SD card on same first SPI bus.

So basically I will have a different kernel(uImage) and rootfs (with kernel modules) for each board.

Quoted 9 lines

I think to create a layer for each target board, with the linux-SoM.bbappend including the patches for that board..., so I enable the layer depending on target board I'm creating, but is too much file editions, or have a build directory for each target board, enabling the right layer on each local.conf, but this means mantaining build directories, or at last local.conf, which doesn't seem a good idea for me...

Would be possible to do this relying only new layers and its configurations?

you can do:

SRC_URI_append_som1 = " file://som1.patch"

assuming som1 is a valid machine name (e.g. you have conf/machines/som1.conf)

you can do all builds with 1 layer, and 1 recipe for the kernel, with many such lines.

#4 lore raw
In reply to Daniel Hilst Selli
Quoted 18 lines · Daniel Hilst Selli

I have a SoM which will be used on several boards, this SoM has a base kernel for it, with its board-*.c file. In each board I may have different peripherals, so I have to patch the same board-*.c file depending on my target board, and that patches may be conflicting one each other. For example, I could have a RF on first SPI bus on one board, and on another board a SD card on same first SPI bus.

So basically I will have a different kernel(uImage) and rootfs (with kernel modules) for each board.

I think to create a layer for each target board, with the linux-SoM.bbappend including the patches for that board..., so I enable the layer depending on target board I'm creating, but is too much file editions, or have a build directory for each target board, enabling the right layer on each local.conf, but this means mantaining build directories, or at last local.conf, which doesn't seem a good idea for me...

Quoted 2 lines

Would be possible to do this relying only new layers and its configurations?

As was mentioned in the other replies, you can always have a single bbappend with board specific SRC_URI updates to add the patches you need onto the base board support.

It's unfortunate that the patches conflict, since stacking hem in board specific SRC_URIs can lead to patch failures in some configs and not others .. if you change the baseline.

Typically in this situation, I either #ifdef the patches and use a different configuration to conditionally build the consistent set of changes, or maintain the changes in a git repository with board specific patches on each branch. Again, that git approach avoids patch failures during build.

Cheers,

Bruce

Quoted 3 lines

Thanks in advance
Cheers!