Commit Graph

110 Commits

Author SHA1 Message Date
Leonardo Mörlein b993b68b6c build: introduce $(MKHASH)
Before this commit, it was assumed that mkhash is in the PATH. While
this was fine for the normal build workflow, this led to some issues if

    make TOPDIR="$(pwd)" -C "$pkgdir" compile

was called manually. In most of the cases, I just saw warnings like this:

    make: Entering directory '/home/.../package/gluon-status-page'
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    bash: line 1: mkhash: command not found
    [...]

While these were only warnings and the package still compiled sucessfully,
I also observed that some package even fail to build because of this.

After applying this commit, the variable $(MKHASH) is introduced. This
variable points to $(STAGING_DIR_HOST)/bin/mkhash, which is always the
correct path.

Signed-off-by: Leonardo Mörlein <me@irrelefant.net>
2021-05-13 15:13:15 +02:00
François Chavant 5a9608102b build: kernel2minor: work around path length limit
When building for MikroTik devices the kernel2minor tool will sometimes
fail with:

  Can't get lstat from kernel file!: No such file or directory.

This is because kernel2minor expects paths no longer than 250 chars.
To work around this the include/image-commands.mk has been modified
to copy the kernel to a temporary file (/tmp/tmp.XXXXXXXXXX) before
calling kernel2minor.

Signed-off-by: François Chavant <francois@chavant.info>
2021-05-12 13:39:29 +02:00
Daniel Golle c7a5a093ef
image: use portable filename in 'append-image-stage'
The 'append-image-stage' command doesn't work when setting the
EXTRA_IMAGE_NAME option of the ImageBuilder as in that case
DEVICE_IMG_PREFIX is modified and no longer matches the value it had in
buildroot. Choose a filename independent of DEVICE_IMG_PREFIX for
images staged using 'append-image-stage' to fix that.

Fixes: de4b29dab9 ("image: introduce 'append-image-stage' build command")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-24 12:19:06 +01:00
Daniel Golle de4b29dab9
image: introduce 'append-image-stage' build command
Similar to 'append-image' this new command appends an existing binary.
'append-image-stage' also makes a copy of that binary and keeps it in
$(STAGING_DIR_IMAGE). When called from within the ImageBuilder, this
copy is used instead of expecting the binary to be present.
This is useful for artifacts which include the initramfs/recovery image
which is usually not included in the ImageBuilder.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-04-23 23:16:49 +01:00
Daniel Golle b6c366efa8
image: fix append-image when building multiple profiles
In case CONFIG_TARGET_MULTI_PROFILE is set, IMG_PREFIX cannot be
expanded. Use DEVICE_IMG_PREFIX instead and make sure it's defined.

Fixes: 8f89b1ab0f ("image: add 'append-image' build command")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-24 22:55:16 +00:00
Daniel Golle 8f89b1ab0f
image: add 'append-image' build command
Commit 7ce1d9ce09 ("build: artifacts add dependency for built images")
now makes sure that sysupgrade and initramfs images are available at
the stage that artifacts are created.
Allow making use of that with a new build command 'append-image' to
be used in artifacts.
See the next commit for an example.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-24 15:27:48 +00:00
Daniel Golle 6890f6fe13 include/image*: add support for device-tree overlays
Add new target feature 'dt-overlay' which makes DTC keep the symbol
names in the generated dtb.
Make sure additional DT overlay sources specified by the new device
variable DEVICE_DTS_OVERLAY get compiled together with the main DTS
(currently overlays got to be in the same folder). Let Build/fit pass
the generated DT overlay blobs to mkits.sh.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-17 17:45:34 +00:00
Robert Marko 9f714398e0 build: use config-1 instead of config@1 as default
U-boot will reject all nodes with @ since commit:
79af75f777

This will cause the OpenWrt images to fail booting,
to rectify use the config-1 as default.

