Skip to content
systemcoding.dev
Embedded Linux

Checksum part of a licence file with beginline and endline

beginline and endline in LIC_FILES_CHKSUM checksum only part of a file, so a licence header in source code can be tracked, on Scarthgap 5.0.

1 min read
Summarize in AI

Some projects carry the licence only as a comment at the top of a source file, and checksumming the whole file would break the recipe on every code change. LIC_FILES_CHKSUM accepts beginline and endline parameters, so BitBake hashes just those lines. This was written for Scarthgap 5.0 with BitBake 2.8.

Shell
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://src/main.c;beginline=1;endline=21;md5=0a1b2c3d4e5f60718293a4b5c6d7e8f9"
Text
ERROR: libfoo-1.0-r0 do_populate_lic: QA Issue: libfoo: The LIC_FILES_CHKSUM does not match for file://src/main.c;beginline=1;endline=21;md5=0a1b2c3d4e5f60718293a4b5c6d7e8f9
libfoo: The new md5 checksum is 9f8e7d6c5b4a39281706f5e4d3c2b1a0

That error is what you see with a wrong or placeholder checksum, and it is also how you get the real value: copy the "new md5 checksum" into the recipe. Line numbers are one-based and inclusive. The check exists to catch a licence change on upgrade, so a header moved down by an added line will fail it, which is the point. The hash in the example is made up.

Also inToolchains
Taggedyocto
Share

More snippets

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.