Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
347 changes: 340 additions & 7 deletions .github/scripts/test_sysupgrade.sh

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,15 @@ endif
ifeq ($(BR2_TARGET_ROOTFS_UBI),y)
ifneq ($(filter $(BR2_OPENIPC_SOC_VENDOR),"rockchip" "sigmastar"),)
@$(call PREPARE_REPACK,,,rootfs.ubi,16384,nand)
else ifneq ($(wildcard $(PWD)/br-ext-chip-$(subst ",,$(BR2_OPENIPC_SOC_VENDOR))/board/$(subst ",,$(BR2_OPENIPC_SOC_FAMILY))/nand-fit.its),)
# FIT NAND (board/<family>/nand-fit.its): the kernel lives in the `kernel` UBI
# volume, so the package carries what sysupgrade writes into each volume --
# fitImage and rootfs.ubifs -- and rootfs.ubi for a fresh install. Measured
# against the volume sizes in the board's ubinize-nand.cfg.
@$(call CHECK_SIZE,fitImage,4096)
@$(call CHECK_SIZE,rootfs.ubifs,32768)
@$(call CHECK_SIZE,rootfs.ubi,16384)
Comment thread
widgetii marked this conversation as resolved.
@$(call REPACK_NAND_FIT)
else
@$(call PREPARE_REPACK,uImage,4096,rootfs.ubi,16384,nand)
endif
Expand Down Expand Up @@ -318,3 +327,18 @@ define REPACK_FIRMWARE
cd $(TARGET)/images && tar -czf $(ARCHIVE) $(KERNEL_MD5) $(ROOTFS_MD5) $(KERNEL) $(ROOTFS)
rm -f $(TARGET)/images/*.md5sum
endef

# The FIT NAND package: three images, so not REPACK_FIRMWARE's two. Copies
# rather than renames -- rootfs.ubifs stays where buildroot left it, and the
# NOR package built from the same tree does not share any of these names.
NAND_FIT_IMAGES = fitImage rootfs.ubifs rootfs.ubi
define REPACK_NAND_FIT
cd $(TARGET)/images && for f in $(NAND_FIT_IMAGES); do \
cp -f $$f $$f.$(BR2_OPENIPC_SOC_MODEL) && \
md5sum $$f.$(BR2_OPENIPC_SOC_MODEL) > $$f.$(BR2_OPENIPC_SOC_MODEL).md5sum || exit 1; done
# Checksums first, as in REPACK_FIRMWARE.
cd $(TARGET)/images && tar -czf openipc.$(BR2_OPENIPC_SOC_MODEL)-nand-$(BR2_OPENIPC_VARIANT).tgz \
$(foreach f,$(NAND_FIT_IMAGES),$(f).$(BR2_OPENIPC_SOC_MODEL).md5sum) \
$(foreach f,$(NAND_FIT_IMAGES),$(f).$(BR2_OPENIPC_SOC_MODEL))
rm -f $(TARGET)/images/*.md5sum
endef
23 changes: 21 additions & 2 deletions br-ext-chip-goke/board/gk7205v500/gk7205v500.generic.config
Original file line number Diff line number Diff line change
Expand Up @@ -485,13 +485,16 @@ CONFIG_HAVE_MEMBLOCK=y
CONFIG_NO_BOOTMEM=y
# CONFIG_HAVE_BOOTMEM_INFO_NODE is not set
CONFIG_SPLIT_PTLOCK_CPUS=4
# CONFIG_COMPACTION is not set
CONFIG_COMPACTION=y
CONFIG_MIGRATION=y
# CONFIG_PHYS_ADDR_T_64BIT is not set
# CONFIG_KSM is not set
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
CONFIG_NEED_PER_CPU_KM=y
# CONFIG_CLEANCACHE is not set
# CONFIG_CMA is not set
CONFIG_CMA=y
# CONFIG_CMA_DEBUG is not set
CONFIG_CMA_AREAS=77
# CONFIG_ZPOOL is not set
# CONFIG_ZBUD is not set
# CONFIG_ZSMALLOC is not set
Expand Down Expand Up @@ -2849,3 +2852,19 @@ CONFIG_ARCH_HAS_SG_CHAIN=y
CONFIG_SBITMAP=y
# CONFIG_VIRTUALIZATION is not set
# CONFIG_GCC_PLUGINS is not set

#
# CMA for the media stack (xm_osal mmz_allocator=cma): the kernel reserves the
# zone named by mmz= on the command line (drivers/xmedia/cma) and, with
# CMA_MEM_SHARED, lends it to movable pages while the MMZ does not need it, so
# Linux can be given the whole DDR (mem=${totalmem}) as on gk7205v200.
#
CONFIG_DMA_CMA=y
CONFIG_CMA_SIZE_MBYTES=0
CONFIG_CMA_SIZE_SEL_MBYTES=y
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SIZE_SEL_MIN is not set
# CONFIG_CMA_SIZE_SEL_MAX is not set
CONFIG_CMA_ALIGNMENT=8
CONFIG_CMA_MEM_SHARED=y
# CONFIG_CMA_ADVANCE_SHARE is not set
51 changes: 51 additions & 0 deletions br-ext-chip-goke/board/gk7205v500/nand-fit.its
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/dts-v1/;

/*
* Kernel volume of the gk7205v500-family NAND image: the zImage and its DTB,
* each hashed so U-Boot refuses a kernel that NAND has corrupted instead of
* booting it. Built by general/scripts/rootfs_script.sh (the "NAND FIT" step)
* from the kernel tree, before ubinize packs it into the `kernel` volume.
*
* No fdt load address: u-boot-xmedia relocates the DTB under bootm_size,
* inside the kernel's lowmem.
*/
/ {
/* "OpenIPC <soc>": sysupgrade's SoC check reads it (fit_soc). @SOC@ is
filled in from OPENIPC_SOC_MODEL when the FIT is built. */
description = "OpenIPC @SOC@";
#address-cells = <1>;

images {
kernel {
description = "Linux";
data = /incbin/("zImage");
type = "kernel";
arch = "arm";
os = "linux";
compression = "none";
load = <0x40008000>;
entry = <0x40008000>;
hash-1 { algo = "crc32"; };
hash-2 { algo = "sha1"; };
};

fdt {
description = "xm720xxx-demb";
data = /incbin/("xm720xxx-demb.dtb");
type = "flat_dt";
arch = "arm";
compression = "none";
hash-1 { algo = "crc32"; };
hash-2 { algo = "sha1"; };
};
};

configurations {
default = "conf-1";
conf-1 {
description = "Linux + xm720xxx-demb";
kernel = "kernel";
fdt = "fdt";
};
};
};
30 changes: 30 additions & 0 deletions br-ext-chip-goke/board/gk7205v500/ubinize-nand.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# gk7205v500-family NAND: kernel (FIT) + rootfs (UBIFS) + rootfs_data.
# Boots with u-boot-xmedia's FIT NAND env: `ubi read ${baseaddr} kernel; bootm`
# and root=ubi0:rootfs. sysupgrade rewrites `kernel` and `rootfs` in place
# with ubiupdatevol, so their sizes are the ceiling for future images.
[kernel]
mode=ubi
vol_id=0
vol_type=dynamic
vol_name=kernel
vol_alignment=1
vol_size=4MiB
image=BINARIES_DIR/fitImage

