aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* scripts/flashing/flash.sh: remove trailing whitespacesRosen Penev2020-05-241-4/+4
| | | | | | Signed-off-by: Rosen Penev <rosenp@gmail.com> [cut out of patch with different subject] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* scripts/flashing/flash.sh: Add missing quotesRosen Penev2020-05-241-5/+5
| | | | | | | | | These are in if statements (where they should be), and echo output that is not piped to anything. These should be safe. Found with shellcheck. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* scripts: add CFE Partition Tags supportÁlvaro Fernández Rojas2020-05-211-0/+191
| | | | | | | | | | | | | Some BCM63xx NAND devices require a specific JFFS2 partition tag to verify the JFFS2 partition validity: u32 part_id; u32 part_size; u16 flags; char part_name[33]; char part_version[21]; u32 part_crc32; Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* build: have config-clean deal with old temp filesEneas U de Queiroz2020-05-202-1/+11
| | | | | | | | | | This is a temporary commit to have 'make config-clean' remove temporary files from the previous scripts/config version. The .gitignore file is updated to deal with the old files as well. Cc: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
* build: scripts/config - update to kconfig-v5.6Eneas U de Queiroz2020-05-2038-4952/+7765
| | | | | | | | | | | | | | | | | | | | | Major changes include: - Much more readable reverse dependencies separated in groups - Improved recursive dependency report - More readable .config files: add comments to signal end of menus - More warnings for incorrect Config.in entries, such as a 'choice' default not contained in the 'choice' - Hability to properly display pseudographics with non-latin locales - Recursive dependencies can optionally be treated as errors Changes from failed dcf3e63a35d05e7e5103819c0f17195bfafe9baa attempt: - Recursive dependencies are treated as warnings by default - The option to treat them as errors is implemented as a command-line flag to scripts/config/conf instead of a compile-time definition - fixed handling of select with umnet dependencies Cc: Petr Štetiar <ynezz@true.cz> Cc: Jo-Philip Wich <jow@mein.io> Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
* scripts: cfe-wfi-tag: fix shebangÁlvaro Fernández Rojas2020-05-191-1/+1
| | | | | Fixes: 72985233a696 ("scripts: support CFE WFI images") Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* scripts: cfe-bin-header: fix shebangÁlvaro Fernández Rojas2020-05-191-1/+1
| | | | | Fixes: e575a7f777ef ("scripts: support tags for CFE binaries") Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* scripts: support CFE WFI imagesÁlvaro Fernández Rojas2020-05-181-0/+200
| | | | | | | | | | | CFE WFI (Whole Flash Image) consists in 20 byte footer: - u32: CRC32 - u32: WFI Version - u32: Chip ID - u32: Flash Type - u32: Flags Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* scripts: support tags for CFE binariesÁlvaro Fernández Rojas2020-05-181-0/+72
| | | | | | | | | CFE loads binaries based on a 12 byte header which corresponds to: - u32: Load Address - u32: Entry Address - u32: Size Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* scripts/download: add sources CDN as first mirrorPaul Spooren2020-04-141-0/+1
| | | | | | | | | | | | | | | | | OpenWrt now has a CDN for sources at sources.cdn.openwrt.org which mirrors sources.openwrt.org. Downloading sources outside Europe or US (mainland) could result in low throughput, extremely slowing down the first compilation of the build system. This patch adds sources.cdn.openwrt.org as the first mirror to offer worldwide fast download speeds by default. If the CDN goes down for whatever reason, the script jumps to the next available mirror and downloads requested files as before (in regional varying speed). Signed-off-by: Paul Spooren <mail@aparcar.org> Acked-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
* scripts: JSON merge don't crash if no JSON foundPaul Spooren2020-04-141-2/+0
| | | | | | | | | | | | | | | | | | The JSON `WORK_DIR` ($(KDIR)/json_info_files) is only created if the new image generation methods from `image.mk` are used. However some targets like `armvirt` do not use it yet, so the folder is never created. The `json_overview_image_info.py` script used to raise an error if the given `WORK_DIR` isn't a folder, however it should just notify about missing JSON files. This patch removes the Python assert and exists with code 0 even if no JSON files were found, as this is not necessarily an error but simply not yet implemented. Using `glob` on an not existing `Path` results in an empty list, therefore the for loop won't run. Signed-off-by: Paul Spooren <mail@aparcar.org> CC: Petr Štetiar <ynezz@true.cz>
* Revert "build: scripts/config - update to kconfig-v5.6"Jo-Philipp Wich2020-04-1238-7752/+4951
| | | | | | | | | | | | | | | | | | | This reverts commit dcf3e63a35d05e7e5103819c0f17195bfafe9baa. The kconfig update requires further testing and refinement until it can remain in tree. Main problems are: - Recursive deps are now fatal instead of a warning - Previously legal syntax now leads to hard failures - It fails all package builds since multiple days The updated kconfig implementation needs to cope with the current status quo in the various package feeds before we can reconsider it for master. It is not desirable that single broken packages can hard-fail the entire build pipeline. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* Revert "build: add option to warn on recursive dependency"Jo-Philipp Wich2020-04-122-9/+0
| | | | | | | | | | This reverts commit 3204430e38f1a2ba7fda9471720a2a1042adf5e0. Reverting this commit in preparation for reverting dcf3e63a35 ("build: scripts/config - update to kconfig-v5.6") which introduces various unaddressed build breakages. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* Revert "build: config: allow bool to select a module pkg"Jo-Philipp Wich2020-04-122-4/+2
| | | | | | | | | | This reverts commit 8514b6b42c17d7cf887fc826596534698e89e3f8. Reverting this commit in preparation for reverting dcf3e63a35 ("build: scripts/config - update to kconfig-v5.6") which introduces various unaddressed build breakages. Signed-off-by: Jo-Philipp Wich <jo@mein.io>