Signed-off-by: Robert Marko <robert.marko@sartura.hr>
2021-03-05 15:45:33 +00:00
Daniel Golle bb98ddc47b mediatek: mt7622: make sure image generation can run in parallel
The previous approach of referencing artifacts in follow-up artifacts
can't work with parallel builds in the current way image.mk is built.
Refactor things so this is not needed.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-02 01:41:31 +00:00
Daniel Golle ded54ae196 mediatek: mt7622: bpi-r64: simplify eMMC install procedure
Write everything needed for eMMC install into the gaps between
partitions on SD card. In that way, installation to eMMC only needs
the SD card, no additional files need to be loaded via TFTP any more.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-03-01 19:33:46 +00:00
Daniel Golle ebcb4f1d0a
treewide: fix spelling 'seperate' -> 'separate'
This popular spelling mistake was also introduced by myself lately.
Fix it everywhere.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-28 23:59:21 +00:00
Daniel Golle f074541f31 image: remove bogus mkimage command
That was a left-over from testing and should not have made it into the
tree. Remove it.

Fixes: 330bd380e8 ("image: allow building FIT and uImage with ramdisk")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-25 14:07:20 +00:00
Daniel Golle 330bd380e8 image: allow building FIT and uImage with ramdisk
Instead of embedding the initrd cpio archive into the kernel, allow
for having an external ramdisk added to the FIT or uImage.
This is useful to overcome kernel size limitations present in many
stock bootloaders, as the ramdisk is then loaded seperately and doesn't
add to the kernel size. Hence we can have larger ramdisks to host ie.
installers with all binaries to flash included (or a web-based
firmware selector).
In terms of performance and total size the differences are neglectible.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-24 01:35:20 +00:00
Daniel Golle e6aac8d98f image: add support for building FIT image with filesystem
Allow for single (external-data) FIT image to hold kernel, dtb and
squashfs. In that way, the bootloader verifies the system integrity
including the rootfs, because what's the point of checking that the
hash of the kernel is correct if it won't boot in case of squashfs
being corrupted? Better allow bootloader to check everything needed
to make it at least up to failsafe mode. As a positive side effect
this change also makes the sysupgrade process on nand potentially
much easier as it is now.
In short: mkimage has a parameter '-E' which allows generating FIT
images with 'external' data rather than embedding the data into the
device-tree blob itself. In this way, the FIT structure itself remains
small and can be parsed easily (rather than having to page around
megabytes of image content). This patch makes use of that and adds
support for adding sub-images of type 'filesystem' which are used to
store the squashfs. Now U-Boot can verify the whole OS and the new
partition parsers added in the Linux kernel can detect the filesystem
sub-images, create partitions for them, and select the active rootfs
volume based on the configuration in FIT (passing configuration via
device tree could be implemented easily at a later stage).

This new FIT partition parser works for NOR flash (on top of mtdblock),
NAND flash (on top of ubiblock) as well as classic block devices
(ie. eMMC, SDcard, SATA, NVME, ...).
It could even be used to mount such FIT images via `losetup -P` on a
user PC if this patch gets included in Linux upstream one day ;)

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2021-02-24 01:35:20 +00:00
Álvaro Fernández Rojas 1235ea7c20 image: add ModelNameLimit16
This script returns the model name limited to 16 characters.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
2021-02-22 18:29:40 +01:00
Yanase Yuki d468ff97b7 build: move elx-header into image-commands.mk
ELECOM WAB-I1750-PS will need this in ath79, so move it to common
Makefile.

Signed-off-by: Yanase Yuki <dev@zpc.sakura.ne.jp>
2021-02-05 21:57:19 +01:00
INAGAKI Hiroshi eb11cd9ea3 ramips: add support for ELECOM WRC-2533GHBK-I
ELECOM WRC-2533GHBK-I is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based
on MT7621A.

Specification:

- SoC		: MediaTek MT7621A
- RAM		: DDR3 128 MiB
- Flash		: SPI-NOR 16 MiB
- WLAN		: 2.4/5 GHz 4T4R (2x MediaTek MT7615)
- Ethernet	: 10/100/1000 Mbps x5
  - Switch	: MediaTek MT7530 (SoC)
