aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* scripts: Add Buildbot dump-target-info.pl scriptPaul Spooren2020-08-042-0/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The script comes from buildbot.git[0] and is used to print available targets and architectures, which are then build. As the buildbot clones openwrt.git anyway, the script might as well live here to be used for other cases as well, e.g. determining what architectures are available when building Docker containers or show developers an overview which architectures are used by which target. It's called with either the parameter `architectures` or `targets`, showing architectures followed by supported targets or targets, followed by the supported architectures: $ ./scripts/dump-target-info.pl architectures aarch64_cortex-a53 bcm27xx/bcm2710 mediatek/mt7622 mvebu/cortexa53 sunxi/cortexa53 aarch64_cortex-a72 bcm27xx/bcm2711 mvebu/cortexa72 ... $ ./scripts/dump-target-info.pl targets apm821xx/nand powerpc_464fp apm821xx/sata powerpc_464fp ... In the future the the script could be removed from the buildbot repository and maintained only here. Rename `dumpinfo.pl` to `dump-target-info.pl` to improve verbosity of filename. [0]: https://git.openwrt.org/?p=buildbot.git;a=blob;f=scripts/dumpinfo.pl;h=aa97f8d60379076a41b968402e9337cea824ece5;hb=HEAD Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts/checkpatch.pl: fix README.md file name after renameAdrian Schmutzler2020-08-021-1/+1
| | | | | | | | | | | | | checkpatch.pl uses a list of files to detect the root OpenWrt directory. This includes README, which has been renamed to README.md in the previous commit. Update the file name in checkpatch.pl to prevent errors like the following when running the script: Must be run from the top-level dir. of a OpenWrt tree Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* build: add option to mark devices as BROKENAdrian Schmutzler2020-07-302-0/+6
| | | | | | | | | | | By specifying "BROKEN := 1" or "BROKEN := y" for a device, it will be hidden (and deselected) by default. By that, it provides a stronger option to "disable" a device beyond just using DEFAULT := n. To make these devices visible, just enable the BROKEN option in developer settings as already implemented for targets and packages. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* build,json: fix compatibility with Python 3.5Paul Spooren2020-07-131-1/+1
| | | | | | | | The f-string feature was introduced in Python 3.6. As Buildbots may run on Debian 9, which comes per default with Python 3.5, this would cause an issue. Instead of f-strings use the *legacy* `.format()` function. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts/env: Fix 56f813674a scripts/env: use command -v instead of whichKevin Darbyshire-Bryant2020-07-121-1/+1
| | | | | | | | | | We don't need to see how git will be executed and it produces non silent output on 'scripts/env diff' commands when there are no differences unlike before. Re-introduce original silent behaviour. Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
* scripts/mkits.sh: fix use of printfAdrian Schmutzler2020-07-111-2/+3
| | | | | | | | | | | Due to a line break, printf was accidentally called with three arguments instead of two, causing a different output than before. Fix it by splitting the printf command into two lines. Fixes: 907053193a1c ("scripts/mkits.sh: replace echo -e with printf") Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* scripts/mkits.sh: fix remaining shellcheck warningPetr Štetiar2020-07-111-1/+1
| | | | | | | | | | Fixes following shellcheck warning: In scripts/mkits.sh line 19: "-k kernel [-D name -d dtb] -o its_file" "$(basename $0)" ^-- SC2086: Double quote to prevent globbing and word splitting. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts/mkits.sh: switch from bash to shRosen Penev2020-07-111-1/+1
| | | | | | This no longer needs bash. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts/mkits.sh: fix improper string and array concatenationRosen Penev2020-07-111-1/+1
| | | | | | Found with shellcheck. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts/mkits.sh: add missing quotesRosen Penev2020-07-111-2/+2
| | | | | | Found with shellcheck. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts/mkits.sh: replace echo -e with printfRosen Penev2020-07-111-12/+12
| | | | | | echo flags are not POSIX. printf does the same with added \n. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts/gen_image_generic.sh: fix more shellcheck warningsPetr Štetiar2020-07-111-4/+3
| | | | | | | | | | | | | | | | | | Fixes following shellcheck warnings: In scripts/gen_image_generic.sh line 20: cyl=$(( (KERNELSIZE + ROOTFSSIZE) * 1024 * 1024 / (head * sect * 512))) ^-^ SC2034: cyl appears unused. Verify use (or export if used externally). -- In scripts/gen_image_generic.sh line 34: [ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$(($ROOTFSOFFSET + $ROOTFSSIZE))" conv=notrunc count="$sect" ^-----------^ SC2004: $/${} is unnecessary on arithmetic variables. -- In scripts/gen_image_generic.sh line 35: mkfs.fat -n kernel -C "$OUTPUT.kernel" -S 512 "$(($KERNELSIZE / 1024))" ^---------^ SC2004: $/${} is unnecessary on arithmetic variables. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts/gen_image_generic.sh: use /bin/shRosen Penev2020-07-111-1/+1
| | | | | | This has nothing bash specific. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts/gen_image_generic.sh: replace -o with if/&&Rosen Penev2020-07-111-2/+2
| | | | | | | | -o is not well defined. Found with shellcheck. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts/env: fix remaining shellcheck warningPetr Štetiar2020-07-111-1/+1
| | | | | | | | | | Fixes following shellcheck warning: In scripts/env line 25: exit ${1:-1} ^-----^ SC2086: Double quote to prevent globbing and word splitting. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts/env: use read -r instead of readRosen Penev2020-07-111-1/+1
| | | | | | | | read mangles backslashes. Found with shellcheck. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts/env: exit in case of failure to cdRosen Penev2020-07-111-1/+1
| | | | | | Found with shellcheck. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts/env: replace \! with !Rosen Penev2020-07-111-2/+2
| | | | | | | The latter is more standard. The former throws an error under shellcheck. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts/env: use command -v instead of whichRosen Penev2020-07-111-1/+1
| | | | | | | | Simpler and built in to the shell. Found with shellcheck. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* build: fix compatibility with python 3.6Huangbin Zhan2020-07-071-3/+4
| | | | | | | | On a system python3 is linked to python3.6, fail to perform json_overview_image_info and got `TypeError: __init__() got an unexpected keyword argument 'capture_output'`. This patch emulate the behaviour on python 3.7+. Signed-off-by: Huangbin Zhan <zhanhb88@gmail.com>
* build: mconf readme updateSergio E. Nemirowski2020-07-071-3/+6
| | | | | | | This updates mconf.c readme message to maintain less changes with upstream and consistency with nconf.c Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net>
* build: add nconfigSergio E. Nemirowski2020-07-076-2/+2390
| | | | | | | | Add support for make target nconfig (ncurses) Reviewed-by: Eneas U de Queiroz <cotequeiroz@gmail.com> Signed-off-by: Sergio E. Nemirowski <sergio@outerface.net> Signed-off-by: Petr Štetiar <ynezz@true.cz>
* build,json: fix build failure in case no data is foundDaniel Golle2020-07-031-18/+16
| | | | | | | | Only collect arch_packages if actually generating any output. Fixes: commit f09b9319 ("build,json: store arch_packages in profiles.json"( Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Paul Spooren <mail@aparcar.org>
* build,json: store arch_packages in profiles.jsonPaul Spooren2020-07-031-2/+5
| | | | | | | | | The `arch_packages` contains the supported package architecture. Previously it was necessary to parse the `Packages` index for the line `Architecture:`, requiring both an additional parser and file download. Signed-off-by: Paul Spooren <mail@aparcar.org>
* build: store default/device packages in JSONPaul Spooren2020-06-302-2/+19
| | | | | | | | | | | | With this commit the `profiles.json` contain both the target specific `default_packages` as well as the device specific `device_packages` as a array of strings. This information is required for downstream projects like the various web-based interactive firmware generators. Signed-off-by: Daniel Golle <daniel@makrotopia.org> Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: config: remove accidentally added fileÁlvaro Fernández Rojas2020-06-022-0/+1
| | | | | | Also ignore the file. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* scripts: support Sercomm load tagsÁlvaro Fernández Rojas2020-06-022-0/+56
| | | | | | | Header consists in Sercomm PID bytes, followed by a SHA256 hash of the input binary. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* scripts: support Sercomm cryptoÁlvaro Fernández Rojas2020-06-021-0/+86
| | | | | | | | | | | | | | Sercomm firmwares are encrypted with AES 256 CBC. The key is generated with a custom algorithm from the firmware tag: char key[32]; char version[32]; char iv[32]; char random[32]; char size[32]; Key must be generated with Sercomm's algorithm. However, the rest of the header can be empty. IV and random are set to 0 on purpose. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* scripts: support Sercomm partition tagsÁlvaro Fernández Rojas2020-06-021-0/+81
| | | | | | | | | | | Sercomm uses a custom layout for partition tags: char part_name[32]; char size[32]; char part_version[32]; char reserved[32]; char rootfs_version[32]; Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>