[rootfs]
mode=ubi
vol_id=1
vol_type=dynamic
vol_name=rootfs
vol_alignment=1
vol_size=32MiB
image=BR2_ROOTFS_UBIFS_PATH

[rootfs_data]
mode=ubi
vol_id=2
vol_type=dynamic
vol_name=rootfs_data
vol_alignment=1
vol_size=2MiB
vol_flags=autoresize
2 changes: 1 addition & 1 deletion br-ext-chip-goke/configs/gk7205v500_ultimate_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ BR2_TARGET_ROOTFS_SQUASHFS4_XZ=y
BR2_TARGET_ROOTFS_UBI=y
BR2_TARGET_ROOTFS_UBI_SUBSIZE=2048
BR2_TARGET_ROOTFS_UBI_USE_CUSTOM_CONFIG=y
BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL)/scripts/ubifs/ubinize.cfg"
BR2_TARGET_ROOTFS_UBI_CUSTOM_CONFIG_FILE="$(EXTERNAL_VENDOR)/board/$(OPENIPC_SOC_FAMILY)/ubinize-nand.cfg"
BR2_TARGET_ROOTFS_UBIFS_LEBSIZE=0x1f000

# OpenIPC
Expand Down
6 changes: 6 additions & 0 deletions general/overlay/etc/inittab
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ console::respawn:/sbin/getty -L console 0 vt100
# Stuff to do before rebooting
::shutdown:/etc/init.d/rcK
::shutdown:/bin/umount -a -f

# SIGQUIT: run the shutdown actions above, kill every process, exec /sbin/init.
# sysupgrade relies on it to rewrite a mounted UBIFS volume: it pivots into a
# RAM root whose /sbin/init is its flash phase, so PID 1 itself leaves the
# flash and the volume can be released (see need_handoff in sysupgrade).
::restart:/sbin/init
14 changes: 12 additions & 2 deletions general/overlay/init
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,18 @@ grep -qE 'root=[^ ]*(nfs|mmcblk|ram)' /proc/cmdline && is_flash_root=false
grep -qE 'root=[^ ]*nfs' /proc/cmdline && is_nfs_root=true

if $is_flash_root; then
if grep -q ubifs /proc/cmdline; then
mount -t ubifs ubi0:rootfs_data /overlay
# A UBI root -- a UBIFS rootfs, or a squashfs through ubiblock -- keeps its
# overlay in the rootfs_data UBI volume, as UBIFS. A ubiblock command line
# names no ubifs, and the jffs2 branch below would find gluebi's mtd for
# that volume, fail to mount jffs2 on it and erase it: the overlay and the
# camera's claim with it.
if grep -q ubifs /proc/cmdline || grep -qE 'root=/dev/ubiblock' /proc/cmdline; then
# Settings in RAM rather than a camera that does not boot: a volume that
# will not mount as UBIFS must not take PID 1 down with it.
if ! mount -t ubifs ubi0:rootfs_data /overlay && ! mount -t tmpfs tmpfs /overlay; then
echo "Cannot mount overlay."
exit 1
fi
else
mtdblkdev=$(awk -F ':' '/rootfs_data/ {print $1}' /proc/mtd | sed 's/mtd/mtdblock/')
mtdchrdev=$(grep 'rootfs_data' /proc/mtd | cut -d: -f1)
Expand Down
Loading
Loading