- LED/keys	: 4x/3x (2x buttons, 1x slide-switch)
- UART		: through-hole on PCB
  - J4: 3.3V, RX, GND, TX from SoC side
  - 57600n8
- Power		: 12VDC, 1.5A

Flash instruction using factory image:

1. Boot WRC-2533GHBK-I normally
2. Access to "http://192.168.2.1/" and open firmware update page
   ("ファームウェア更新")
3. Select the OpenWrt factory image and click apply ("適用") button
4. Wait ~150 seconds to complete flashing

MAC addresses:

LAN	: BC:5C:4C:xx:xx:89 (Config, ethaddr (text))
WAN	: BC:5C:4C:xx:xx:88 (Config, wanaddr (text))
2.4GHz	: BC:5C:4C:xx:xx:8A (Factory, 0x4    (hex))
5GHz	: BC:5C:4C:xx:xx:8B (Factory, 0x8004 (hex))

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
2021-01-29 15:32:07 +01:00
INAGAKI Hiroshi 0071c7cd82 build: add elecom-product-header for ELECOM devices
A header used in ELECOM WRC-300GHBK2-I and WRC-1750GHBK2-I/C is also
used in ELECOM WRC-2533GHBK-I, so split the code to generate the header
and move it to image-commands.mk to use from ramips target.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Reviewed-by: Sungbo Eo <mans0n@gorani.run>
2021-01-29 15:28:12 +01:00
Paul Spooren ca289e322d build/image: warn if missing qemu-img for VDI/VMDK
Currently `qemu-img` is used to convert raw x86 images to VDI and VMDK
images, used for virtual machines.

Having `qemu-img` in tree requires us to maintain an ancient version of
`qemu-utils`, which recently required extra work to compile with newer
compiler version.

This commit prints a warning message in case `qemu-img` is missing.

As a next step the in-tree version of `qemu-img` can be removed.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-01-10 12:28:14 -10:00
Sander Vanheule c20b8d690b build: add UIMAGE_MAGIC to device variables
Allow a device recipe to specify a custom UIMAGE_MAGIC value, as used by
OpenWrt's -M flag for mkimage. This allows to automatically customize
the magic bytes in all calls to Build/uImage for this device, similar to
the behaviour of UIMAGE_NAME. Since the -M argument is inserted before
the user arguments, it can be overriden.

The following example would use 0x87654321 for the KERNEL image, but
0x12345678 for the KERNEL_INITRAMFS image:

  define Device/MyDevice
    UIMAGE_MAGIC := 0x87654321
    KERNEL := ... | uImage lzma
    KERNEL_INITRAMFS := ... | uImage lzma -M 0x12345678
    ...
  endef

Fixes: df8e6be59a ("rtl838x: add new architecture")
[UIMAGE_MAGIC was not declared as a device variable]

Signed-off-by: Sander Vanheule <sander@svanheule.net>
[rebase, improve formatting of "Fixes"]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-25 15:55:26 +01:00
Adrian Schmutzler 8416d0626f build: uImage: separate arguments into individual lines
Having one line per argument increases overview dramatically.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-11-25 15:51:18 +01:00
Sander Vanheule ff012f3a67 build: uImage: allow override of default arguments
For some build recipes, the argument to Build/uImage is used to sneak in
extra arguments for mkimage, whereas this appears to have been intended
to specificy the compression method only.

Use the first provided word for -C to be backwards compatible with
current calls to Build/uImage. Use the rest of the call arguments to
override the provided defaults. Only the input file name (-d) and the
output file name cannot overriden.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
2020-11-25 15:46:34 +01:00
Adrian Schmutzler 8af6dfc01c image: sort image-commands.mk alphabetically
The definitions in image-commands.mk seem to have no particular
order. Sort them alphabetically to make it easier to actually
find anything there. No other changes made beyond moving entire
blocks.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-30 19:23:00 +01:00
Adrian Schmutzler 1cdba3d19e image: drop combined-image build recipe
Build/combined-image is only used in ath25 target, and that defines
its own version. Thus, drop the unused definition in image-commands.mk.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-10-30 19:20:30 +01:00
John Thomson 9a168b51c3 build: image: add append-dtb-elf helper
The mips kernel vmlinux image supports adding an empty ELF section
for DTB to be later inserted into with MIPS_ELF_APPENDED_DTB.

This ELF + inserted DTB image can then be directly booted on some
devices.

Example usage:
image/subtarget.mk:
KERNEL_NAME := vmlinux.elf
KERNEL_INITRAMFS_NAME := vmlinux-initramfs.elf
KERNEL := kernel-bin | append-dtb-elf

On mt7621 memory size needed to be manually specified.

Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
2020-10-29 21:35:03 +08:00
Christian Lamparter fed1788689 scripts: mkits.sh make it possible to specify fdt@#
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>
2020-09-25 19:32:33 +02:00
Adrian Schmutzler fbd4214bb0 build: improve message for incompatible image on "legacy" devices
It has been reported that the current message displayed during
upgrade with compat_version change is misleading for "legacy"
devices, i.e. those without the "new" fwtool. This is partially
caused by the fact that we need to exploit the supported_devices
string to get some message text displayed for these devices.

This patch modifies the message to make it more helpful and
include additional information, e.g.

  Device linksys,wrt3200acm not supported by this image
  Supported devices: linksys,wrt3200acm linksys-whateverelse - Image
  version mismatch: image 1.1, device 1.0. Please wipe config during
  upgrade (force required) or reinstall. Reason: Config cannot be
  migrated from swconfig to DSA

Note that the line breaks (except the one before Supported devices)
are added manually here, I hesitate to hack \n into the
supported_devices as well. The "Reason:" will only be displayed if
DEVICE_COMPAT_MESSAGE is set for the device, otherwise
"Please check documentation ..." will be shown instead.

While at it, also rearrange the code in image-commands.mk to
make lines shorter and remove the double filter-out command.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-08 16:13:51 +02:00
Adrian Schmutzler 1d9542c50e build: image: return sizes if check-size fails
Instead of just printing a warning that an image is too big, also
print both actual size and limit in the string:

WARNING: Image file somename.bin is too big: 2096101 > 1048576

Since the kernel size is checked via the same function (if
KERNEL_SIZE is specified), this will also apply to the kernel
image size check.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-03 10:40:32 +02:00
Adrian Schmutzler 93d37fad86 build: image: drop unused check-kernel-size recipe
The recipe check-kernel-size is not used in the entire tree. Instead,
we already check the size of the kernel image in Device/Build/kernel
in image.mk via check-size function if KERNEL_SIZE is defined.

Therefore, drop the function. Using it would be redundant anyway.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-08-02 15:54:43 +02:00
Adrian Schmutzler 02d6ac1060 base-files: fwtool: make compat_version backward compatible
So far, the compatibility mechanism only works if both device and
image are already updated to the new routines. This patch extends
the sysupgrade metadata and fwtool_check_image() to account for
"older" images as well:

The basic mechanism for older devices to check for image compatibility
is the supported_devices entry. This can be exploited by putting
a custom message into this variable of the metadata, so older FW
will produce a mismatch and print the message as it thinks it's the
list of supported devices. So, we have two cases:

device 1.0, image 1.0:
  The metadata will just contain supported_devices as before.

