Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add support for OpenWrt-Imagebuilder and non-gluon style firmware-images #1946

Closed

Conversation

SvenRoederer
Copy link
Contributor

@SvenRoederer SvenRoederer commented Mar 6, 2020

For Freifunk Berlin we are in need of a way to define some device-specific packages (freifunk-berlin/firmware#696). Instead of inventing a new way for such definition, a PR was made to reuse code of the gluon build-framework (freifunk-berlin/firmware#765). This PR is about upstreaming the changes.

The Freifunk Brerlin firmware differs in some points from Freifunk Gluon. The major points are:

  1. a completely different network-topology (OLSR-based meshing)
  2. LuCI based web-frontend
  3. Firmware-images are created with the OpenWrt Imagebuilder

Based on 1.) and 2.) there is (currently) no use of the gluon-packages, but some other external feeds. There are also some CONFIG-options of OpenWrt which are incompatible between both firmwares. For this reason the file targets/generic_gluon was split from targets/generic and an additional targets/generic_ffberlin was added. The generic-file contains just some very common settings and the generic_*-files provide the build-type specific settings. With the FOREIGN_BUILD-flag the Makefile can control which generic-*-file is included in addition to the generic-file.

Imagebuilder-support:

Freifunk Berlin is using a two-phases based process (compilation, image-assembly) of creating the firmware-images. In the 1st phase all relevant packages are build and an imagebuilder.tar.xz is created.

In the 2nd phase this OpenWrt-Imagebuilder is used to assemble the firmware-images by combining the previously built kernel and packages. As for Gluon the list of packages is generated from targets/generic*, targets/$GLUON_TARGET, the Makefile and the site-conf. In contrast to Gluon this list of packages is not fix stored in the OpenWrt-config on a per board-basis, as it needs to be provided to the imagebuilder later.

This is archived by the new scripts/target_config_profile.lua, which generates a per GLUON_TARGET file containing the packagelist per board. This script uses the new function 'target_config_lib.lua.get_pkglist()' which is reusing the existing code of building the packagelist.


The code of this PR is just cherry-picked from the above mentioned PR and currently a working prototype to be commented.It also still contains a lot of debug-output.

A welcome side-effect of the original PR is that it will be more easy to share code between both projects regarding the build-framework and device-support. As mentioned I only had to cherry-pick from the Freifunk-Berlin Repo without copy-paste of code.

…e for other types of firmwares

ignored changes in MAkefile

defining this FLAG (to "1") disables / skips some things

* including gluon-core packages
* strict inclusion of some packages
* per device sepecific kernel build
* a gluon specific target/generic_gluon will be considered
this module gets selected automatically; by its depenging modules
this option depends on kmod-ath, which is not avail on all targets.
So use try_config() to set this option, to prevent error on check_config.
This reverts commit 4219f0e9af9ee7fec74b31b48c7bd615eec6847f.
This will just build packages, without adding them into an image.
even the whole batman-adv package is build as module it still depends
on crc16. As batman-adv is only modulear the lib-crc16 is also modular,
bit this fails on build.
this moves the transformation of "dev.options.packages" and
"site_packages(dev.image)" to a string ps packages from the
main code.
As the main-code gets a single string with all packages, it
does not need to evaluate the pkg-sources again.
it returns a table with all boards of a target and a list of packages
for each board.
this script creates a file $GLUON_TMPDIR/§TARGET with following syntax:

> board1: "packages"
> board2: "packages"
> ...

this list can be used to build the final images with the imagebuilder
…efor other types of firmwares"

reenable setting of
* CONFIG_TARGET_DEVICE_%s_DEVICE_%s
* CONFIG_TARGET_DEVICE_PACKAGES_%s_DEVICE_%s
* CONFIG_TARGET_PER_DEVICE_ROOTFS=y

to fix building of initramfs. This way we also honor the devices-packages, and
e.g. remove the ath9k-ct drivers in favor of ath9k. Else it causes double
inclusion of drivers and results in file-conflicts.
@mweinelt mweinelt requested a review from neocturne March 7, 2020 00:48
@rotanid
Copy link
Member

rotanid commented Apr 19, 2020

@SvenRoederer because of #1950 you need to rebase this, please.
also please check first, if 1950 solves your request in #1933

@rotanid rotanid added 0. type: enhancement The changeset is an enhancement 2. status: merge conflict The merge has a conflict and needs rebasing labels Apr 19, 2020
@SvenRoederer
Copy link
Contributor Author

@rotanid Rebasing is on my ToDo since some times, after having seen PR1950 was merged. But It seems the idea of this PR will get no veto, so it's worth spending my time on it again.

@neocturne
Copy link
Member

I think this PR does far too many things at once - I'd like to see it as inspiration of things we should support eventually, not as a concrete proposal for an implementation. So IMO rebasing this is rather low-priority, if useful at all.

@rotanid rotanid added the 2. status: blocked Marked as blocked because it's waiting on something label Jun 21, 2020
@CodeFetch
Copy link
Contributor

I think this PR does far too many things at once - I'd like to see it as inspiration of things we should support eventually, not as a concrete proposal for an implementation. So IMO rebasing this is rather low-priority, if useful at all.

@NeoRaider From the comment it is a request for comments and I think it is really well-thought-through, but I admit it's a bit much to grasp. Unfortunately I don't know the Makefiles that well, because I'd love to see this. Please have a look at it.

@CodeFetch
Copy link
Contributor

@SvenRoederer Can you please have a look at PR #2172? I think it will be cleaner if you could somehow adapt the Freifunk Berlin image builder to this approach. What other conflicts in the generic config file do you see? Can you make them configurable like GLUON_SPEZIALIZE_KERNEL with your packages so that you don't need a custom file for Freifunk Berlin anymore?

@SvenRoederer
Copy link
Contributor Author

@CodeFetch @lemoer slowly keeping up with my time and happy to see PR #2172. Will have a close look at it, as it seem to provide half of the way this PR a going for.

@mweinelt mweinelt marked this pull request as draft April 27, 2021 22:40
@mweinelt
Copy link
Contributor

Marking as draft, given the fact that we can't, won't merge this as is.

@blocktrron
Copy link
Member

Closing as per successor #2172

@blocktrron blocktrron closed this Dec 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. type: enhancement The changeset is an enhancement 2. status: blocked Marked as blocked because it's waiting on something 2. status: merge conflict The merge has a conflict and needs rebasing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants