Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
20
target/linux/ipq40xx/image/Makefile
Normal file
20
target/linux/ipq40xx/image/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/image.mk
|
||||
|
||||
define Device/Default
|
||||
PROFILES := Default
|
||||
KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
|
||||
KERNEL_LOADADDR := 0x80208000
|
||||
DEVICE_DTS_DIR = $$(DTS_DIR)/qcom
|
||||
DEVICE_DTS = $$(SOC)-$(lastword $(subst _, ,$(1)))
|
||||
DEVICE_DTS_CONFIG := config@1
|
||||
IMAGES := sysupgrade.bin
|
||||
IMAGE/sysupgrade.bin = sysupgrade-tar | append-metadata
|
||||
IMAGE/sysupgrade.bin/squashfs :=
|
||||
DEVICE_COMPAT_VERSION := 1.1
|
||||
DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
|
||||
endef
|
||||
|
||||
include $(SUBTARGET).mk
|
||||
|
||||
$(eval $(call BuildImage))
|
||||
40
target/linux/ipq40xx/image/chromium.mk
Normal file
40
target/linux/ipq40xx/image/chromium.mk
Normal file
@@ -0,0 +1,40 @@
|
||||
define Build/cros-gpt
|
||||
cp $@ $@.tmp 2>/dev/null || true
|
||||
ptgen -o $@.tmp -g \
|
||||
-T cros_kernel -N kernel -p $(CONFIG_TARGET_KERNEL_PARTSIZE)m \
|
||||
-N rootfs -p $(CONFIG_TARGET_ROOTFS_PARTSIZE)m
|
||||
cat $@.tmp >> $@
|
||||
rm $@.tmp
|
||||
endef
|
||||
|
||||
define Build/append-kernel-part
|
||||
dd if=$(IMAGE_KERNEL) bs=$(CONFIG_TARGET_KERNEL_PARTSIZE)M conv=sync >> $@
|
||||
endef
|
||||
|
||||
# NB: Chrome OS bootloaders replace the '%U' in command lines with the UUID of
|
||||
# the kernel partition it chooses to boot from. This gives a flexible way to
|
||||
# consistently build and sign kernels that always use the subsequent
|
||||
# (PARTNROFF=1) partition as their rootfs.
|
||||
define Build/cros-vboot
|
||||
$(STAGING_DIR_HOST)/bin/cros-vbutil \
|
||||
-k $@ -c "root=PARTUUID=%U/PARTNROFF=1" -o $@.new
|
||||
@mv $@.new $@
|
||||
endef
|
||||
|
||||
define Device/google_wifi
|
||||
DEVICE_VENDOR := Google
|
||||
DEVICE_MODEL := WiFi (Gale)
|
||||
SOC := qcom-ipq4019
|
||||
KERNEL_SUFFIX := -fit-zImage.itb.vboot
|
||||
KERNEL = kernel-bin | fit none $$(KDIR)/image-$$(DEVICE_DTS).dtb | cros-vboot
|
||||
KERNEL_NAME := zImage
|
||||
IMAGES += factory.bin
|
||||
IMAGE/factory.bin := cros-gpt | append-kernel-part | append-rootfs
|
||||
# Note: Chromium/Depthcharge-based bootloaders insert a reserved-memory
|
||||
# ramoops node into the Device Tree automatically, so we can use
|
||||
# kmod-ramoops.
|
||||
DEVICE_PACKAGES := partx-utils mkf2fs e2fsprogs \
|
||||
kmod-fs-ext4 kmod-fs-f2fs kmod-google-firmware \
|
||||
kmod-ramoops
|
||||
endef
|
||||
TARGET_DEVICES += google_wifi
|
||||
1313
target/linux/ipq40xx/image/generic.mk
Normal file
1313
target/linux/ipq40xx/image/generic.mk
Normal file
File diff suppressed because it is too large
Load Diff
100
target/linux/ipq40xx/image/mikrotik.mk
Normal file
100
target/linux/ipq40xx/image/mikrotik.mk
Normal file
@@ -0,0 +1,100 @@
|
||||
define Device/mikrotik_nor
|
||||
DEVICE_VENDOR := MikroTik
|
||||
BLOCKSIZE := 64k
|
||||
IMAGE_SIZE := 16128k
|
||||
KERNEL_NAME := vmlinux
|
||||
KERNEL := kernel-bin | append-dtb-elf
|
||||
IMAGES = sysupgrade.bin
|
||||
IMAGE/sysupgrade.bin := append-kernel | yaffs-filesystem -L | \
|
||||
pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \
|
||||
check-size | append-metadata
|
||||
endef
|
||||
|
||||
define Device/mikrotik_nand
|
||||
DEVICE_VENDOR := MikroTik
|
||||
KERNEL_NAME := vmlinux
|
||||
KERNEL_INITRAMFS := kernel-bin | append-dtb-elf
|
||||
KERNEL := kernel-bin | append-dtb-elf | package-kernel-ubifs | \
|
||||
ubinize-kernel
|
||||
IMAGES := sysupgrade.bin
|
||||
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
|
||||
endef
|
||||
|
||||
define Device/mikrotik_cap-ac
|
||||
$(call Device/mikrotik_nor)
|
||||
DEVICE_MODEL := cAP ac
|
||||
SOC := qcom-ipq4018
|
||||
DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_cap-ac
|
||||
|
||||
define Device/mikrotik_hap-ac2
|
||||
$(call Device/mikrotik_nor)
|
||||
DEVICE_MODEL := hAP ac2
|
||||
SOC := qcom-ipq4018
|
||||
DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_hap-ac2
|
||||
|
||||
define Device/mikrotik_hap-ac3
|
||||
$(call Device/mikrotik_nand)
|
||||
DEVICE_MODEL := hAP ac3
|
||||
SOC := qcom-ipq4019
|
||||
BLOCKSIZE := 128k
|
||||
PAGESIZE := 2048
|
||||
KERNEL_UBIFS_OPTS = -m $$(PAGESIZE) -e 124KiB -c $$(PAGESIZE) -x none
|
||||
DEVICE_PACKAGES := kmod-ledtrig-gpio
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_hap-ac3
|
||||
|
||||
define Device/mikrotik_hap-ac3-lte6-kit
|
||||
$(call Device/mikrotik_nor)
|
||||
DEVICE_MODEL := hAP ac3 LTE6 kit
|
||||
SOC := qcom-ipq4019
|
||||
DEVICE_PACKAGES := kmod-ledtrig-gpio kmod-usb-acm kmod-usb-net-rndis
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_hap-ac3-lte6-kit
|
||||
|
||||
define Device/mikrotik_lhgg-60ad
|
||||
$(call Device/mikrotik_nor)
|
||||
DEVICE_MODEL := Wireless Wire Dish LHGG-60ad
|
||||
DEVICE_DTS := qcom-ipq4019-lhgg-60ad
|
||||
DEVICE_PACKAGES += -kmod-ath10k-ct -ath10k-firmware-qca4019-ct kmod-wil6210
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_lhgg-60ad
|
||||
|
||||
define Device/mikrotik_sxtsq-5-ac
|
||||
$(call Device/mikrotik_nor)
|
||||
DEVICE_MODEL := SXTsq 5 ac (RBSXTsqG-5acD)
|
||||
SOC := qcom-ipq4018
|
||||
DEVICE_PACKAGES := rssileds
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_sxtsq-5-ac
|
||||
|
||||
define Device/mikrotik_wap-ac
|
||||
$(call Device/mikrotik_nor)
|
||||
DEVICE_MODEL := wAP ac
|
||||
SOC := qcom-ipq4018
|
||||
DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_wap-ac
|
||||
|
||||
define Device/mikrotik_wap-r-ac
|
||||
$(call Device/mikrotik_wap-ac)
|
||||
DEVICE_MODEL := wAP R ac
|
||||
DEVICE_PACKAGES := kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi \
|
||||
kmod-usb-acm kmod-usb-net-rndis
|
||||
DEVICE_DTS := qcom-ipq4018-wap-r-ac
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_wap-r-ac
|
||||
|
||||
define Device/mikrotik_wap-ac-lte
|
||||
$(call Device/mikrotik_wap-ac)
|
||||
DEVICE_MODEL := wAP ac LTE
|
||||
DEVICE_PACKAGES := kmod-usb-net-qmi-wwan kmod-usb-serial-option uqmi \
|
||||
kmod-usb-acm kmod-usb-net-rndis
|
||||
DEVICE_DTS := qcom-ipq4018-wap-ac-lte
|
||||
DEVICE_ALT0_VENDOR = Mikrotik
|
||||
DEVICE_ALT0_MODEL := wAP ac LTE6
|
||||
endef
|
||||
TARGET_DEVICES += mikrotik_wap-ac-lte
|
||||
89
target/linux/ipq40xx/image/netgear-fit-padding.py
Executable file
89
target/linux/ipq40xx/image/netgear-fit-padding.py
Executable file
@@ -0,0 +1,89 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: MIT
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# NETGEAR EX6150v2 padding tool
|
||||
# (c) 2024 David Bauer <mail@david-bauer.net>
|
||||
|
||||
import math
|
||||
import sys
|
||||
|
||||
FLASH_BLOCK_SIZE = 64 * 1024
|
||||
|
||||
|
||||
def read_field(data, offset):
|
||||
return data[offset + 3] | data[offset + 2] << 8 | data[offset + 1] << 16 | data[offset] << 24
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print('Usage: {} <input-image> <output-image>'.format(sys.argv[0]))
|
||||
sys.exit(1)
|
||||
|
||||
with open(sys.argv[1], 'rb') as f:
|
||||
data = f.read()
|
||||
|
||||
file_len = len(data)
|
||||
|
||||
# File-len in fdt header at offset 0x4
|
||||
file_len_hdr = read_field(data, 0x4)
|
||||
# String offset in fdt header at offset 0xc
|
||||
str_off = read_field(data, 0xc)
|
||||
|
||||
print("file_len={} hdr_file_len={} str_off={}".format(file_len, file_len_hdr, str_off))
|
||||
|
||||
# Off to NETGEAR calculations - Taken from u-boot source (cmd_dni.c:2145)
|
||||
#
|
||||
# rootfs_addr = (ntohl(hdr->ih_size)/CONFIG_SYS_FLASH_SECTOR_SIZE+1) * CONFIG_SYS_FLASH_SECTOR_SIZE +
|
||||
# 2*sizeof(image_header_t)-sizeof(image_header_t);
|
||||
# rootfs_addr = rootfs_addr - (0x80 - mem_addr);
|
||||
|
||||
# NETGEAR did fuck up badly. The image uses a FIT header, while the calculation is done on a legacy header
|
||||
# assumption. 'ih_size' matches 'off_dt_strings' of a fdt_header.
|
||||
# From my observations, this seems to be fixed on newer bootloader versions.
|
||||
# However, we need to be compatible with both.
|
||||
|
||||
# This presents a challenge: FDT_STR might end short of a block boundary, colliding with the rootfs_addr
|
||||
#
|
||||
# Our dirty solution:
|
||||
# - Move the string_table to match a block_boundary.
|
||||
# - Update the total file_len to end on 50% of a block boundary.
|
||||
#
|
||||
# This ensures all netgear calculations will be correct, regardless whether they are done based on the
|
||||
# 'off_dt_strings' or 'totalsize' fields of a fdt header.
|
||||
|
||||
new_dt_strings = int((math.floor(file_len / FLASH_BLOCK_SIZE) + 2) * FLASH_BLOCK_SIZE)
|
||||
new_image_len = int(new_dt_strings + (FLASH_BLOCK_SIZE / 2))
|
||||
new_file_len = int(new_dt_strings + FLASH_BLOCK_SIZE - 64)
|
||||
print(f"new_file_len={new_file_len} new_hdr_file_len={new_image_len} new_str_offset={new_dt_strings}")
|
||||
|
||||
# Convert data to bytearray
|
||||
data = bytearray(data)
|
||||
|
||||
# Enlarge byte-array to new size
|
||||
data.extend(bytearray(new_file_len - file_len))
|
||||
|
||||
# Assert that the new and old string-tables are at least 256 bytes apart.
|
||||
# We pad by two blocks, but let's be extra sure.
|
||||
assert new_dt_strings - str_off >= 256
|
||||
|
||||
# Move the string table to the new offset
|
||||
for i in range(0, 256):
|
||||
data[new_dt_strings + i] = data[str_off + i]
|
||||
data[str_off + i] = 0
|
||||
|
||||
# Update the string offset in the header
|
||||
data[0xc] = (new_dt_strings >> 24) & 0xFF
|
||||
data[0xd] = (new_dt_strings >> 16) & 0xFF
|
||||
data[0xe] = (new_dt_strings >> 8) & 0xFF
|
||||
data[0xf] = new_dt_strings & 0xFF
|
||||
|
||||
# Update the file length in the header
|
||||
data[0x4] = (new_image_len >> 24) & 0xFF
|
||||
data[0x5] = (new_image_len >> 16) & 0xFF
|
||||
data[0x6] = (new_image_len >> 8) & 0xFF
|
||||
data[0x7] = new_image_len & 0xFF
|
||||
|
||||
# Write the new file
|
||||
with open(sys.argv[1] + '.new', 'wb') as f:
|
||||
f.write(data)
|
||||
Reference in New Issue
Block a user