device 1.0, image 1.1:
  The metadata will contain:

  "new_supported_devices":["device_string1", "device_string2", ...],
  "supported_devices":["Image version 1.1 incompatible to device: ..."]

  If the device is "legacy", i.e. does not have the updated fwtool.sh,
  it will just fail with image check and print the content of
  supported_devices. If DEVICE_COMPAT_MESSAGE is set, this will be
  printed on old devices as well through the same mechanism. Otherwise
  a generic "Please check documentation ..." is appended.

  Upgrade can still be performed with -F like when
  SUPPORTED_DEVICES has been removed to prevent bricking.

  If the device has updated fwtool.sh (but is 1.0), it will just use
  the new_supported_devices instead, and work as intended (flashing
  with -n will work, flashing without will print the appropriate
  warning).

This mechanism should provide a fair tradeoff between simplicity
and functionality.

Since we touched a lot of fields in metadata, this also bumps
metadata_version to 1.1.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-07-31 11:40:15 +02:00
Adrian Schmutzler 6867d86e08 build: add DEVICE_COMPAT_VERSION and DEVICE_COMPAT_MESSAGE
We regularly encounter the situation that devices are subject to
changes that will make them incompatible to previous versions.
Removing SUPPORTED_DEVICES will not really be helpful in most of these
cases, as this only helps after a rename.

To solve this situation, this patchset introduces a compatibility
version for devices. It will be implemented via a per-device
Make variable DEVICE_COMPAT_VERSION, which will be set to 1.0
globally by default and then can be overwritten as needed.

Furthermore, a variable DEVICE_COMPAT_MESSAGE is added, where
a message to be displayed during sysupgrade may be specified
optionally.

This patch only implements the build variables and adds them
to the sysupgrade metadata, the evaluation will be addressed
in a subsequent patch.

To set it, one would just need to add the following to a device node:

define Device/somedevice
  ...
  DEVICE_COMPAT_VERSION := 1.1
  DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
endef

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2020-07-31 11:40:15 +02:00
Sungbo Eo 1444e31a7b build: image: set default parameter for check-size
In most cases check-size is used with IMAGE_SIZE and vice versa. Let check-size
use IMAGE_SIZE by default.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
2020-03-21 19:59:08 +01:00
Paul Spooren 33cc7e763b x86: use qemu-image command from image-commands.mk
The `qemu-image` command converts images to the specified type and
reduces redundant code.

Adaption from Alexander Couzens <lynxis@fe80.eu> work[0].

[0]: https://git.openwrt.org/?p=openwrt/staging/lynxis.git;a=blob;f=target/linux/x86/image/Makefile;h=83b8140b7aefbe708fd09c9c61827e7e39bda8b4;hb=416cccf398e9589e3de386e05b61b1c46cace20d#l51

Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-03-21 10:36:00 +00:00
Jeff Kletsky f0b76d02e8 build: define check-kernel-size to remove unflashable images
Certain boards have limitations on U-Boot that prevent flashing
of images where the kernel size exceeds a threshold, yet
sysupgrade can sucessfully manage larger kernels. The current
check-size will remove the target artifact if its total size
exceeds the threshold. If applied after append-kernel,
it will remove the kernel, but the remaining image-assembly
steps will continue, resulting in an image without a kernel
that is likely unbootable.

By defining check-kernel-size, it is now possible to prevent release
of such unbootable images through a construct similar to:

  IMAGE/factory.img := append-kernel | pad-to $$$$(GL_UBOOT_UBI_OFFSET) | \
    append-ubi | check-kernel-size $$$$(GL_UBOOT_UBI_OFFSET)

Cc: Chuanhong Guo <gch981213@gmail.com>

Signed-off-by: Jeff Kletsky <git-commits@allycomm.com>
2020-01-15 20:05:48 +01:00
Adrian Schmutzler 9b0e8d0aa4 treewide: move mktplinkfw to tplink-v1-image in image-commands.mk
This move the slightly different target-specific implementations of
mktplinkfw from the targets to include/image-commands.mk and renames
it to tplink-v1-image. Having a common version will increase
consistency between implementation and will complete the
tplink build command already present in the new location.

Due to the slight differences of the original implementations, this
also does some adjustments to the device build commands/variables.

This also moves rootfs_align as this is required as dependency.

