aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* scripts: sercomm-kernel-header.py: improve compatibilityMikhail Zhilkin2023-06-171-3/+3
| | | | | | | | | | | | | | This improves compatibility with the elder stock firmwares of the following devices, which have not yet been merged into OpenWrt: - Beeline SmartBox Pro - Beeline SmartBox Turbo+ - WiFire S1500.NBN Without this, OpenWrt factory image installation may fail. Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com> Signed-off-by: Maximilian Weinmann <x1@disroot.org> (cherry picked from commit 35a4418d3966ccf6229916b0021bd18871ef22dd)
* scripts: qemustart: change armvirt references to armsrMathew McBride2023-06-131-9/+9
| | | | | | | | | The armvirt target has been renamed to 'armsr' (Arm SystemReady) after inclusion of EFI support. Change references (including subtargets) accordingly. Signed-off-by: Mathew McBride <matt@traverse.com.au> (cherry picked from commit 36bf9d861082d30fdb1cf1d00f819e60b8bb84a7)
* scripts: gen_image_generic: allow the partition types to be setMathew McBride2023-06-131-1/+3
| | | | | | | | | | The use case for this is to set the kernel partition as the EFI system partition. Versions of U-Boot with the EFI boot manager (eficonfig and efidebug commands) will store their boot order data on the ESP. Signed-off-by: Mathew McBride <matt@traverse.com.au> (cherry picked from commit 701d774f54aef2f9fe3c584700773dcb260dd03c)
* image: improve uImage.FIT device tree overlay supportDaniel Golle2023-06-091-6/+3
| | | | | | | | | | | Instead of generating full config nodes incl. kernel, generate minimal config nodes for device tree overlays to be applied to the main config. In this way, multiple device tree overlays can be applied more easily. While at it change filenames to upstream style, ie. use dtso and dtbo suffix for device tree overlays. Signed-off-by: Daniel Golle <daniel@makrotopia.org> (cherry picked from commit 6b01d40bfedb42323a1324e1b5624f192a4c91de)
* scripts/gen_image_generic.sh: allow passing in partition offsetTim Harvey2023-05-181-1/+1
| | | | | | | | | | Allow passing in an optional offset (PARTOFFSET) for the first partition. If not specified this will default to 256K (512 blocks) as it has before. For example if you want to start partition data at a 16M offset instead of 256K, specify 'PARTOFFSET=16M'. Signed-off-by: Tim Harvey <tharvey@gateworks.com>
* Revert "scripts: run ipkg-make-index through shellcheck"Paul Spooren2023-05-091-6/+6
| | | | This reverts commit e6aa1a70e6c870cfeac838b52ad57b6888e6629d.
* scripts: run ipkg-make-index through shellcheckPaul Spooren2023-05-091-6/+6
| | | | | | Use quotes and replace `` by $() to pass the shellcheck tests. Signed-off-by: Paul Spooren <mail@aparcar.org>
* scripts: sercomm-pid: add bmips supportÁlvaro Fernández Rojas2023-04-091-5/+11
| | | | | | | Apparently, Sercomm sets 2 padding bytes instead of 1 (ramips). The HW version is a bit different than the one used for ramips. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* scripts: sercomm-payload: add PID file supportÁlvaro Fernández Rojas2023-04-091-2/+18
| | | | | | | Allow passing Sercomm PID from file. Until now, Sercomm PID could only be passed as an array of hex bytes. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* scripts: size_compare: print a grand totalAndre Heider2023-02-031-1/+4
| | | | | | | | | | | Usefull to check the impact of treewide changes: Change Local Remote Package +281 6191 5910 ubus -547 56166 56713 procd -13294 91544 104838 ubi-utils ~~~~~~~ total change -13560 Signed-off-by: Andre Heider <a.heider@gmail.com>
* scripts: size_compare: fix support for CONFIG_BINARY_FOLDERAndre Heider2023-02-031-8/+11
| | | | | | | | There is no CONFIG_BINARY_DIR, it's CONFIG_BINARY_FOLDER. While at it, don't parse the shell compatible .config, eval it. Signed-off-by: Andre Heider <a.heider@gmail.com>
* scripts: qemustart: support CONFIG_BINARY_FOLDERAndre Heider2023-02-031-1/+2
| | | | | | | | | | If CONFIG_BINARY_FOLDER is set in .config, use that instead of "bin" as the bindir. That allows to set that config and easily run e.g. `./scripts/qemustart armvirt 32`. Signed-off-by: Andre Heider <a.heider@gmail.com>
* build: add ALT3 and ALT4 vendor/model/variantWenli Looi2023-01-251-1/+1
| | | | | | This is needed for the Netgear EX7300 series v2. Signed-off-by: Wenli Looi <wlooi@ucalgary.ca>
* scripts: ext-tools: add option to only refresh timestampsChristian Marangi2023-01-231-4/+20
| | | | | | | It's possible to have prebuilt tools already extracted. Add option to just refresh the timestamps. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts: ext-tools: follow links for host tools pathChristian Marangi2023-01-231-1/+1
| | | | | | | Host tools path may be a symbolic link. Use -H with find to follow path links passed from command line to find command. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts/dl_github_archieve.py: fix generating unreproducible tarChristian Marangi2023-01-121-1/+1
| | | | | | | | | | | | | | | Allign dl_github_archieve.py to 8252511dc0b5a71e9e64b96f233a27ad73e28b7f change. On supported system the sigid bit is applied to files and tar archieve that on tar creation. This cause unreproducible tar for these system and these bit should be dropped to produce reproducible tar. Add the missing option following the command options used in other scripts. Fixes: 75ab064d2b38 ("build: download code from github using archive API") Suggested-by: Eneas U de Queiroz <cotequeiroz@gmail.com> Tested-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts: add Apache fastly mirrorDavid Bauer2023-01-071-0/+1
| | | | | | | Add the Apache fastly mirror as preferred download source. This service is using a dual-stacked CDN. Signed-off-by: David Bauer <mail@david-bauer.net>
* scripts: remove redundant character '0x0a' from Linksys image signatureShiji Yang2022-11-271-3/+0
| | | | | | | | | The redundant character '0x0a' after the 192 bytes '0x00' padding broke the factory image. We need to remove it to make things work again. Fixes: e6769d11f3 scripts: fix missing character '0' issue in linksys image Tested-by: Tony Butler <spudz76@gmail.com> Signed-off-by: Shiji Yang <yangshiji66@qq.com>
* scripts: fix dl_cleanup.py argument handlingAndre Heider2022-11-151-3/+6
| | | | | | | | | | The -w|--whitelist and -D|--download-dir arguments pass an additional value, properly evaluate that. Also allow to pass the download directory without -D|--download-dir, just as the usage describes. Finally fix spitting out the wrong error messages about those args. Signed-off-by: Andre Heider <a.heider@gmail.com>
* scripts/mkits.sh: fix portability issueFelix Fietkau2022-11-091-2/+2
| | | | | | | BSD wc can output more whitespaces, which breaks the cut usage. Replace the cut invocation with awk, which is more portable. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* mkits: support definition of DTB loadaddrDavid Bauer2022-11-081-1/+7
| | | | | | | Support defining a per-device loadaddress for the DTB. This is required for devices which to not align the DTB from the bootloader correctly. Signed-off-by: David Bauer <mail@david-bauer.net>
* scripts: fix missing character '0' issue in linksys imageShiji Yang2022-10-301-2/+2
| | | | | | | | In the stock firmware of Linksys, there is a '0' after the crc checksum. Validated on EA6350V3, EA7300 and EA7300V2's stock images. Fixes: 892d741259 build: add a script for generating Linksys factory images Signed-off-by: Shiji Yang <yangshiji66@qq.com>
* scripts/download.pl: pass aria2 config in ENV onlyZhang Hua2022-10-201-0/+1
| | | | | | | | | | | | | The aria2c command tries to load config from ${XDG_CONFIG_HOME:-${HOME}/.config}/aria2/aria2.conf by default, which may result unexpected behavior. As a replacement, people can use environment variable ARIA2C_OPTIONS to custom arguments passed to aria2c like curl and wget below. Including --conf-path=/path/to/config.conf in ARIA2C_OPTIONS can also set a custom config file path easily if needed. Signed-off-by: Zhang Hua <zhanghuadedn@gmail.com>
* scripts/download.pl: make the download tool configurableChristian Marangi2022-10-201-13/+35
| | | | | | | | | | | | | | | | | | | | | | Introduce a new option in the "Advanced configuration options" to configure a custom download tool. By declaring a string in "Use custom download tool" an user can force what command to use to download package. With the string empty the default tool used is curl, with wget as a fallback if not available. download.pl supports 3 tools officially aria2c, curl and wget. If one of the tool is used in this config, download.pl will use the default args to make use of them. If the provided string is different than aria2c, curl or wget, the command is used as is and the download url will be appended at the end of such command. While at it also tweak the tool selection logic and chose the tool only once when the script is called and move aria2c specific variables in the relevant section. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts/ext-tools: introduce new script to install prebuilt toolsChristian Marangi2022-09-301-0/+98
| | | | | | | | | | | | | | | Add a simple script to make it easier to install a prebuilt tools tar. Currently it will be used by our tools container and kernel workflow on github. Simple script that take a tar that contains prebuilt host tools, extract them and refresh the timestamps to skip recompilation of such host tools. By default it refresh timestamps of build_dir/host and staging_dir/host/stamp. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts/download.pl: add tsinghua and ustc mirrorsBradford Zhang2022-09-301-0/+9
| | | | | | Add https://mirrors.tuna.tsinghua.edu.cn/ and https://mirrors.ustc.edu.cn/ mirrors into download.pl to speed up download in China. Signed-off-by: Bradford Zhang <zyc@zyc.name>
* scripts/download.pl: generilize and simplify download tool checkChristian Marangi2022-09-281-16/+17
| | | | | | | | | Generilize download tool check and skip other check if a download tool has been found. While at it also reintroduce c836ca84e8f641e10a8349a8f9b7432b33d6cec1 that was previously dropped with aria2c support. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts/download.pl: fix support for aria2c download tool on macosChristian Marangi2022-09-261-6/+8
| | | | | | | | | Currently we use /dev/shm to place aria2c tmp file. This is not present on macos. Use the openwrt tmp directory instead of the linux-only /dev/shm to save compatibility with more os. Fixes: d39123626931 ("download.pl: add aria2c support") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts/download.pl: fix mirrors regression for curl and wgetChristian Marangi2022-09-261-1/+1
| | | | | | | | | With the introduction of aria2c support, curl and wget no longer try to download the file from mirrors. Fix this regression by emptying the remaining mirrors list only when aria2c is used. Fixes: d39123626931 ("download.pl: add aria2c support") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts/download.pl: fix whitespace in mirror urls and drop forChristian Marangi2022-09-251-7/+2
| | | | | | | Fix whitespace in mirror urls and replace for loop with join+map logic. Fixes: d39123626931 ("download.pl: add aria2c support") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* download.pl: add aria2c supportBradford Zhang2022-09-251-13/+40
| | | | | | | | | | | | Use aria2c download tool by default on package download if available in the system. aria2c permits to use multiple mirrors and may improve download speed on special context where servers are hard to reach. Co-authored-by: Christian Marangi <ansuelsmth@gmail.com> Signed-off-by: Bradford Zhang <zyc@zyc.name> [ fix wrong var in the script and improve commit description ] Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts/dl_cleanup: add support for subdirectoriesMichael Pratt2022-09-221-9/+18
| | | | | | | | | | | Allow comparing subdirectories exactly like files. Handle a corner case where the new subdirectory has the same tarball inside of it as the one that was downloaded before a subdirectory for that package was established. Signed-off-by: Michael Pratt <mcpratt@pm.me>
* scripts: add clean of build dir to dl_cleanup scriptAnsuel Smith2022-09-141-3/+35
| | | | | | | | | | Improve dl_cleanup by adding an option to also clean the build directory related to the downloaded package. The script will check every directory in build_dir/ and check if any old package is present there. If outdated package are found, the old one are cleared leaving only the last one. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* scripts: assume dl/ the default dir for dl_cleanup scriptAnsuel Smith2022-09-141-8/+12
| | | | | | | Assume dl/ the default dl dir and make it configurable if someone have that in a different place. Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* scripts: add additional regex for dl_cleanupAnsuel Smith2022-09-141-0/+2
| | | | | | | Add additional regex for dl_cleanup script to handle case with xxx-v1.2a and xxx-v1.2.3a Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
* scripts/download.pl: fix downloads with wgetPetr Štetiar2022-09-131-2/+8
| | | | | | | | | | | | | | | | | | | | Several users of wget for downloads (curl is not available in the system) have reported broken download functionality: wget --tries=5 --timeout=20 --output-document=- https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.142.tar.xz http://: Invalid host name. Thats all happening due to '' was passed as an argument, which got later expanded to http://. In the context of a list constructor '' is not nothing, it is an empty string element. So fix it by using () as it will yield "nothing" and thus not introduce an empty string element. Fixes: #10692 Fixes: 90c6e3aedf16 ("scripts: always check certificates") Signed-off-by: Jo-Philipp Wich <jo@mein.io> [shellwords() -> ()] Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts/download.pl: silence can't exec curl warningPetr Štetiar2022-09-131-1/+1
| | | | | | | | | | | When running build in verbose mode `make V=s` we can see a lot of following warnings when curl is not available in the system: Can't exec "curl": No such file or directory at scripts/download.pl line 77. So lets fix it by redirecting of the stderr to null hole. Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts: always check certificatesJosh Roys2022-09-101-2/+4
| | | | | | | | | | | | | | | Remove flags from wget and curl instructing them to ignore bad server certificates. Although other mechanisms can protect against malicious modifications of downloads, other vectors of attack may be available to an adversary. TLS certificate verification can be disabled by turning oof the "Enable TLS certificate verification during package download" option enabled by default in the "Global build settings" in "make menuconfig" Signed-off-by: Josh Roys <roysjosh@gmail.com> [ add additional info on how to disable this option ] Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts: xxdi.pl: add xxd -i compat modePetr Štetiar2022-09-061-18/+19
| | | | | | | | | | | So it can serve as a standalone drop in replacement for xxd utility used currently mostly in U-Boot packages with `xxd -i` mode which outputs C include file style, with aim for byte to byte identical output, so the eventual difference in the generated output is easily spottable. Fixes: #10555 Signed-off-by: Petr Štetiar <ynezz@true.cz> Signed-off-by: Jo-Philipp Wich <jo@mein.io> [perl-fu]
* scripts: xxdi.pl: remove File::Slurp dependencyJo-Philipp Wich2022-09-061-2/+17
| | | | | | | In order to make it more portable. Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts: add xxdi.plPetr Štetiar2022-09-061-0/+50
| | | | | | | | | xxdi.pl is a Perl script that implements vim's 'xxd -i' mode so that packages do not have to use all of vim just to get this functionality. References: #10555 Source: https://github.com/gregkh/xxdi/blob/97a6bd5cee05d1b15851981ec38ef5a460ddfcb1/xxdi.pl Signed-off-by: Petr Štetiar <ynezz@true.cz>
* scripts: ext-toolchain: add support for muslChristian Marangi2022-07-241-2/+12
| | | | | | | | Openwrt now supports only glibc and musl. Add support for musl and rework the libc check to handle the new config flags and correctly compile package basend on that. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts: ext-toolchain: add support for info.mk in probe_ccChristian Marangi2022-07-241-0/+7
| | | | | | | Openwrt generate info.mk that contains the libc type. For probe_cc check if the file exist and parse directly it for LIBC type. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts: ext-toolchain: actually probe libc type on config generationChristian Marangi2022-07-241-0/+1
| | | | | | | | Currently we never call probe_cc before config generation, this cause the script to never actually detect the correct libc type. Call probe_cc before config generation to correctl set the .config file. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts: ext-toolchain: add option to overwrite configChristian Marangi2022-07-241-4/+18
| | | | | | | | It can be useful to overwrite an already generated config. Option are simply added at the end of the config and make defconfig will overwrite the relevant option with the new one. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* scripts: ext-toolchain: fix wrong prefix in print_config generationChristian Marangi2022-07-241-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | The parsed prefix in print_config is wrong and this produce broken generated .config that won't work with any external toolchain. Currently the prefix from a CC of 'arm-openwrt-linux-muslgnueabi-gcc-12.1.0' produce a prefix 'arm-openwrt-linux-muslgnueabi-gcc-' This is wrong as the real prefix should be 'arm-openwrt-linux-muslgnueabi-' This is probably caused by a change in how the toolchain is now handled that now append also the gcc version. Probably in ancient days the version wasn't part of the name and the prefix generation stripped the '-gcc' instead of the gcc version. Fix this and correctly strip the gcc version and the gcc suffix to correctly call toolchain bins. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* ramips: add support for ZyXEL NWA50AX / NWA55AXEDavid Bauer2022-07-201-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hardware -------- CPU: Mediatek MT7621 RAM: 256M DDR3 FLASH: 128M NAND ETH: 1x Gigabit Ethernet WiFi: Mediatek MT7915 (2.4/5GHz 802.11ax 2x2 DBDC) BTN: 1x Reset (NWA50AX only) LED: 1x Multi-Color (NWA50AX only) UART Console ------------ NWA50AX: Available below the rubber cover next to the ethernet port. NWA55AXE: Available on the board when disassembling the device. Settings: 115200 8N1 Layout: <12V> <LAN> GND-RX-TX-VCC Logic-Level is 3V3. Don't connect VCC to your UART adapter! Installation Web-UI ------------------- Upload the Factory image using the devices Web-Interface. As the device uses a dual-image partition layout, OpenWrt can only installed on Slot A. This requires the current active image prior flashing the device to be on Slot B. If the currently installed image is started from Slot A, the device will flash OpenWrt to Slot B. OpenWrt will panic upon first boot in this case and the device will return to the ZyXEL firmware upon next boot. If this happens, first install a ZyXEL firmware upgrade of any version and install OpenWrt after that. Installation TFTP ----------------- This installation routine is especially useful in case * unknown device password (NWA55AXE lacks reset button) * bricked device Attach to the UART console header of the device. Interrupt the boot procedure by pressing Enter. The bootloader has a reduced command-set available from CLI, but more commands can be executed by abusing the atns command. Boot a OpenWrt initramfs image available on a TFTP server at 192.168.1.66. Rename the image to owrt.bin $ atnf owrt.bin $ atna 192.168.1.88 $ atns "192.168.1.66; tftpboot; bootm" Upon booting, set the booted image to the correct slot: $ zyxel-bootconfig /dev/mtd10 get-status $ zyxel-bootconfig /dev/mtd10 set-image-status 0 valid $ zyxel-bootconfig /dev/mtd10 set-active-image 0 Copy the OpenWrt ramboot-factory image to the device using scp. Write the factory image to NAND and reboot the device. $ mtd write ramboot-factory.bin firmware $ reboot Signed-off-by: David Bauer <mail@david-bauer.net>
* image: add support for Netgear encrypted imageWenli Looi2022-07-191-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | Netgear encrypted image is used in various devices including WAX202, WAX206, and EX6400v3. This image format also requires a dummy squashfs4 image which is added here as well. References in WAX202 GPL source: https://www.downloads.netgear.com/files/GPL/WAX202_V1.0.5.1_Source.rar * openwrt/bootloader/u-boot-mt7621-2018.09-gitb178829-20200526/board/ralink/common/dual_image.c Bootloader code that verifies the presence of a squashfs4 image, thus a dummy image is added here. * openwrt/tools/imgencoder/src/gj_enc.c Contains code that generates the encrypted image. There is support for adding an RSA signature, but it does not look like the signature is verified by the stock firmware or bootloader. * openwrt/tools/imgencoder/src/imagekey.h Contains the encryption key and IV. It appears the same key/IV is used for other Netgear devices including WAX206 and EX6400v3. Signed-off-by: Wenli Looi <wlooi@ucalgary.ca>
* scripts: fix CAMEO tag generatorSander Vanheule2022-07-051-1/+1
| | | | | | | | | | | What should have been only cosmetic changes, ended up in breaking the script. Rename UIMAGE_CRC_SLICE back to (the original) UIMAGE_CRC_OFF. Fixes issue #10204 "cameo-tag.py broken" Reported-by: Markus Stockhausen <markus.stockhausen@gmx.de> Fixes: f9e840b65700 ("scripts: add CAMEO tag generator") Signed-off-by: Sander Vanheule <sander@svanheule.net>
* scripts: add CAMEO tag generatorMarkus Stockhausen2022-07-051-0/+117
| | | | | | | | | | | | This script inserts CAMEO tags into an uImage to make U-Boot of DGS-1210 switches happy. Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de> Suggested-by: Sander Vanheule <sander@svanheule.net> # Mutual checksum algorithm [commit title prefix, trailing whitespace, OpenWrt capitalisation, move CRC calculation comment, use UIMAGE_NAME_*, remove parentheses for return, use f-string instead of str()] Signed-off-by: Sander Vanheule <sander@svanheule.net>