Most apk meson args are shared between host and target builds, so lets
have a common variable for them.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Commit b2a84c86e3 ("apk: host: make the help available") enabled the
host build for lua (5.1) as a dependency, but apk defaults to lua 5.3.
This caused it to ignore our lua, and only build the help if the host
system had lua 5.3 installed.
Fix this by explicitly setting the lua version to ours.
Fixes: b2a84c86e3 ("apk: host: make the help available")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
This reverts commit c6a3a11c07 as it was
reported, that it causes issues:
ERROR: failed to read repositories: /dev/zero: No buffer space available
ERROR: unable to select packages:
ca-bundle-20240203-r1:
error: uninstallable
arch: all
satisfies: world[ca-bundle]
Reported-by: xiao bo <peterwillcn@gmail.com>
References: c6a3a11c07 (commitcomment-149072959)
Signed-off-by: Petr Štetiar <ynezz@true.cz>
This reverts commit e1043a746a, that
attempts to nest partitions that overlap but are not nested. This
causes the 'ubi' partition to be truncated, making rootfs inaccessible
and bricking the device.
Also, had this commit worked, it would have renumbered MTD partitions
in a way that would have broken documented scripts for installation and
update of main and recovery OSes, making backups, return to stock, etc,
and broken user configurations that put the 'extra' partition to use.
Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16944
Signed-off-by: Robert Marko <robimarko@gmail.com>
The GatoNetworks GDSP is a re-branded version of the R5000 5G Industrial
router from Yinghua Technologies.
The re-branded device comes with OpenWrt preinstalled, and an OpenWrt-based
U-Boot bootloader version. While the flash layout has been kept compatible
with the OpenWrt version found on the stock device (see [5]), the image format
changed, making a bootloader upgrade necessary.
Specifications:
SoC: Mediatek MT7981BA
RAM: 256MB
Flash: SPI-NOR 32 MiB (Winbond W25Q256)
WLAN: MT7976CN DBDC AX Wi-Fi
Switch: MT7531AE (4x LAN Gigabit ports, 1x WAN Gigabit port)
5G: Quectel RM520N modem
Watchdog: an external WDT connected to GPIO 6 is present and always running;
the built-in Mediatek watchdog is also present and effective, but
not used at the moment.
This porting has been tested only with 1x 5G modems installed (the device
supports up to two).
Installation:
Installation is possible via sysupgrade both in the stock device and
re-branded version. However, in the former case, updating the bootloader is
required.
OpenWrt-based U-Boot Bootloader installation
--------------------------------------------
The firmware flashed in the re-branded device at manifacturing time will
flash an OpenWrt-based U-Boot bootloader with some extra recovery features
(see [1]) at first boot.
To update the bootloader, you need to install the mtd-rw module and
insmod it:
insmod mtd-rw i_want_a_brick=1
Then update relevant flash partitions:
mtd erase u-boot-env
mtd erase BL2
mtd erase FIP
mtd write openwrt-mediatek-filogic-gatonetworks_gdsp-preloader.bin BL2
mtd write openwrt-mediatek-filogic-gatonetworks_gdsp-bl31-uboot.fip FIP
And reboot, making sure all previous commands ran succesfully.
If something goes wrong, you can recover your device via the mtk_uartboot
tool.
In my testing, it was possible to start the process even without (un)-plugging
the device, may be handy for remote recovery.
Installation from stock device and firmware
-------------------------------------------
To install vanilla OpenWrt in the stock device (R5000 5G Industrial router
from Yinghua Technologies) running the stock vendor firmware, you will need
to update your bootloader as described in previous section. Remember to use
-F (force upgrade) and -n (not keeping settings).
U-Boot Recovery
---------------
This procedure has been tested only with the OpenWrt-based U-boot bootloader.
Assign your system static IP address 192.168.1.1 and start a TFTP server. The
device will look for an initramfs image named
openwrt-mediatek-filogic-gatonetworks_gdsp-initramfs-kernel.bin
(so you may use openwrt/bin/targets/mediatek/filogic as root dir for your
TFTP server).
Power on the device while keeping the reset button pressed, until you see
a TFTP request from 192.168.1.10. Your environment will be restored to it's
default state.
MAC addresses assignment
------------------------
MAC addresses are assigned slightly differently than in stock firmware. In
particular, the 5 GHz Wi-Fi uses 2.4 GHZ MAC + 1, rather than reusing it with
LA bit set as done in stock firmware. This MAC address is allocated to the
device, so it can be used.
The 2.4 GHz Wi-Fi MAC address is the label MAC. LAN MAC is used to set the
special U-Boot environment ethaddr variable.
device MAC address U-Boot env variable factory partition offset
2.4 GHz Wi-Fi :84 wifi_mac 0x4
5.8 GHz Wi-Fi :85 not present not present
WAN :86 wan_mac 0x24
LAN :87 lan_mac 0x2A
Notes
-----
[1]: the OpenWrt-based U-Boot bootloader you will find installed in the
re-branded device is configured to request for the initramfs image via
TFTP for $gdsp_tftp_tries times before trying normal boot from NOR flash.
Setting this U-Boot environment variable to 0x0 will disable the feature,
which is not implemented in this patch.
[2]: the exposed UART port is connected to ttyS1; the ttyS0 console port is
not exposed.
[3]: the provided bootloader environment has no provision for operating on
BL2 and the FIP partitions. This is an intentional choice to make it
(slightly) more difficult to brick the device.
[4]: it seems GPIO 6 is used both for the "SYS" LED and external WDT.
[5] BL2 expects to find FIP payload at a fixed offset, so some constraints
apply.
Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
The GatoNetworks GDSP is a re-branded version of the R5000 5G Industrial
router from Yinghua Technologies.
Advantages over stock bootloader:
1. supports serving the external GPIO WDT, allowing for easier work in U-Boot
shell
2. supports cool features like netconsole, easy recovery, scripting and so on
3. allows using FIT image and image integrity validation
and ultimately gives you much more flexibility to implement your tweaks.
Known issues
------------
To make it easier to operate the device, console I/O multiplexing support has
been enabled in U-Boot configuration. Setting I/O related U-Boot environment
variables to something like "serial,nc" will have the desired effect. Still,
setting these variables to such a value in the persistent environment will
lead to a crash and make it impossible to boot the system or recover it. I
decided to leave it on anyway since I think it can be very practical in
development.
Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
Fixes following shellcheck's recommendations:
In scripts/download-check-artifact.sh line 24:
exit $1
^-- SC2086 (info): Double quote to prevent globbing and word splitting.
In scripts/download-check-artifact.sh line 53:
local sum="$(shasum -a 256 "$image_file")";
^-^ SC2155 (warning): Declare and assign separately to avoid masking return values.
In scripts/download-check-artifact.sh line 72:
cd "/tmp/verify.$$"
^-----------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.
In scripts/download-check-artifact.sh line 114:
printf "Keyserver to use? [$keyserver_url] > "
^-- SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo".
In scripts/download-check-artifact.sh line 115:
read url; case "${url:-$keyserver_url}" in
^--^ SC2162 (info): read without -r will mangle backslashes.
While at it make it clear, that it is possible to download/check any
build artifacts like even SDK or ImageBuilder.
Link: https://github.com/openwrt/openwrt/pull/16871
Signed-off-by: Petr Štetiar <ynezz@true.cz>
While checking wiki documentation about GPG signatures checking I found
this nice script and I've thought, that it would be nice to provide it
officially instead of some random internet site.
Usage example:
$ ./scripts/download-check-artifact.sh https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb
1) Downloading image file
=========================
########################################### 100.0%
2) Downloading checksum file
============================
########################################### 100.0%
3) Downloading the GPG signature
================================
########################################### 100.0%
4) Verifying GPG signature
==========================
gpg: Signature made Tue 05 Nov 2024 05:21:50 PM UTC
gpg: using EDDSA key 92C561DE55AE6552F3C736B82B0151090606D1D9
gpg: Good signature from "OpenWrt Build System (Nitrokey3) <contact@openwrt.org>" [ultimate]
Primary key fingerprint: 8A8B C12F 46B8 36C0 F9CD B36F 1D53 D187 7742 E911
Subkey fingerprint: 92C5 61DE 55AE 6552 F3C7 36B8 2B01 5109 0606 D1D9
5) Verifying SHA256 checksum
============================
openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb: OK
Verification done!
==================
Downloaded artifact placed in '/var/home/ynezz/dev/openwrt/openwrt.git/openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb'
Cleaning up.
Adding file in a state as downloaded from https://www.abitare.org/bin/download.sh
References: https://openwrt.org/docs/guide-quick-start/verify_firmware_checksum?s[]=gpg#linux
Signed-off-by: David S. H. Rosenthal <dshr@abitare.org>
Link: https://github.com/openwrt/openwrt/pull/16871
Signed-off-by: Petr Štetiar <ynezz@true.cz>
c1a3e69f24e2 db: validate package arch against compatible arches
2a3dbfc9db58 db: add and use apk_db_parse_file helper to parse files line by line
b231eacd8121 db: simplify add_repos_from_file
98d7196a48d4 db: fix permissions of arch file
d2aaf13ee488 commit: sort matched dependencies on error analysis
c259642c006d tests: rework solver tests to not require apk-test binary
08b4d21f922e tests: move solver test data to separate directory
563d36481166 tests: minor updates to root tests
a236fdd39040 pkg: use memfd_create only if target root has dev/fd working
a5aeb3db113f test: unify makefile and meson tests
d86afdef88b0 db: print message when a file is written to .apk-new
5dd91e3c387d db: consider --force-no-chroot when determining /dev/fd availability
5add6fce22d4 apk-tools-3.0.0_pre4
8a13ed96d1d5 test: fix solver.sh for parallel use
fcd4defc18e6 test: move vertest to cmocka based unit testing infrastructure
e38d5b5a9d04 test: add missing alpine tests makefile
19b1df79ebca blob: refactor apk_blob_for_each_segment into apk_blob_foreach_word
76970a938dd7 package: move the location of executable package scripts
1e0411568dad package: respect libexecdir instead of hard-coding /usr/libexec
a4837ae8ffe2 package: don't call make_device_tree when APK_NO_CHROOT is set
ade0be3449e4 db, extract: handle file/directory extraction errors more consistently
4050f9e69d2e db: fix hardlink handling: root directory and v3 checksums
89e4bf1db040 db, fs: do not extract devices in --usermode
64ff8c72d9fb db: allow files starting with a dot in the root directory of apk3 packages
d26b65d30f55 db, audit: remove support for files without embedded checksum
417a93ceae54 pkg: truncate apkv3 description to 256 bytes
Fixes: #16929
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Make keys directory for APK instead of OPKG while adding local key.
Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
Link: https://github.com/openwrt/openwrt/pull/16942
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Since the image builder pulls package lists from metadata directly,
add procd and busybox as depdendencies to base-files.
As for the package manager itself, since it can be disabled it needs
to be added directly in the image builder makefile
Fixes: 44598c233d ("build: remove broken dependency of metadata on toplevel .config variables")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Duplicate the old opkg index.json using the new apk database.
Needed to get the ASU server working on new snapshots.
Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16931
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Add comments to build system makefile functions and variables to help
developers in understanding build system internals and ease the
development process.
This patch adds some documentation examples with proposed doxygen-like
syntax. Hopefully, this would start the discussion and result in
generation of the makefile documentation guidelines.
Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16888
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Change the version schema of perf to be compatible with APK as
described in this commit: e8725a932e.
Signed-off-by: Til Kaiser <mail@tk154.de>
Link: https://github.com/openwrt/openwrt/pull/16930
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
It seems that despite NSS not being supported in OpenWrt the memory it
usually uses needs to be reserved anyway for stability reasons.
Link: https://github.com/openwrt/openwrt/pull/16928
Signed-off-by: Robert Marko <robimarko@gmail.com>
Most links and info on the org page are broken or defunct, and all new
versions are available on the github based repo anyway.
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16910
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
For the last ten years, nobody has noticed that this driver doesn't
actually say what it is for. ;)
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16910
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
mutex_destroy is missing in remove.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16926
Signed-off-by: Robert Marko <robimarko@gmail.com>
Missing u caused the regulator to fail probe.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16925
Signed-off-by: Robert Marko <robimarko@gmail.com>
Needed to fix compilation with GCC14.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16912
Signed-off-by: Robert Marko <robimarko@gmail.com>
Instead of relying on .config symbols for metadata, alter the DEFAULT
variable of affected packages. Fixes enabling opkg vs apk among others.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Refactor version of spidev_test for APK.
Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/16917
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit comes after a long period of hard work, starting back in
early 2021 as a proof of concept.
Thanks to the Alpine Linux project for creating such a nice package
manager. Thanks to everyone involved; this is going to be great!
Signed-off-by: Paul Spooren <mail@aparcar.org>
i2c_add_numbered_adapter is the wrong function to use here. It requires
setting nr to some value, otherwise it behaves the same as
i2c_add_adapter. nr is not set.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16825
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Remove backtick from gdb description text, as that seems to
be recognized as a shell action by compilation with apk,
causing error.
Example from test buildbot:
rstrip.sh: /builder/shared-workdir/build/sdk/build_dir/target-aarch64_generic_musl/gdb-15.2/ipkg-aarch64_generic/gdb/usr/bin/gdb: executable
bash: -c: line 1: unexpected EOF while looking for matching ``'
bash: -c: line 2: syntax error: unexpected end of file
make[3]: *** [Makefile:123: /builder/shared-workdir/build/sdk/bin/packages/aarch64_generic/base/gdb-15.2-r1.apk] Error 2
Local compilation:
rstrip.sh: /OpenWrt/aarch64/build_dir/target-aarch64_cortex-a53_musl/gdb-15.2/ipkg-aarch64_cortex-a53/gdb/usr/bin/gdb: executable
bash: -c: line 1: unexpected EOF while looking for matching ``'
make[2]: *** [Makefile:123: /OpenWrt/aarch64/bin/packages/aarch64_cortex-a53/base/gdb-15.2-r1.apk] Error 2
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Link: https://github.com/openwrt/openwrt/pull/16908
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Adjust wolfssl version for apk by removing the "-stable"
from the OpenWrt version, although it is still needed for
upstream download archive name.
Define PKG_BUILD_DIR accordingly.
Utilize new short version to simplify ABI_VERSION calculation.
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Link: https://github.com/openwrt/openwrt/pull/16906
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
/sbin/pkg_check uses opkg and is not even packaged when using the
default opkg configuration. remove it when using apk too.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
In 451e2ce006 the code would only move packages separated by dashes,
however OPKG uses underscores to split between package name and version.
Result was the lack of such packages in the packed ImageBuilder.
Use dashes or underscores depending on the select package manger.
Fixes: 451e2ce006 "imagebuilder: fix package inclusion and APK index"
Signed-off-by: Paul Spooren <mail@aparcar.org>
These two were getting rather long.
Signed-off-by: Leon M. Busch-George <leon@georgemail.eu>
Link: https://github.com/openwrt/openwrt/pull/16849
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
What seems to be happening is that the kernel requests an ACTIVE_LOW
gpio initially and sets it to high later based on gpios in dts.
This seems to break some devices where the bootloader sets it to high.
Fixes: e612900ae0 ("ramips: mt7621: convert usb power to regulators")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16877
Signed-off-by: Robert Marko <robimarko@gmail.com>
The `--initdb` command creates basic folders required by APK,
previoiusly it would only run a single time when package_index is
actually called. Since the function isn't called if nothing changes,
`--initdb` doesn't initialize the rootfs again.
This commit moves it to package_reload, which runs every time.
Signed-off-by: Paul Spooren <mail@aparcar.org>
Previously three different ways to include packages in an ImageBuilder
existed:
* buildbot: include libc, kernel (and base-files) in $(IB_LDIR)
* not buildbot, standalone: include all packages in ./packages/
* not buildbot, not standalone: include libc, kernel (and base-files) in
./packages/
First of, the separation between *buildbot* and *not buildbot, not
standalone* is not required, we can just always copy packages to
./packages instead of ever using the special place $(IB_LDIR).
Doing so drops the need to handle the extra case and also allows to
clean up the OPKG package installation, which no longer requries the
`firstword` logic, things are now always at ./packages.
Signed-off-by: Paul Spooren <mail@aparcar.org>
We need to exclude packages from the APK index which must not be
upgraded. To do so, the packages `libc`, `kernel` and `base-files` are
excluded to APK never suggestes them as upgradable.
The previous logic would however match packages like `libcomerr0`,
causing build failures. Make the copying and excluding logic more
precise by adding a single dash.
Signed-off-by: Paul Spooren <mail@aparcar.org>
This commit solves multiple issues. First of just install the three
special packages base-files, libc and kernel directly from the index. In
upstream indexes, those will never appear to prevent accidental upgrades
may breaking the system.
Next, enable caching for the ImageBuilder, which speeds up consecutive
builds from ~33 seconds to ~5 seconds. Using cache however makes APK
create the folder `/var/cache/apk/` which conflicts with the base-files
installation, which ships a symlink from `/var` to `/tmp`, so specify
`--no-cache` for the rootfs initialization.
Lastly, drop the use of `apk update` since APK automatically does that.
Signed-off-by: Paul Spooren <mail@aparcar.org>
This reverts commit 21b5ac862e.
The approach is flawed and cannot work in the ImageBuilder.
Using /etc/uci-defaults/ which is run on the target is the only
possible way.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The Sophos AP15C uses the same hardware as the AP15, but has a reset button.
Based on:
commit 6f1efb2898 ("ath79: add support for Sophos AP100/AP55 family")
author Andrew Powers-Holmes <andrew@omnom.net>
Fri, 3 Sep 2021 15:53:57 +0200 (23:53 +1000)
committer Hauke Mehrtens <hauke@hauke-m.de>
Sat, 16 Apr 2022 16:59:29 +0200 (16:59 +0200)
Unique to AP15C:
- Reset button
- External RJ45 serial console port
Flashing instructions:
This firmware can be flashed either via a compatible Sophos SG or XG
firewall appliance, which does not require disassembling the device, or via
the U-Boot console available on the internal UART header.
To flash via XG appliance:
- Register on Sophos' website for a no-cost Home Use XG firewall license
- Download and install the XG software on a compatible PC or virtual
machine, complete initial appliance setup, and enable SSH console access
- Connect the target AP device to the XG appliance's LAN interface
- Approve the AP from the XG Web UI and wait until it shows as Active
(this can take 3-5 minutes)
- Connect to the XG appliance over SSH and access the Advanced Console
(Menu option 5, then menu option 3)
- Run `sudo awetool` and select the menu option to connect to an AP via
SSH. When prompted to enable SSH on the target AP, select Yes.
- Wait 2-3 minutes, then select the AP from the awetool menu again. This
will connect you to a root shell on the target AP.
- Copy the firmware to /tmp/openwrt.bin on the target AP via SCP/TFTP/etc
- Run `mtd -r write /tmp/openwrt.bin astaro_image`
- When complete, the access point will reboot to OpenWRT.
To flash via U-Boot serial console:
- Configure a TFTP server on your PC, and set IP address 192.168.99.8 with
netmask 255.255.255.0
- Copy the firmware .bin to the TFTP server and rename to 'uImage_AP15C'
- Open the target AP's enclosure and locate the 4-pin 3.3V UART header [4]
- Connect the AP ethernet to your PC's ethernet port
- Connect a terminal to the UART at 115200 8/N/1 as usual
- Power on the AP and press a key to cancel autoboot when prompted
- Run the following commands at the U-Boot console:
- `tftpboot`
- `cp.b $fileaddr 0x9f070000 $filesize`
- `boot`
- The access point will boot to OpenWRT.
Signed-off-by: David Lutz <kpanic@hirnduenger.de>
vrx518_tc currently sets the interface maximum MTU to the ethernet default
of 1500 bytes by default via ether_setup() called from ptm_setup().
To support 1508 byte baby jumbo frames (RFC4638) for PPPoE connections
over VDSL links as already supported by the VR9 ltq_ptm driver ([1], [2])
set the interface maximum MTU to MAX_MTU.
MAX_MTU is defined in dcdp/inc/tc_common.h to 2002 bytes and this value is
used in ptm_change_mtu() and elsewhere as the maximum MTU, however this is
short circuited by checks against the interface maximum MTU.
[1]: https://forum.openwrt.org/t/fritzbox-7530-and-rfc4638-baby-jumbo-frames/181327
[2]: https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=8a2a20e71e2909f84dab47e51dfda9e292a6c1ae
Signed-off-by: Andrew MacIntyre <andymac@pcug.org.au>
Link: https://github.com/openwrt/openwrt/pull/16856
Signed-off-by: Robert Marko <robimarko@gmail.com>