Tested on:
- TL-WDR4300 v1 (ath79, factory)
- TL-WDR4900 v1 (mpc85xx, sysupgrade)
- RE210 v1 (ramips, see Tested-by)

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
Tested-by: Christoph Krapp <achterin@googlemail.com>
2020-01-08 16:15:29 +01:00
John Crispin f4aaee01fa Revert "build: separate signing logic"
This reverts commit 4a45e69d19.

This broke the buildbots

Signed-off-by: John Crispin <john@phrozen.org>
2019-10-21 16:26:24 +02:00
Paul Spooren 4a45e69d19 build: separate signing logic
This separates the options for signature creation and verification

* SIGNED_PACKAGES create Packages.sig
* SIGNED_IMAGES add ucert signature to created images
* CHECK_SIGNATURE add verification capabilities to images
* INSTALL_LOCAL_KEY add local key-build to /etc/opkg/keys

Right now the buildbot.git contains some hacks to create images that
have signature verification capabilities while not storing private keys
on buildbot slaves. This commit allows to disable these steps for the
buildbots and only perform signing on the master.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2019-10-21 14:06:42 +02:00
Michal Cieslakiewicz f46a4a9293 image: add magic number option for append-uImage-fakehdr
'append-uImage-fakehdr' can now accept magic number as a second, optional
parameter (passed directly to 'mkimage' command with '-M' option). This
enables construction of proper Netgear-specific fake rootfs images
(required for flashing WNDR4300 for example).

Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
2019-10-21 13:27:12 +02:00
Yousong Zhou a75801c89c build: install-dtb: fix race condition when copying dtb
Currently for at91 target, Build/install-dtb can be triggered concurrently for
multiple different TARGET_FILESYSTEMS, cp command can fail when the
target file is already open exclusively by other cp process

	[ -f /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/at91sam9263ek-uImage -a -f /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/root.ubifs+fs=-m_2048_-e_126KiB_-c_2048+pkg=68b329da ]
	[ -f /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/at91sam9263ek-uImage -a -f /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/root.ext4+pkg=68b329da ]
	cp -fpR /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/linux-4.14.141/arch/arm/boot/dts/at91sam9263ek.dtb /builder/shared-workdir/build/bin/targets/at91/sam9x/openwrt-at91-sam9x-at91sam9263ek.dtb;
	cp -fpR /builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/linux-4.14.141/arch/arm/boot/dts/at91sam9263ek.dtb /builder/shared-workdir/build/bin/targets/at91/sam9x/openwrt-at91-sam9x-at91sam9263ek.dtb;
	cp: cannot create regular file '/builder/shared-workdir/build/bin/targets/at91/sam9x/openwrt-at91-sam9x-at91sam9263ek.dtb': File exists
	Makefile:87: recipe for target '/builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/tmp/openwrt-at91-sam9x-at91sam9263ek-ubifs-dtb' failed
	make[4]: *** [/builder/shared-workdir/build/build_dir/target-arm_arm926ej-s_musl_eabi/linux-at91_sam9x/tmp/openwrt-at91-sam9x-at91sam9263ek-ubifs-dtb] Error 1

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2019-09-15 14:58:43 +00:00
Adrian Schmutzler 7e5a0da642 build: fix indent in image-commands.mk
Convert leading spaces to tab to match rest of the file.

Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2019-08-17 16:43:22 +02:00
Petr Štetiar 97833a57ef build: image: add pad-to and pad-rootfs-squashfs helpers
For better reusability.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
2019-06-25 14:12:22 +00:00
Paul Spooren 7fa9794c4c metadata: add "metadata_version" field
allow downstream projects to see the current version of the metadata,
usefull if eventually more variables change

