Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mediatek: filogic: wax220: support factory image #13015

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,35 @@
# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause

rootfs_create() {
local blocks

blocks=$(cat /sys/class/ubi/ubi0/avail_eraseblocks)
[ -z "$blocks" ] && {
echo "Failed to read amount of available erase blocks" >&2
return
}

# Delete after getting available blocks: Make sure enough space is
# left to recreate these volumes.
ubirmvol /dev/ubi0 -N kernel_backup
ubirmvol /dev/ubi0 -N rootfs_backup

# Use 90% of remaining flash size for "rootfs_data"
ubimkvol /dev/ubi0 -n 20 -N rootfs_data --lebs $((blocks / 100 * 90))
mknod -m 0600 /dev/ubi0_20 c 250 21
}

rootfs_prepare() {
case $(board_name) in
netgear,wax220)
if ! ubinfo /dev/ubi0 -N rootfs_data &>/dev/null; then
echo "Creating \"rootfs_data\" UBI volume"
rootfs_create
fi
;;
*)
;;
esac
}

boot_hook_add preinit_main rootfs_prepare
16 changes: 9 additions & 7 deletions target/linux/mediatek/image/filogic.mk
Expand Up @@ -202,18 +202,20 @@ endef
TARGET_DEVICES += h3c_magic-nx30-pro

define Device/netgear_wax220
DEVICE_VENDOR := Netgear
DEVICE_VENDOR := NETGEAR
DEVICE_MODEL := WAX220
DEVICE_DTS := mt7986b-netgear-wax220
DEVICE_DTS_DIR := ../dts
NETGEAR_ENC_MODEL := WAX220
NETGEAR_ENC_REGION := US
DEVICE_PACKAGES := kmod-mt7986-firmware mt7986-wo-firmware
IMAGES := sysupgrade.bin
KERNEL_IN_UBI := 1
KERNEL := kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
KERNEL_INITRAMFS := kernel-bin | lzma | \
fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
KERNEL_INITRAMFS_SUFFIX := -recovery.itb
IMAGE_SIZE := 32768k
IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
IMAGES += factory.img
# Padding to 10M seems to be required by OEM web interface
IMAGE/factory.img := sysupgrade-tar | \
pad-to 10M | check-size | netgear-encrypted-factory
endef
TARGET_DEVICES += netgear_wax220

Expand Down