Flesh out the de-duplication logic in separate script. The copy-firmware.sh is
already complex enough and de-duplication doesn't really fit in there.
In the process we migrate away from the open-coded `ln --relative`. We also
avoid touching symlinks, which are not created by rdfind. Otherwise we end up
"fixing" the folder to folder symlinks (created earlier in the process) and
things explode.
As result we also get a few bonuses:
- the COPYOPTS shell injection is gone - the variable was never used
- people can dedup as separate step if/when they choose to do so
Aside: based on the noise in git log and around distros ... I'm wondering if
having the de-duplication as opt-in, would have been better. Is it too late to
change or the ship has sailed?
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
It's a simple format handled by practically every supported platform or program
out there.
Add an initial configuration file, so we reduce the style variation of the files
in-tree.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Using link-to-a-link reduces legibility and changes to the root link,
also changes the leafs. Where the latter may be undesired and in some
cases just wrong.
We have a couple of instances in-tree, so fix them up and ban the
combination.
One particularly good example, why we'd want this is:
https://gitlab.com/kernel-firmware/linux-firmware/-/merge_requests/272
In there we have the following:
File: ti/tas2781/TAS2XXX1EB30.bin
[snip]
Link: TAS2XXX1EB3.bin -> ti/tas2781/TAS2XXX1EB3.bin
Link: ti/tas2781/TAS2XXX1EB3.bin -> TAS2XXX1EB30.bin
Link: TAS2XXX1EB30.bin -> ti/tas2781/TAS2XXX1EB30.bin
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Namely: file(name) and sym(link) ... which were swapped in a few places.
One of which by yours truly 🤦
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
The package would put all files into /lib/firmware/updates to avoid
conflicting with distro packages.
The package is also intentionally named to avoid conflicts with
distro packages.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
WHENCE and copy_firmware.sh now support a new keyword RawFile to list
files that must not be compressed. Update check_whence.py to recognize
that.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
This will make it render more nicely if linux-firmware.git moves
to Gitlab or a fork of it is hosted in Gitlab.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
This should catch a couple of common errors: reversing the two arguments
to Link, and not making the second argument relative to the first.
Signed-off-by: Adam Sampson <ats@offog.org>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
Currently we have no symlinks in-tree. Add a simple check, ensuring they
don't get added in the future.
This allows us to remove the clunky symlink checking code in
copy-firmware.sh
v2:
- tweak helper to produce link and target (based off Adam's patch)
v3:
- honour quoted target/linkname
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
Commits from a few years ago added support for Link entries, over having
the symlinks in-tree.
At the same time, it didn't add a check whether one didn't add a File
entry that is actually a symlink. Do so now, to be on the safe side.
v2:
- drop copy-firmware.sh changes
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
Earlier commit added check for duplicate entries. Although the commit
was picked without one of its dependencies which removes the quotation
marks in the File entries.
Since the quotation marks are here to stay, escape them as needed in the
script.
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Fixes: 05183b7b ("check_whence: error on duplicate file entries")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
No occurrences in-tree, but it makes sense to sanity check that.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
There's little point in copying (or compressing with later patches) the
same files multiple times. So let's error out when duplicate entries are
present.
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
WHENCE contains non-ASCII characters, so we should specify an encoding.
To get the encoding= arg in python2, we pull open from 'io' directly.
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
Silence the make echo'ing, so the output is cleaner.
Add an exit code to check_whence.py, so we can get a real failure for
bad WHENCE files.
Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
Now that the copy-firmware.sh script can create symlinks from the Link:
entries in the WHENCE file on the fly, remove the duplicate symlinks
from the filesystem.
One odd entry was intel/dsp_fw_cnl.bin which was listed both as symlink
and as a regular file. Both entries can be removed since the it's really
a symlink, so it will be recreated at installation time.
While at it, update the check_whence.py script to not look for the
existence of symlinks in the filesystem because they are created on the
fly at installation time by the copy_firmware.sh script.
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
This was added recently as the script to install the firmware files.
Add it to the ignored list so check_whence doesn't complain about it.
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
Some vendors save a couple of cents by not including an eeprom for
wifi parameters on their boards. Instead the driver loads these board
specific parameters through the request_firmware mechanism.
Since these are board specific the filenames also must be board specific,
on x86 DMI strings are used for this and the wifi chipname is postfixed
with $sys_vendor-$product_name from the DMI tables. These DMi variables
may contain spaces.
This commit adds support to check_whence.py for filenames with spaces
in them, after this commit these can be specified by putting double-quotes
around them, e.g "name with spaces.bin".
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Josh Boyer <jwboyer@kernel.org>
The script compares the files listed in WHENCE (or otherwise expected)
and the files known to git, and reports all differences as errors.
Add a 'check' rule to the Makefile that runs this.
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>