Signed-off-by: Paul Spooren <mail@aparcar.org>
2019-03-06 01:11:54 +01:00
Paul Spooren 208f287908 metadata: add "target" entry
add "target" entry based on $(TARGETID) resulting in
`<target>/<subtarget>`.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2019-03-06 01:11:54 +01:00
Paul Spooren 26c16aec67 metadata: fixup "board"
currently the "board" parameter contains $(BOARD) which actually results
to `<target>` (like ramips, ar71xx) without subtarget. However, one
actually excepts (not?) to contain BOARD_NAME or DEVICE_NAME.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2019-03-06 01:11:54 +01:00
Piotr Dymacz fe90e48c39 build: qsdk-ipq-*: include dtc in PATH before calling mkimage
Use 'dtc' from kernel sources instead of relying on host tool.

Fixes: bf4630e5ad ("build: add helpers for generating QSDK sysupgrade compatible images")
Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2019-02-26 13:38:47 +01:00
Piotr Dymacz bf4630e5ad build: add helpers for generating QSDK sysupgrade compatible images
Qualcomm SDK (QSDK) sysupgrade compatible images for IPQ40xx, IPQ806x
and IPQ807x use FIT format together with 'dumpimage' tool from U-Boot
for verifying and extracting them. Based on 'images' sections names,
corresponding mtd partitions are flashed. For example, in case of
NOR-only boards, below mapping is used (section name -> mtd name):

  hlos*   -> 0:HLOS
  rootfs* -> rootfs

And for boards with NAND (kernel inside UBI):

  ubi* -> rootfs

Above mappings come from unmodified QSDK sources and might be wrong for
boards running custom or modified QSDK-based firmware. Some of vendors
adjust them to meet their modified mtd layout or features like recovery
or dual-image support.

This adds simple script 'mkits-qsdk-ipq-image.sh' (based on 'mkits.sh')
for generating FIT images tree source files, compatible with the QSDK
sysupgrade format. Resulting images can be used for initial (factory ->
OpenWrt) installation and would work both in CLI and GUI.

The script is universal in a way it allows to include as many sections
as needed. To make use of it, two generic/basic build recipes for NOR
and NAND based boards are also included in 'image-commands.mk':

  Build/qsdk-ipq-factory-nand
  Build/qsdk-ipq-factory-nor

Example usage for board with UBI in NAND:

  IMAGE/nand-factory.bin := append-ubi | qsdk-ipq-factory-nand

Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
2019-02-25 17:36:16 +01:00
Oever González 892d741259 build: add a script for generating Linksys factory images
This commit adds the 'Build/linksys-image' rule and the
'linksys-image.sh' script to the build system.

This change is needed for generating factory images for the Linksys
EA6350v3 device. Without this patch, only valid sysupgrade images can be
generated. With this patch, users can flash the device without the
need of physical access or disassembly.

Signed-off-by: Ryan Pannell <ryan@osukl.com>
Signed-off-by: Oever González <notengobattery@gmail.com>
2019-01-26 21:43:07 +01:00
Mathias Kresin 26a016731d firmware-utils: mksercommfw: overhaul image creation
Move the zip compression into a build recipe. Pad the image using the
existing build recipes as well to remove duplicate functionality

Change the code to append header and footer in two steps. Allow to use a
fixed filename as the netgear update image does.

Use a fixed timestamp within the zip archive to make the images
reproducible.

Due to the changes we are now compatible to the gnu89 c standard used by
default on the buildbots and we don't need to force a more recent
standard anymore.

Beside all changes, the footer still looks wrong in compare to the
netgear update image.

Signed-off-by: Mathias Kresin <dev@kresin.me>
2019-01-15 19:11:54 +01:00
Mathias Kresin 6a3f8b8818 build: remove duplicate mksercomfw image recipe
Keep the ramips/mt76x8 copy, since it's only required for this target at
the moment.

Signed-off-by: Mathias Kresin <dev@kresin.me>
2019-01-13 18:31:10 +01:00
Mathias Kresin fd35c5b205 build: move seama commands to image-commands.mk
Move it to image-commands.mk to get rid of duplicate recipes.

Signed-off-by: Mathias Kresin <dev@kresin.me>
2018-12-30 20:08:13 +01:00