aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
...
* scripts: fix checkpatch.pl for changed license dirPaul Spooren2021-02-141-1/+1
| | | | | | | As multiple LICENSES are shipped and no longer just LICENSE, modify the OpenWrt tree detection in checkpatch.pl. Signed-off-by: Paul Spooren <mail@aparcar.org>
* treewide: unify OpenWrt hosted source via @OPENWRTPaul Spooren2021-02-051-0/+2
| | | | | | | | | | | Multiple sources are hosted on OpenWrts source server only. The source URLs to point to the server vary based on different epochs in OpenWrts history. Replace all by @OPENWRT which is an "empty" mirror, therefore using the fallback servers sources.cdn.openwrt.org and sources.openwrt.org. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: sources CDN as fallback in download.plPaul Spooren2021-01-271-1/+1
| | | | | | | | | In case the default sources for a package fail use the CDN rather than our own mirror. In case the CDN fails, fallback to our mirror. Also remove mirror1 which isn't available anymore. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: target-metadata don't add PROFILES twicePaul Spooren2021-01-141-1/+2
| | | | | | | | | | | | | | | Since 4ee3cf2b5a profiles with alternative vendor names may appear multiple times in `tmp/.targetinfo` or `.targetinfo` (for ImageBuilders). The `target-metadata.pl` script adds these profiles then twice to `PROFILE_NAMES` and the ImageBuilder show the profile twice when running `make info`. This patch removes duplicate profile IDs and only adds them once to `.profiles.mk`. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts/feed: no warn on toolchain/linux overwritePaul Spooren2021-01-061-1/+3
| | | | | | | | | | | The recent 7f285d "scripts/feeds: warn when skipping core package override" floods SDK output with warning of overwriting "linux" and "toolchain" core packages. This should be ignored as these are not regular packages added via feeds. While at it slightly improve the warning string. Signed-off-by: Paul Spooren <mail@aparcar.org>
* build: drop clang wrapperKevin Darbyshire-Bryant2021-01-051-12/+0
| | | | | | | clang's gcc emulation does the right thing with -print-file-name now, drop the wrapper Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* scripts/qemustart: use squashfs instead of ext4Paul Spooren2021-01-011-1/+1
| | | | | | | | | The qemustart script currently picks the ext4 filesystem rather than squashfs, while the latter is default for nearly all OpenWrt targets. Change the default behaviour of qemustart to be in line with the rest. Signed-off-by: Paul Spooren <mail@aparcar.org>
* ipq40xx: add support for Plasma Cloud PA2200Marek Lindner2020-12-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Device specifications: * QCA IPQ4019 * 256 MB of RAM * 32 MB of SPI NOR flash (w25q256) - 2x 15 MB available; but one of the 15 MB regions is the recovery image * 2T2R 2.4 GHz - QCA4019 hw1.0 (SoC) - requires special BDF in QCA4019/hw1.0/board-2.bin with bus=ahb,bmi-chip-id=0,bmi-board-id=20,variant=PlasmaCloud-PA2200 * 2T2R 5 GHz (channel 36-64) - QCA9888 hw2.0 (PCI) - requires special BDF in QCA9888/hw2.0/board-2.bin bus=pci,bmi-chip-id=0,bmi-board-id=16,variant=PlasmaCloud-PA2200 * 2T2R 5 GHz (channel 100-165) - QCA4019 hw1.0 (SoC) - requires special BDF in QCA4019/hw1.0/board-2.bin with bus=ahb,bmi-chip-id=0,bmi-board-id=21,variant=PlasmaCloud-PA2200 * GPIO-LEDs for 2.4GHz, 5GHz-SoC and 5GHz-PCIE * GPIO-LEDs for power (orange) and status (blue) * 1x GPIO-button (reset) * TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX) * 2x gigabit ethernet - phy@mdio3: + Label: Ethernet 1 + gmac0 (ethaddr) in original firmware + used as LAN interface - phy@mdio4: + Label: Ethernet 2 + gmac1 (eth1addr) in original firmware + 802.3at POE+ + used as WAN interface * 12V 2A DC Flashing instructions: The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be used to transfer the factory image to the u-boot when the device boots up. Signed-off-by: Marek Lindner <marek.lindner@kaiwoo.ai> [sven@narfation.org: prepare commit message, rebase, use all LEDs, switch to dualboot_datachk upgrade script, use eth1 as designated WAN interface] Signed-off-by: Sven Eckelmann <sven@narfation.org>
* ipq40xx: add support for Plasma Cloud PA1200Marek Lindner2020-12-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Device specifications: * QCA IPQ4018 * 256 MB of RAM * 32 MB of SPI NOR flash (w25q256) - 2x 15 MB available; but one of the 15 MB regions is the recovery image * 2T2R 2.4 GHz - QCA4019 hw1.0 (SoC) - requires special BDF in QCA4019/hw1.0/board-2.bin with bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=PlasmaCloud-PA1200 * 2T2R 5 GHz - QCA4019 hw1.0 (SoC) - requires special BDF in QCA4019/hw1.0/board-2.bin with bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=PlasmaCloud-PA1200 * 3x GPIO-LEDs for status (cyan, purple, yellow) * 1x GPIO-button (reset) * 1x USB (xHCI) * TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX) * 2x gigabit ethernet - phy@mdio4: + Label: Ethernet 1 + gmac0 (ethaddr) in original firmware + used as LAN interface - phy@mdio3: + Label: Ethernet 2 + gmac1 (eth1addr) in original firmware + 802.3af/at POE(+) + used as WAN interface * 12V/24V 1A DC Flashing instructions: The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be used to transfer the factory image to the u-boot when the device boots up. Signed-off-by: Marek Lindner <marek.lindner@kaiwoo.ai> [sven@narfation.org: prepare commit message, rebase, use all LEDs, switch to dualboot_datachk upgrade script, use eth1 as designated WAN interface] Signed-off-by: Sven Eckelmann <sven@narfation.org>
* ath79: Add support for Plasma Cloud PA300Sven Eckelmann2020-12-221-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Device specifications: * Qualcomm/Atheros QCA9533 v2 * 650/600/217 MHz (CPU/DDR/AHB) * 64 MB of RAM * 16 MB of SPI NOR flash (mx25l12805d) - 2x 7 MB available; but one of the 7 MB regions is the recovery image * 2x 10/100 Mbps Ethernet * 2T2R 2.4 GHz Wi-Fi * multi-color LED (controlled via red/green/blue GPIOs) * 1x GPIO-button (reset) * external h/w watchdog (enabled by default) * TTL pins are on board (arrow points to VCC, then follows: GND, TX, RX) * 2x fast ethernet - eth0 + Label: Ethernet 1 + 24V passive POE (mode B) + used as WAN interface - eth1 + Label: Ethernet 2 + 802.3af POE + builtin switch port 2 + used as LAN interface * 12-24V 1A DC * internal antennas Flashing instructions: The tool ap51-flash (https://github.com/ap51-flash/ap51-flash) should be used to transfer the factory image to the u-boot when the device boots up. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* images: Fix sysupgrade.tar for devices with NOR flashSven Eckelmann2020-12-221-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The NOR flash rootfs images stored in a sysupgrade.tar must end with the JFFS2 marker. Otherwise, devices like OpenMesh A42/A62 are not able to calculate the md5sum of the fixed squashfs part and store it inside the u-boot-env. But the commit ee76bd11bbe7 ("images: fix boot failures on NAND with small sub pages") adds up to 1020 0x00 bytes after the 0xdead0de EOF marker. The calculated md5sum will be wrong due do this change and u-boot will fail to boot the newly flashed device with a message like: Validating MD5Sum of 'vmlinux'... Passed! Validating MD5Sum of 'rootfs'... Failed! 583a1b7b54b8601efa64ade42742459b != 8850ee812dfd7638e94083329d5d2781 Data validation failed! and boot the old image again. Since the original change should not change the behavior of NOR images, just check for the deadc0de marker at the end of the squashfs-jffs2 image do avoid the problematic behavior for these images. Fixes: ee76bd11bbe7 ("images: fix boot failures on NAND with small sub pages") Signed-off-by: Sven Eckelmann <sven@narfation.org>
* scripts/om-fwupgradecfg-gen.sh: Generate checksum over whole squashfsSven Eckelmann2020-12-221-6/+3
| | | | | | | | | | | The rootfs is padded to the full block size by padjffs2 and a 4 byte magic value ("deadc0de") is added to the end. On first boot, the JFFS2 is replacing the "deadc0de" marker when the rootfs_data is initialized. The static part of the rootfs is therefore $rootfs_size - 4 and not $rootfs_size - 262144 - 4. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* scripts/om-fwupgradecfg-gen.sh: Drop block alignment codeSven Eckelmann2020-12-221-5/+1
| | | | | | | The padding and block alignment is handled by the image build script and doesn't need to be duplicated in the fwupgrade.cfg build script. Signed-off-by: Sven Eckelmann <sven@narfation.org>
* scripts: add -N option to mkhash for printing without newlineINAGAKI Hiroshi2020-12-221-7/+13
| | | | | | Added "-N" option, it allow printing hash(es) without newline. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
* build/json: add filesystem informationPaul Spooren2020-12-131-0/+1
| | | | | | | | Some images are created using different filesystems, most popular squashfs and ext4. To allow downstream projects to distinguesh between those, add the `filesystem` information to created json files. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts/feeds: fix preference of package installKarel Kočí2020-12-091-16/+14
| | | | | | | | | | | | | | The previous behavior prefered same feed for dependent packages as initial package. This caused inconsitency in installation of packages. The difference was if two feeds provide same package (different version) there was different result if you executed install for that specific version compared to install for package depending on it from different feed. This ensures that preferred feed is propagated without change and selected feed is used only really for package it was selected for. Signed-off-by: Karel Kočí <karel.koci@nic.cz>
* scripts/feeds: warn when skipping core package overrideBrian Norris2020-12-091-1/+4
| | | | | | | | | | Otherwise, a n00b like myself can get quite confused when moving a package from core to feeds, for example. (Hint: one *really* needs to clear out the tmp/info/.packageinfo... entries for the stale package, but '-f' works as well.) Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* build: mkhash on FreeBSDPiotr Stefaniak2020-11-271-0/+7
| | | | | | | | Apply patch from https://bugs.openwrt.org/index.php?do=details&task_id=971 in order to make it easier to build OpenWRT on FreeBSD. Signed-off-by: Piotr Stefaniak <pstef@freebsd.org>
* download.pl: properly cleanup intermediate .hash filePetr Štetiar2020-11-271-1/+1
| | | | | | | | | | It seems like after a build the /dl dir seems to now contain a .hash file for each source file due to inproper cleanup so fix it by removing those intermediate files before leaving the download action. Fixes: 4e19cbc55335 ("download: handle possibly invalid local tarballs") Reported-by: Hannu Nyman <hannu.nyman@iki.fi> Signed-off-by: Petr Štetiar <ynezz@true.cz>
* download: handle possibly invalid local tarballsPetr Štetiar2020-11-271-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently it's assumed, that already downloaded tarballs are always fine, so no checksum checking is performed and the tarball is used even if it might be corrupted. From now on, we're going to always check the downloaded tarballs before considering them valid. Steps to reproduce: 1. Remove cached tarball rm dl/libubox-2020-08-06-9e52171d.tar.xz 2. Download valid tarball again make package/libubox/download 3. Invalidate the tarball sed -i 's/PKG_MIRROR_HASH:=../PKG_MIRROR_HASH:=ff/' package/libs/libubox/Makefile 4. Now compile with corrupt tarball source make package/libubox/{clean,compile} Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts/feeds: silence git warning by selecting pull styleHannu Nyman2020-11-261-2/+2
| | | | | | | Silence the warning in git 2.27 about undefined fast-forward style in git pull. Define "ff-only" as the style. Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
* scripts: add size_compare.shPaul Spooren2020-11-241-0/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As package size changes are a continuous topic on the mailing list this scripts helps developers to compare their local package modifications against latest upstream. The script downloads the latest package indexes based on env variables or the `.config` file. The script compares the actual installed size (data.tar.gz) or the IPK package size. An example output is found below: ``` user@dawn:~/src/openwrt/openwrt$ ./scripts/size_compare.sh Compare packages of ath79/tiny/mips_24kc: dropbear busybox iw ubus Checking configuration difference % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 554 100 554 0 0 336 0 0:00:01 0:00:01 --:--:-- 336 --- start config diff --- --- /tmp/config.DDjwVh-LOCAL 2020-11-23 09:08:28.913203068 -1000 +++ /tmp/config.DDjwVh-UPSTREAM 2020-11-23 09:08:36.369240887 -1000 @@ -1,5 +1,9 @@ +CONFIG_ALL_KMODS=y +CONFIG_ALL_NONSHARED=y CONFIG_AUTOREBUILD=y +CONFIG_AUTOREMOVE=y --- 8< --- CONFIG_BINARY_FOLDER="" +CONFIG_BUILDBOT=y +CONFIG_TARGET_ALL_PROFILES=y CONFIG_TARGET_ROOTFS_DIR="" CONFIG_USE_SSTRIP=y CONFIG_USE_UCLIBCXX=y --- end config diff --- Checking installed size Fetching latest package indexes... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 80634 100 80634 0 0 33499 0 0:00:02 0:00:02 --:--:-- 33485 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 54082 100 54082 0 0 24252 0 0:00:02 0:00:02 --:--:-- 24252 Comparing package sizes... Change Local Remote Package +271 51386 51115 base-files +123 705241 705118 bnx2-firmware +86 17209 17123 fstools +22 47989 47967 procd +21 208311 208290 busybox +19 67181 67162 netifd ``` I plan to integrate this script into the CI so we have a summary how sizes change over different architectures. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: download.pl: retry download using filenameDavid Bauer2020-11-201-2/+6
| | | | | | | | | | | | | | | | With this commit, the download script will try downloading source files using the filename instead of the url-filename in case the previous download attempt using the url-filename failed. This is required, as the OpenWrt sources mirrors serve files using the filename files might be renamed to after downloading. If the original mirror for a file where url-filename and filename do not match goes down, the download failed prior to this patch. Further improvement can be done by performing this only for the OpenWrt sources mirrors. Signed-off-by: David Bauer <mail@david-bauer.net>
* scripts: add const_structs.checkpatch for checkpatch.plAdrian Schmutzler2020-11-181-0/+68
| | | | | | | | | | | | | | | | | | Kernel has separated the structs that are reported to be const in checkpatch.pl into a file of its own, const_structs.checkpatch. This file has been missing after the recent update of checkpatch.pl, leading to the following message: No structs that should be const will be found - file '/data/openwrt/scripts/const_structs.checkpatch': No such file or directory This commit adds the relevant file from v5.10-rc4. Fixes: 086ee09bbcac ("scripts: Update checkpatch.pl to 2020-06-11") Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* scripts: checkpatch.pl: suppress warnings about MAINTAINERSAdrian Schmutzler2020-11-181-1/+1
| | | | | | | | | | | | | | | | | | | The kernel expects changes to MAINTAINERS for all removed or added files, printing warnings like: WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #828: deleted file mode 100644 Since this does not apply to "our" files in OpenWrt repo, this warning should be disabled. This can be achieved easiest by setting $reported_maintainer_file to 1. While this is a hack that tricks the script into believing the proper MAINTAINERS changes have been made, it's the easiest solution as it does not require to touch any other code. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* scripts/kconfig.pl: allow regex syntax in filtering out config entriesFelix Fietkau2020-11-131-2/+9
| | | | | | | This will be used to filter out some autogenerated config values from the kernel config files Signed-off-by: Felix Fietkau <nbd@nbd.name>
* scripts: add spelling.txt for checkpatch.plPaul Spooren2020-11-121-0/+1517
| | | | | | | | | | | | | | | | | | | | | | Running the updated checkpatch version with spelling.txt show that spelling mistakes happen to everyone. > /target/linux$ fd .*.patch | xargs ../../scripts/checkpatch.pl | rg spell WARNING: 'usefull' may be misspelled - perhaps 'useful'? WARNING: 'afecting' may be misspelled - perhaps 'affecting'? WARNING: 'usefull' may be misspelled - perhaps 'useful'? WARNING: 'afecting' may be misspelled - perhaps 'affecting'? WARNING: 'begining' may be misspelled - perhaps 'beginning'? WARNING: 'superflous' may be misspelled - perhaps 'superfluous'? WARNING: 'multipe' may be misspelled - perhaps 'multiple'? WARNING: 'recieves' may be misspelled - perhaps 'receives'? WARNING: 'retreive' may be misspelled - perhaps 'retrieve'? WARNING: 'tranfer' may be misspelled - perhaps 'transfer'? WARNING: 'additonal' may be misspelled - perhaps 'additional'? WARNING: 'accomodate' may be misspelled - perhaps 'accommodate'? [...] Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: checkpatch remove device-tree doc checkPaul Spooren2020-11-121-47/+0
| | | | | | | Remove checks for device tree documentation as the OpenWrt tree comes withouth the ./Documentation folder. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: Update checkpatch.pl to 2020-06-11Paul Spooren2020-11-121-567/+3995
| | | | | | | | Checkpatch grown in functionallity and we should make use of that. If OpenWrt patches should be upstream material they should also be checked based on upstream checkpatch.pl instead of 2013. Signed-off-by: Paul Spooren <mail@aparcar.org>
* build: store SOURCE_DATE_EPOCH in JSON info filesPaul Spooren2020-11-121-0/+1
| | | | | | | | The source date epoch is the only reproducible date close to the actual build date. It can be used for tooling like the firmware wizard to show the image age. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: mkhash fail on hashing a folderPaul Spooren2020-11-091-0/+8
| | | | | | | | | | | | | | | | | | mkhash currently returns the hash of an empty input when trying to hash a folder. This can be missleading in caseswhere e.g. an env variable is undefined which should contain a filename. `mkhash ./path/to/$FILE` would exit with code 0 and return a legit looking checksum. A better behaviour would be to fail with exit code 1, which imitates the behaviour of `md5sum` and `sha256sum`. To avoid hashing of folders the `stat()` is checked. Hashing empty inputs result in the following checksums: md5: d41d8cd98f00b204e9800998ecf8427e sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: mkhash fix return code handlingPaul Spooren2020-11-091-2/+5
| | | | | | | | | If hashing a file fails mkhash shouldn't just silently fail. Now check after each call of `hash_file()` the return and exit early in case of errors. The return value which was previously ignored and would always return 0. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: mkhash show -n option in usagePaul Spooren2020-11-091-1/+4
| | | | | | | | | | The -n option prints the filename of hashed files next to the calculated checksum. Reflect that in the usage message. user@dawn:~/src/openwrt/openwrt$ ./a.out md5 -n .config eb06db36e7b6751cb18801945e46bf5d .config Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: bundle-libraries.sh: fix broken SDK compilerPetr Štetiar2020-11-021-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | Recent versions (> 5.33) of `file` report liblto_plugin.so as executable: $ file liblto_plugin.so liblto_plugin.so.0.0.0: ELF 64-bit LSB pie executable ... Which then leads to improper packaging of the plugin, resulting in the broken compiler: configure: checking whether the C compiler works mips-openwrt-linux-musl/bin/ld: liblto_plugin.so: error loading plugin: liblto_plugin.so: invalid ELF header As the LTO compiler plugin library is incorrectly packaged as SDK executable: $ head -1 ~/staging_dir/toolchain...libexec/gcc/.../liblto_plugin.so #!/usr/bin/env bash Fix this by filtering out shared libraries from the patching. Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1296868 Acked-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts/getver.sh: silence rev-list errorsPetr Štetiar2020-11-021-3/+3
| | | | | | | | | | | Shallow copies are quite common on CI platforms nowadays, making REBOOT tag unavailable, thus producing following confusing errors in the build logs: fatal: Invalid revision range ee53a240ac902dc83209008a2671e7fdcf55957a..HEAD fatal: Invalid revision range ee53a240ac902dc83209008a2671e7fdcf55957a..0493d57e04774d47921a7d2014b567455d5dc16b Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts/qemustart: update malta to use MIPS64 R2 cpuTony Ambardar2020-10-111-1/+3
| | | | | | | | | | | Explicitly set the QEMU cpu type and support the MIPS R2 ISA, for both 64-bit and 32-bit targets. The later previously supported MIPS R2 by implicit default. This is needed after commit 93608697f3 ("malta: update MIPS64 ISA to R2"), otherwise booting malta images with scripts/qemustart will hang. Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
* build: define PWM_SUPPORT arch feature flagChristian Lamparter2020-09-251-0/+1
| | | | | | | | | | As the PWM has its own sub-system in the Linux kernel, I think it should be handled in the same way as GPIO, RTC, PCI... This patch introduces a specific feature flag "pwm" and the "leds-pwm" kernel module as the first customer. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* scripts: mkits.sh make it possible to specify fdt@#Christian Lamparter2020-09-251-4/+8
| | | | | | | | | | | | | | Some bootloaders are really keen on just one special fdt in a multi-image fit image. This is a problem, because currently this is fixed to "fdt@1". This patch introduces a new device variable: DEVICE_FDT_NUM that allows to specify the right fdt number. If the value is absent "1" will be chosen. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* scripts: update SPDX license namesPaul Spooren2020-09-2233-33/+33
| | | | | | | | | SPDX moved from GPL-2.0 to GPL-2.0-only and from GPL-2.0+ to GPL-2.0-or-later. Reflect that in the SPDX license headers. Signed-off-by: Paul Spooren <mail@aparcar.org> [adjust commit title, update remaining files] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* scripts: ipkg-build: simplify uid/gid resolvingJo-Philipp Wich2020-09-141-36/+29
| | | | | | | | | | | Use the prepared .packageusergroup file to lookup user and group names when processing the passed file mode. Also replace the various subshell/cut invocations with a sequence of standard variable interpolations which fixes paths with embedded colons as a side-effect. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* build: add user/group ID resolve functionPaul Spooren2020-09-141-2/+40
| | | | | | | | With the introduction of `./tmp/userids` the `ipkg-build` script can now resolve values of "PKG_FILE_MODES", allowing users to set names rather than numeric values. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: download.pl: fix indentationDavid Bauer2020-09-111-3/+2
| | | | Signed-off-by: David Bauer <mail@david-bauer.net>
* scripts: bundle-libraries.sh: retain preloaded librariesJo-Philipp Wich2020-09-101-1/+1
| | | | | | | | | | | | | | | | Since the introduction of fakeroot support, wrapped SDK executables might be invoked from a shell that has libfakeroot.so preloaded. Since we're using preloading as well in order to mangle argv[0] when invoking the shipped ELF interpreter directly, we must take care of preloading the already preloaded libraries as well, to avoid invoked programs losing their fakeroot capabilities. Extend the bundle-libraries.sh script to take any existing $LD_PRELOAD into account when invoking the target ELF executable with a preloaded runas.so library. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* build: store granular timestamps in packagesPaul Spooren2020-08-311-9/+3
| | | | | | | | | | | | | | With the new `SOURCE` argument of `get_source_date_epoch` it is possible to set package timestamps based on actual package changes rather thane $TOPDIR changes. This commit adds a new variable PKG_SOURCE_DATE_EPOCH which is used by the `ipkg` build script. As a fallback the existing SOURCE_DATE_EPOCH is used or as last resort the current time. The redundant checks for `.git/` and `.svn/` are removed. Signed-off-by: Paul Spooren <mail@aparcar.org>
* build: get_source_date_epoch allow external reposPaul Spooren2020-08-311-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The SOURCE_DATE_EPOCH variable is used to make builds reproducible even if rebuild at different times. Instead of using the current timestamp, the time of the last source change is used. Created packages are `touch`ed with a specific timestamp so resulting packages have the same checksums. The `get_source_date_epoch.sh` script tries multiple ways (file, git, hg) to determine the correct timestamp. Until now the script would only consider the $TOPDIR instead of package specific changes. Resulting in packages with same versions but different timestamps, as $TOPDIR (openwrt.git) received changes not affecting package versions. This results in warning/erros in `opkg` as the package versions stay the same but checksums changed. This commit adds an optional argument to get the `SOURCE_DATE_EPOCH` of a specific path (e.g. package SOURCE) rather than the $TOPDIR. As a consequence this allows granular but still reproducible timestamps. As packages might be distributed over multiple repositories the check for `.git/` becomes unfeasible. Instead tell `git` and `hg` to change their working directories and automatically traverse the repo folder. Signed-off-by: Paul Spooren <mail@aparcar.org>
* build: Fix Shellcheck for get_source_date_epoch.shPaul Spooren2020-08-311-2/+5
| | | | | | | | If a `cd` to `TOPDIR` fails the script should quit. Also unify `try_mtime` function by storing it in a variable. Signed-off-by: Paul Spooren <mail@aparcar.org>
* build: ipkg-build use fakeroot with PKG_FILE_MODESPaul Spooren2020-08-311-16/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `ipkg-build` script converts a folder into a `opkg` installable package. Until now it would use root:root for all packages and try to preserve file modes. This has the two drawbacks of packages want to add non-root files or add SUID files, like the `sudo` package does. To give more flexibility regarding file modes and avoid init script hacks, a new variable called `PKG_FILE_MODES`. The variable contains a list of files modes in the format `path:owner:group:mode`. An example for the `sudo` package below: ``` PKG_FILE_MODES:=\ /usr/bin/sudo:root:root:4755 \ /etc/sudoers:root:root:0440 ``` The `ipkg-build` now runs within a fakeroot environment to set any mode and directly store it in the resulting `ipk` package archive. Both options `-o` and `-g` are no longer required due to the introduction of the more flexible `-m` options, which takes the `PKG_FILE_MODES` as input. Lastly the option `-c` is removed as it's unused within the script. Signed-off-by: Paul Spooren <mail@aparcar.org>
* Revert "scripts/download: add sources CDN as first mirror"Jo-Philipp Wich2020-08-241-1/+0
| | | | | | | | | | This reverts commit c737a9ee6a9c47b6e553ac81bf293b1161e59799. The source CDN has been discontinued in its current form and will take a while to be reestablished. Even then it makes little sense to put a CDN before other CDNs such as kernel.org, apache.org, sourceforge etc. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* treewide: replace `which` with `command -v`Paul Spooren2020-08-121-6/+6
| | | | | | | | | | | | | | | | | Fix shellcheck SC2230 > which is non-standard. Use builtin 'command -v' instead. Using `command -v` is POSIX compliant while `which` is not. Also to mention, `command -v` is a shell builtin whereas `which` is a separate busybox applet. Once applied to everything concerning OpenWrt we can disable the busybox feature `which` and save 3.8kB. Acked-by: Stijn Tintel <stijn@linux-ipv6.be> Signed-off-by: Paul Spooren <mail@aparcar.org> [also replace cases in zram-swap] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* scripts: remove checkpatch.shPetr Štetiar2020-08-041-3/+0
| | | | | | | | That file was added accidentally in v3 of the patch and I haven't properly reviewed that patch before pushing it. Fixes: 656b562aff36 ("scripts: Add Buildbot dump-target-info.pl script") Signed-off-by: Petr Štetiar <ynezz@true.cz>