[PATCH v1 05/11] mtd: rawnand: meson: move some defines to dedicated header
We need these values and macro to correctly write "bootloader" partition in Optimus protocol, so let's export them to arch-meson header and also provide more detailed information about each macro. Signed-off-by: Arseniy Krasnov <avkrasnov@...> --- arch/arm/include/asm/arch-meson/rawnand.h | 38 +++++++++++++++++++++++ drivers/mtd/nand/raw/meson_nand.c | 13 +------- 2 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 arch/arm/include/asm/arch-meson/rawnand.h diff --git a/arch/arm/include/asm/arch-meson/rawnand.h b/arch/arm/include/asm/arch-meson/rawnand.h new file mode 100644 index 00000000000..81bf6ef7e37 --- /dev/null +++ b/arch/arm/include/asm/arch-meson/rawnand.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * (C) Copyright 2025 SaluteDevices, Inc. + */ + +#ifndef __MESON_RAWNAND_H__ +#define __MESON_RAWNAND_H__ + +#include <asm/arch/nand.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/rawnand.h> + +/* M2N means 'memory to NAND', e.g. write. */ +#define NFC_CMD_M2N ((0 << 17) | BIT(21)) +/* N2M means 'NAND to memory', e.g. read. */ +#define NFC_CMD_N2M ((1 << 17) | BIT(21)) + +/* + * Macro to create value for read/write command. + * + * 'cmd_dir' - direction, e.g. read or write. + * 'ran' - scrambler mode (enabled or not). + * 'bch' - ECC mode (strength and size). + * 'short_mode' - short mode (enabled or not). + * 'page_size' - size of page. + * 'pages' - number of pages to access. + */ +#define CMDRWGEN(cmd_dir, ran, bch, short_mode, page_size, pages) \ + ( \ + (cmd_dir) | \ + ((ran)) | \ + ((bch) << 14) | \ + ((short_mode) << 13) | \ + (((page_size) & 0x7F) << 6) | \ + ((pages) & 0x3F) \ + ) + +#endif diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 28c851f103b..81122315f45 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -11,6 +11,7 @@ #include <nand.h> #include <asm/io.h> +#include <asm/arch/rawnand.h> #include <dm.h> #include <dm/device_compat.h> #include <dm/ofnode.h> @@ -34,8 +35,6 @@ #define NFC_CMD_AIL ((2 << 16) | (3 << 20)) #define NFC_CMD_AIH ((3 << 16) | (3 << 20)) #define NFC_CMD_SEED ((8 << 16) | (3 << 20)) -#define NFC_CMD_M2N ((0 << 17) | (2 << 20)) -#define NFC_CMD_N2M ((1 << 17) | (2 << 20)) #define NFC_CMD_RB BIT(20) #define NFC_CMD_SCRAMBLER_ENABLE BIT(19) #define NFC_CMD_SCRAMBLER_DISABLE 0 @@ -61,16 +60,6 @@ #define NFC_REG_PINS 0x30 #define NFC_REG_VER 0x38 -#define CMDRWGEN(cmd_dir, ran, bch, short_mode, page_size, pages) \ - ( \ - (cmd_dir) | \ - (ran) | \ - ((bch) << 14) | \ - ((short_mode) << 13) | \ - (((page_size) & 0x7f) << 6) | \ - ((pages) & 0x3f) \ - ) - #define GENCMDDADDRL(adl, addr) ((adl) | ((addr) & 0xffff)) #define GENCMDDADDRH(adh, addr) ((adh) | (((addr) >> 16) & 0xffff)) #define GENCMDIADDRL(ail, addr) ((ail) | ((addr) & 0xffff)) -- 2.30.1
|
[PATCH v1 04/11] usb: gadget: amlogic: common code for Amlogic flashing commands
Amlogic has Optimus and ADNL protocols to update firmware image. Both are operatable by special commands and such commands use same approaches, so let's implement such code before implementing both protocols. Signed-off-by: Arseniy Krasnov <avkrasnov@...> --- cmd/meson/gadget.c | 183 +++++++++++++++++++++++++++++++++++++++++++++ cmd/meson/gadget.h | 28 +++++++ 2 files changed, 211 insertions(+) create mode 100644 cmd/meson/gadget.c create mode 100644 cmd/meson/gadget.h diff --git a/cmd/meson/gadget.c b/cmd/meson/gadget.c new file mode 100644 index 00000000000..6155043ae5a --- /dev/null +++ b/cmd/meson/gadget.c @@ -0,0 +1,183 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2025 SaluteDevices, Inc. + * Author: Arseniy Krasnov <avkrasnov@...> + */ + +#include <hexdump.h> +#include <command.h> +#include <g_dnl.h> +#include <mtd.h> +#include <time.h> +#include <asm/arch/sm.h> +#include <asm/types.h> +#include <linux/delay.h> + +#define BURN_BOOT_UDELAY (2 * 1000 * 1000) +static unsigned long burn_identify_time_ms; +static unsigned long burn_start_time_ms; + +void amlogic_gadget_set_times(unsigned long start_time, unsigned long identify_time) +{ + burn_start_time_ms = start_time; + burn_identify_time_ms = identify_time; +} + +/* + * This function utilizes serial from inside Amlogic chip_id with one + * distinctive feature that this serial must be in big-endian. + * + * This is needed, because serial string, utilized in BootROM, must match + * the serial string, used inside U-Boot. But BootROM utilizes serial string + * in big-endian: being in BootROM try + * - for new SoCs (a1, s4, etc - those which utilize ADNL protocol): run + * host command 'fastboot devices' + * - for old SoCs (axg, g12a, g12b, etc - those, utilizing optimus protocol): + * send "chipid" command to bootROM + */ +static int amlogic_serial_hex(char serial_str[SM_SERIAL_SIZE * 2 + 1]) +{ + u8 serial[SM_SERIAL_SIZE]; + int ret; + + /* + * ADNL/OPTIMUS uses serial value in big-endian order. + * meson_sm_get_serial() returns exactly such value. + */ + ret = meson_sm_get_serial(serial, sizeof(serial)); + if (ret) + return ret; + + bin2hex(serial_str, serial, sizeof(serial)); + return ret; +} + +int amlogic_gadget_run(const char *mode, int argc, char *const argv[]) +{ + char serial_string[SM_SERIAL_SIZE * 2 + 1] = { 0 }; + unsigned long identify_timeout_ms; + unsigned long start_timeout_ms; + struct udevice *udc; + char *saved_serial; + int ret; + + if (mtd_probe_devices()) { + pr_err("Mtd devices probe failed\n"); + return CMD_RET_FAILURE; + } + + /* + * During ADNL/OPTIMUS burning process, device enters USB gadget mode + * twice: first time when it was stopped in ROM boot, second - + * here, after ROM and BL2 stages are done and we are ready + * to run BL33 (U-boot) stage. From the PC side, client waits + * reentering to USB gadget mode (in BL33 stage). Without delay + * below, PC client waits for USB device forever with the + * following message. + * + * OPTIMUS do not use timeout described below + * MSG[TLS]Waiting for DNL[<serial>] with timeout 0 + * + * At the same time, there is no difference (from the PC point + * of view) between USB device state with or w/o this delay, so + * seems this delay is needed only to make PC client work + * correctly due to is internal logic. + */ + udelay(BURN_BOOT_UDELAY); + + ret = amlogic_serial_hex(serial_string); + if (ret) + return CMD_RET_FAILURE; + + saved_serial = env_get("serial#"); + if (saved_serial) { + saved_serial = strdup(saved_serial); + if (!saved_serial) + return CMD_RET_FAILURE; + } + + /* + * Use "force" flag, because 'serial#' is protected + * from both delete and rewrite. This variable is used + * by USB gadget code as serial number of USB device. + */ + ret = run_commandf("env set -f serial# %s", serial_string); + if (ret) { + ret = CMD_RET_FAILURE; + goto exit_ret; + } + + amlogic_gadget_set_times(get_timer(0), 0); + + ret = udc_device_get_by_index(0, &udc); + if (ret) { + pr_err("Failed to get UDC device: %d\n", ret); + ret = CMD_RET_FAILURE; + goto exit_ret; + } + + g_dnl_clear_detach()
|
[PATCH v1 09/11] arm: meson: a1: ADNL protocol support
During ADNL protocol operations, BootROM may request to enter ADNL mode after boot. So to support this, let's check for values in sticky registers after boot (such registers could be updated earlier by boot ROM, telling U-boot to enter ADNL mode. Signed-off-by: Arseniy Krasnov <avkrasnov@...> --- arch/arm/include/asm/arch-meson/a1.h | 13 +++++++++++ arch/arm/mach-meson/board-a1.c | 32 +++++++++++++++++++++++++++- arch/arm/mach-meson/board-common.c | 17 +++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch-meson/a1.h b/arch/arm/include/asm/arch-meson/a1.h index 16e209ed932..4a22aaf5627 100644 --- a/arch/arm/include/asm/arch-meson/a1.h +++ b/arch/arm/include/asm/arch-meson/a1.h @@ -12,6 +12,7 @@ /* SYSCTRL registers */ #define A1_SYSCTRL_ADDR(off) (A1_SYSCTRL_BASE + ((off) << 2)) +#define A1_SYSCTRL_SEC_STATUS_REG1 A1_SYSCTRL_ADDR(0xc1) #define A1_SYSCTRL_SEC_STATUS_REG4 A1_SYSCTRL_ADDR(0xc4) /* * Checked during boot. Tells, that previous code, e.g. @@ -20,7 +21,19 @@ */ #define A1_SYSCTRL_SEC_STICKY_REG2 A1_SYSCTRL_ADDR(0xe2) +#define A1_AO_BOOT_DEVICE 0xF #define A1_SYSCTRL_MEM_SIZE_MASK 0xFFFF0000 #define A1_SYSCTRL_MEM_SIZE_SHIFT 16 +#if CONFIG_IS_ENABLED(ADNL) +/** + * is_tpl_loaded_from_usb - Checks, that this instance of U-boot was + * loaded from USB during firmware update + * process. + * + * returns: true, if so. + */ +int is_tpl_loaded_from_usb(void); +#endif + #endif /* __MESON_A1_H__ */ diff --git a/arch/arm/mach-meson/board-a1.c b/arch/arm/mach-meson/board-a1.c index f848c0f068e..9cc410f1e57 100644 --- a/arch/arm/mach-meson/board-a1.c +++ b/arch/arm/mach-meson/board-a1.c @@ -3,6 +3,7 @@ * (C) Copyright 2023 SberDevices, Inc. */ +#include <command.h> #include <asm/arch/a1.h> #include <asm/arch/boot.h> #include <asm/armv8/mmu.h> @@ -23,9 +24,38 @@ void meson_init_reserved_memory(__maybe_unused void *fdt) int meson_get_boot_device(void) { - return -ENOSYS; + return readl(A1_SYSCTRL_SEC_STATUS_REG4) & A1_AO_BOOT_DEVICE; } +#if CONFIG_IS_ENABLED(ADNL) + +static bool is_boot_device_usb(void) +{ + return meson_get_boot_device() == BOOT_DEVICE_USB; +} + +#define MESON_ADNL_BL1_USB_PROTO_DNL_BIT BIT(12) + +static bool is_bl1_usb_protocol_DNL(void) +{ + u32 val = readl(A1_SYSCTRL_SEC_STATUS_REG1); + + return !(val & MESON_ADNL_BL1_USB_PROTO_DNL_BIT); +} + +int is_tpl_loaded_from_usb(void) +{ + if (!is_boot_device_usb()) + return false; + + if (!is_bl1_usb_protocol_DNL()) + return false; + + return true; +} + +#endif + static struct mm_region a1_mem_map[] = { { .virt = 0x00000000UL, diff --git a/arch/arm/mach-meson/board-common.c b/arch/arm/mach-meson/board-common.c index 39774c43049..0624d557e40 100644 --- a/arch/arm/mach-meson/board-common.c +++ b/arch/arm/mach-meson/board-common.c @@ -3,6 +3,7 @@ * (C) Copyright 2016 Beniamino Galvani <b.galvani@...> */ +#include <command.h> #include <cpu_func.h> #include <fastboot.h> #include <init.h> @@ -14,9 +15,11 @@ #include <asm/ptrace.h> #include <linux/libfdt.h> #include <linux/err.h> +#include <asm/arch/a1.h> #include <asm/arch/mem.h> #include <asm/arch/sm.h> #include <asm/armv8/mmu.h> +#include <asm/io.h> #include <asm/unaligned.h> #include <efi_loader.h> #include <u-boot/crc.h> @@ -141,10 +144,24 @@ __weak int meson_board_late_init(void) return 0; } +static void meson_board_try_enter_adnl(void) +{ +#if (IS_ENABLED(CONFIG_CMD_ADNL)) + if (!is_tpl_loaded_from_usb()) + return; + + meson_sm_set_bl1_first_boot_source(SCPI_CMD_CLEAR_BOOT); + + run_command("adnl", 0); +#endif +} + int board_late_init(void) { meson_set_boot_source(); + meson_board_try_enter_adnl(); + return meson_board_late_init(); } -- 2.30.1
|
[GIT PULL] Please pull u-boot-amlogic-20250318 into next
2
Hi Tom, Here's a small set of changes for Amlogic SoC support. Thanks, Neil The following changes since commit 0e1fc465fea62ebae91f2f56cb823e8b37ee1077: Merge tag 'dm-pull-15mar25' of git://git.denx.de/u-boot-dm into next (2025-03-15 08:19:31 -0600) are available in the Git repository at: https://source.denx.de/u-boot/custodians/u-boot-amlogic.git tags/u-boot-amlogic-20250318 for you to fetch changes up to e80b586cfc73ee123dae42d5d85543798ff7a3c5: board: odroid-n2: Update docs for signing (2025-03-18 15:27:25 +0100) ---------------------------------------------------------------- - odroid-n2: Update docs for signing - support Amlogic chip_id v1 and v2 ---------------------------------------------------------------- Baltaz¨¢r Radics (1): board: odroid-n2: Update docs for signing Evgeny Bachinin (3): arm: meson: unify type being used for socinfo arm: meson: sm: get rid of SM_CHIP_ID_SIZE arch: arm: meson: support Amlogic chip_id v1 and v2 arch/arm/include/asm/arch-meson/boot.h | 14 ++++ arch/arm/include/asm/arch-meson/sm.h | 48 ++++++++++++- arch/arm/mach-meson/board-info.c | 13 ++-- arch/arm/mach-meson/sm.c | 120 ++++++++++++++++++++++++++++++--- doc/board/amlogic/odroid-n2.rst | 15 +---- 5 files changed, 182 insertions(+), 28 deletions(-)
|
[PATCH v1] mtd: rawnand: meson: always use OOB bytes during write
7
Hi Yes Michael <avkrasnov@...> wrote: -- Michael Nazzareno Trimarchi Co-Founder & Chief Executive Officer M. +39 347 913 2170 michael@... __________________________________ Amarula Solutions BV Joop Geesinkweg 125, 1114 AB, Amsterdam, NL T. +31 (0)85 111 9172 info@... www.amarulasolutions.com
|
[PATCH 2/2] tools: amlimage: Add support for GXBB eMMC header
7
GXBB BL1 only tries to read boot image from sector 0 on eMMC and sector 1 on SD-card. GXL and newer read boot image from sector 1 on both eMMC and SD-card. Vendor BL2 have solved the issue with different offsets by considering where BL2 was loaded from to adjust the offset where BL3 is read from. This provide a different solution to create a boot image that can be booted from both eMMC and SD-card and where the offset for reading next stage loader can be shared for both boot options. Inject code, that relocate the payload located at 0x1200 offset in TZRAM to the expected offset of 0x1000, into the padding area at offset 0x200 when a normal GXBB boot image is created. A special GXBB eMMC header can then be created that have the payload offset point to this relocate code, BL1 will jump to this relocate code when booted from eMMC instead of the normal payload start. One effect of this is that the payload size limit must be reduced by 512 bytes on GXBB. Example of how to use it: # Create a normal boot image tools/mkimage -T amlimage -n gxbb -d u-boot-spl.bin bl2.bin # Create a boot image with a special eMMC header tools/mkimage -T amlimage -n emmc -d bl2.bin bl2-emmc.bin # Write normal boot image to sector 1 of eMMC/SD-card dd if=bl2.bin of=/path/to/dev bs=512 seek=1 # Write eMMC header, 112 bytes, to start of eMMC dd if=bl2-emmc.bin of=/path/to/dev bs=1 count=112 Or with binman using something like: binman { multiple-images; u-boot-gxbb-sd { filename = "u-boot-gxbb-sd.bin"; pad-byte = <0xff>; mkimage { filename = "bl2.bin"; args = "-n", "gxbb", "-T", "amlimage"; u-boot-spl { }; }; }; u-boot-gxbb-emmc { filename = "u-boot-gxbb-emmc.bin"; pad-byte = <0xff>; mkimage { filename = "bl2-emmc.bin"; args = "-n", "emmc", "-T", "amlimage"; blob-ext { filename = "bl2.bin"; } }; }; }; Signed-off-by: Jonas Karlman <jonas@...> --- tools/amlimage-gxbb-relocate.c | 79 ++++++++++++++++++++++++++++++++++ tools/amlimage.c | 37 ++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 tools/amlimage-gxbb-relocate.c diff --git a/tools/amlimage-gxbb-relocate.c b/tools/amlimage-gxbb-relocate.c new file mode 100644 index 000000000000..3503805c460e --- /dev/null +++ b/tools/amlimage-gxbb-relocate.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright Contributors to the U-Boot project. + +/* + * The following commands can be used to reproduce the gxbb_relocate + * byte array in amlimage.c + * + * Start U-Boot CI docker container from U-Boot source code root folder: + * docker run --rm -v $(pwd):/build -u uboot -it docker.io/trini/u-boot-gitlab-ci-runner:jammy-20240911.1-08Dec2024 + * + * Run the following commands inside the docker container: + * export PATH=/opt/gcc-13.2.0-nolibc/aarch64-linux/bin:$PATH + * cd /build/tools + * + * Generate assembly code for the c code in this file: + * aarch64-linux-gcc -nostdlib -ffreestanding -Os -S -o amlimage-gxbb-relocate.S amlimage-gxbb-relocate.c + * + * Manually remove 'mov x16, x2' and replace 'x16' with 'x2' on the last line. + * + * Compile assembly code and extract the AArch64 binary code: + * aarch64-linux-as -o amlimage-gxbb-relocate.o amlimage-gxbb-relocate.S + * aarch64-linux-objcopy -O binary -j .text amlimage-gxbb-relocate.o amlimage-gxbb-relocate.bin + * + * Print binary code as a byte array that can be copied into amlimage.c + * hexdump -ve '1/1 "0x%.2x, "' amlimage-gxbb-relocate.bin | fold -w 72 && echo + * + * Remember to update assembly code below when byte array is updated. + */ + +#include <stdint.h> + +#define TZRAM_BASE 0xd9000000 +#define PAYLOAD_OFFSET 0x200 +#define BL2_OFFSET 0x1000 +#define BL2_BASE (void *)(TZRAM_BASE + BL2_OFFSET) +#define BL2_SIZE 0xb000 + +void _start(uint64_t x0, uint64_t x1) +{ + void (*bl2)(uint64_t, uint64_t) = BL2_BASE; + uint64_t i, *dst = BL2_BASE, *src = BL2_BASE + PAYLOAD_OFFSET; + + /* memmove payload from 0x1200 to 0x1000 offset in TZRAM */ + for (i = 0; i < BL2_SIZE / sizeof(*src); i++) + *(dst + i) = *(src + i); + + /* goto entry point with x0 and x1 reg intact */ + bl2(x0, x1); +} + +/* + .arch armv8-a + .file "
|
[PATCH 0/2] tools: mkimage: Add Amlogic Boot Image type
3
Add support for creating an Amlogic Boot Image that pass CHK in BL1 on Amlogic AArch64 SoCs. The first patch add the new amlimage type. The second patch add a eMMC relocation workaround that can be used to generate a boot image that can be booted from both eMMC and SD-card on GXBB. The amlimage type and the eMMC relocation workaround is loosely based on my prior work, aml_chksum, a small tool that can write boot image headers with updated offsets and checksums, see [1]. This has been tested booting a very limited U-Boot SPL on boards with e.g. S905, S922X, S905X3 and A311D SoCs. [1] https://github.com/Kwiboo/u-boot/commit/6d0a17632922077a2e64b13ae1a6bdf0024b718f Jonas Karlman (2): tools: mkimage: Add Amlogic Boot Image type tools: amlimage: Add support for GXBB eMMC header MAINTAINERS | 1 + boot/image.c | 1 + include/image.h | 1 + tools/Makefile | 1 + tools/amlimage-gxbb-relocate.c | 79 +++++++++ tools/amlimage.c | 283 +++++++++++++++++++++++++++++++++ 6 files changed, 366 insertions(+) create mode 100644 tools/amlimage-gxbb-relocate.c create mode 100644 tools/amlimage.c -- 2.47.1
|
[PATCH v2] board: odroid-n2: Update docs for signing
3
Reviewed-by: Neil Armstrong <neil.armstrong@...>
|
[PATCH 0/3] arm: meson: extend sm calls to support Amlogic chip_id v1, v2
3
Hi! 10/02/2025 20.50, Evgeny Bachinin wrote: + gxl (S905W) Tested-by: Viacheslav Bocharov <adeep@...>
|
[PATCH 1/3] arm: meson: unify type being used for socinfo
socinfo_ API uses u32 type, hence let's use it everywhere for consistency. Signed-off-by: Evgeny Bachinin <EABachinin@...> --- arch/arm/mach-meson/board-info.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-meson/board-info.c b/arch/arm/mach-meson/board-info.c index b4058f593234e940fc2c00b82cdf9bd758cef567..94b066170c43019b379f05ab8d1e6d426592a1e1 100644 --- a/arch/arm/mach-meson/board-info.c +++ b/arch/arm/mach-meson/board-info.c @@ -7,6 +7,7 @@ #include <init.h> #include <asm/global_data.h> #include <asm/io.h> +#include <asm/types.h> #include <dm.h> #include <linux/bitfield.h> #include <regmap.h> @@ -125,12 +126,12 @@ static const char *socinfo_to_soc_id(u32 socinfo) return "Unknown"; } -static unsigned int get_socinfo(void) +static u32 get_socinfo(void) { struct regmap *regmap; int nodeoffset, ret; ofnode node; - unsigned int socinfo; + u32 socinfo; /* find the offset of compatible node */ nodeoffset = fdt_node_offset_by_compatible(gd->fdt_blob, -1, @@ -162,7 +163,7 @@ static unsigned int get_socinfo(void) int checkboard(void) { - unsigned int socinfo; + u32 socinfo; socinfo = get_socinfo(); if (!socinfo) @@ -181,7 +182,7 @@ int checkboard(void) int meson_get_soc_rev(char *buff, size_t buff_len) { - unsigned int socinfo; + u32 socinfo; socinfo = get_socinfo(); if (!socinfo) -- 2.34.1
|
[PATCH 2/3] arm: meson: sm: get rid of SM_CHIP_ID_SIZE
SM_CHIP_ID_SIZE is used nowhere. Moreover, it specifies wrong chip_id size: Amlogic chip_id v1 and v2 is always 16 bytes long. Signed-off-by: Evgeny Bachinin <EABachinin@...> --- arch/arm/mach-meson/sm.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c index 4d9f83d3b38d54e20d7d2bec997793cca5d7f0e4..43a259d695b058361445d7ef7047353b3afd5419 100644 --- a/arch/arm/mach-meson/sm.c +++ b/arch/arm/mach-meson/sm.c @@ -78,7 +78,6 @@ ssize_t meson_sm_write_efuse(uintptr_t offset, void *buffer, size_t size) #define SM_CHIP_ID_LENGTH 119 #define SM_CHIP_ID_OFFSET 4 -#define SM_CHIP_ID_SIZE 12 int meson_sm_get_serial(void *buffer, size_t size) { -- 2.34.1
|
[PATCH 3/3] arch: arm: meson: support Amlogic chip_id v1 and v2
Patch introduces: * chip_id API - useful for various things, but used now for device_id (did) generation as mentioned in [1] on our private board code. Our device_id is calculated by means of permutations of chip_id value. * new SoCs (a1, s4, etc) are usually coming with the support of chip_id v2 right away, whereas secure monitors on old SoCs (like axg, g12b, g12a, etc) may support only chip_id v1. Chip_id API handles both cases * meson_sm_get_serial() is described via chip_id API. Links: [1] https://lore.kernel.org/linux-arm-kernel/202311242104.RjBPI3uI-lkp@.../T/#m630fbeea6a6e7d531290b5c0af205af4fb979757 Signed-off-by: Viacheslav Bocharov <adeep@...> Co-developed-by: Arseniy Krasnov <avkrasnov@...> Signed-off-by: Arseniy Krasnov <avkrasnov@...> Signed-off-by: Evgeny Bachinin <EABachinin@...> --- === Theory and research 1) Amlogic efuse data layout. Layout differs for old (axg, g12a, g12b) and new (a1, s4) SoCs. efuse layout for old SoCs +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |0x0 | Ver | Serial (12 bytes) *(1) | +----+---------------+-----------------------------------------------+ |0x10| < ... Another data ... > | +----+---------------------------------------------------------------+ NOTES: *(1) - in U-Boot & Linux upstream is known as "serial". See [1] efuse layout for new SoCs +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ | | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F | +----+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ |0x0 | Ver | cpu_id | Serial... | +----+---------------+---------------+-------------------------------+ |0x10| ...(12 bytes) | < ... Another data ... > | +----+---------------+-----------------------------------------------+ 2) About Amlogic chip_id V1 & V2 in Amlogic U-Boot Briefly, some statements and observations: a) v1 & v2 are 16 bytes in size b) v1 format: { cpu_id | serial (12b) } * Old SoCs (axg, g12a, g12b, etc): * cpu_id = value, read from reg (aka socinfo) * serial - 12 unique bytes from efuse. (Before arriving to the client their order is reversed to little-endian) * New SoCs (a1, s4, etc): * cpu_id = 0; * serial = {8 unique bytes from efuse | cpu_id (reversed order)} (Before arriving to client their order is reversed) c) v2 format: { 16 bytes from efuse } * For old & new SoCs: { 16 bytes from efuse } = = { cpu_id | serial (12b, little-endian) } (They come from eFUSE in the correct order right away) d) Old SoCs: chip_id V1 == V2 e) New SoCs: chip_id V1 != V2 (due to (b)) f) New SoCs are coming with chip_id V2 support right away. g) Due to (f), final format/layout of chip_id V1 & V2 can be considered the same. 3) Experimental data from Amlogic U-Boot. * AXG ver 2: ``` [in-efuse view]: 02 00 00 00 25 0C 43 00 C0 22 B6 54 74 79 FA 18 6E 0D 43 86 ver | cpu_id | 12 bytes of unique data in | | | little-endian: efuse_chip_id[0:11] | [chip_id]: 16 bytes (same as ver.1) 25 0C 43 00 C0 22 B6 54 74 79 FA 18 6E 0D 43 86 ``` * AXG ver 1: ``` [in-efuse view]: 01 00 00 00 86 43 0D 6E 18 FA 79 74 54 B6 22 C0 00 00 00 00 ver | 12 bytes of unique data in | | big-endian: efuse_chip_id[11:0] | [chip_id]: 16 bytes 25 0C 43 00 C0 22 B6 54 74 79 FA 18 6E 0D 43 86 cpu_id from | 12 bytes of unique data in | register | little-endian: efuse_chip_id[0:11] | ``` * A1 ver 2: ``` [in-efuse view]: 02 00 00 00 2C 0A 01 0A 01 44 18 00 00 06 39 36 32 41 34 50 ver | cpu_id | 12 bytes of unique data in | | | little-endian: efuse_chip_id[0:11] | [chip_id]: 2C 0A 01 0A 01 44 18 00 00 06 39 36 32 41 34 50 ``` * A1 ver 1: ``` [in-efuse view]: 01 00 00 00 2C 0A 01 0A 50 34 41 32 36 39 06 00 00 00 00 00 ver | cpu_id | 8b of unique data in | | | big-endian: | | | efuse_chip_id[11:0] | [chip_id]: 00 00 00 00 00 06 39 36 32 41 34 50 0A 01 0A 2C *(1) buff[0] = 0 | 8b of unique data in | cpu_id | | little-endian: | | | efuse_chip_id[0:11] | | NOTES: *(1) - for details see [2] ``` Links: [1] https://lore
|
[PATCH v1] arch: meson: sm: add retrieve SoC chipid
2
From: Nikita Maslo <nam@...> The Amlogic Meson SoC Secure Monitor implements a call to retrieve an unique SoC ID starting from the GX Family and all new families. But GX-family chips (e.g. GXB, GXL and newer) supports also 128-bit chip ID. 128-bit chip ID consists 32-bit SoC version and 96-bit OTP data. Add new subcommand "chipid" to Amlogic specific "sm" cmd to write the SoC chip ID to memory. Signed-off-by: Nikita Maslo <nam@...> Co-developed-by: Viacheslav Bocharov <adeep@...> Signed-off-by: Viacheslav Bocharov <adeep@...> --- arch/arm/include/asm/arch-meson/sm.h | 12 ++++++++++- arch/arm/mach-meson/sm.c | 32 +++++++++++++++++++++++++++- cmd/meson/sm.c | 22 ++++++++++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/arch-meson/sm.h b/arch/arm/include/asm/= arch-meson/sm.h index 4b1d564bc48..812c5ed020a 100644 --- a/arch/arm/include/asm/arch-meson/sm.h +++ b/arch/arm/include/asm/arch-meson/sm.h @@ -27,9 +27,10 @@ ssize_t meson_sm_read_efuse(uintptr_t offset, void *bu= ffer, size_t size); ssize_t meson_sm_write_efuse(uintptr_t offset, void *buffer, size_t size= ); =20 #define SM_SERIAL_SIZE 12 +#define SM_CHIP_ID_SIZE 16 =20 /** - * meson_sm_get_serial - read chip unique id into buffer + * meson_sm_get_serial - read chip unique serial into buffer * * @buffer: pointer to buffer * @size: buffer size. @@ -37,6 +38,15 @@ ssize_t meson_sm_write_efuse(uintptr_t offset, void *b= uffer, size_t size); */ int meson_sm_get_serial(void *buffer, size_t size); =20 +/** + * meson_sm_get_chip_id - read unique chip ID into buffer + * + * @buffer: pointer to buffer + * @size: buffer size. + * @return: zero on success or -errno on failure + */ +int meson_sm_get_chip_id(void *buffer, size_t size); + enum { REBOOT_REASON_COLD =3D 0, REBOOT_REASON_NORMAL =3D 1, diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c index 4d9f83d3b38..05d92f878d9 100644 --- a/arch/arm/mach-meson/sm.c +++ b/arch/arm/mach-meson/sm.c @@ -78,7 +78,6 @@ ssize_t meson_sm_write_efuse(uintptr_t offset, void *bu= ffer, size_t size) =20 #define SM_CHIP_ID_LENGTH 119 #define SM_CHIP_ID_OFFSET 4 -#define SM_CHIP_ID_SIZE 12 =20 int meson_sm_get_serial(void *buffer, size_t size) { @@ -101,6 +100,37 @@ int meson_sm_get_serial(void *buffer, size_t size) return 0; } =20 +int meson_sm_get_chip_id(void *buffer, size_t size) +{ + struct udevice *dev; + struct pt_regs regs =3D { 0 }; + u8 id_buffer[SM_CHIP_ID_LENGTH]; + int err; + + dev =3D meson_get_sm_device(); + if (IS_ERR(dev)) + return PTR_ERR(dev); + + regs.regs[1] =3D 2; + err =3D sm_call_read(dev, id_buffer, SM_CHIP_ID_LENGTH, + MESON_SMC_CMD_CHIP_ID_GET, ®s); + + if (err < 0) { + pr_err("Failed to read chipid (%d)\n", err); + return err; + } + + if (((u32 *)id_buffer)[0] !=3D 2) { + pr_err("Failed to read chipid: invalid chipid call version\n"); + return -EINVAL; + } + + memcpy(buffer, id_buffer + SM_CHIP_ID_OFFSET, + size > SM_CHIP_ID_LENGTH ? SM_CHIP_ID_LENGTH : size); + + return 0; +} + #define AO_SEC_SD_CFG15 0xfc #define REBOOT_REASON_MASK GENMASK(15, 12) =20 diff --git a/cmd/meson/sm.c b/cmd/meson/sm.c index b69f8123ee2..21bfa58e507 100644 --- a/cmd/meson/sm.c +++ b/cmd/meson/sm.c @@ -33,6 +33,24 @@ static int do_sm_serial(struct cmd_tbl *cmdtp, int fla= g, int argc, return CMD_RET_SUCCESS; } =20 +static int do_sm_chip_id(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + ulong address; + int ret; + + if (argc < 2) + return CMD_RET_USAGE; + + address =3D simple_strtoul(argv[1], NULL, 0); + + ret =3D meson_sm_get_chip_id((void *)address, SM_CHIP_ID_SIZE); + if (ret) + return CMD_RET_FAILURE; + + return CMD_RET_SUCCESS; +} + #define MAX_REBOOT_REASONS 14 =20 static const char *reboot_reasons[MAX_REBOOT_REASONS] =3D { @@ -154,6 +172,7 @@ free_buffer: =20 static struct cmd_tbl cmd_sm_sub[] =3D { U_BOOT_CMD_MKENT(serial, 2, 1, do_sm_serial, "", ""), + U_BOOT_CMD_MKENT(chipid, 2, 1, do_sm_chip_id, "", ""), U_BOOT_CMD_MKENT(reboot_reason, 1, 1, do_sm_reboot_reason, "", ""), U_BOOT_CMD_MKENT(efuseread, 4, 1, do_efuse_read, "", ""), U_BOOT_CMD_MKENT
|
[PATCH] Squashed 'dts/upstream/' changes from 9b6ba2666d63..8531b4b4988c
3
8531b4b4988c Merge tag 'v6.13-rc7-dts-raw' [snip] git-subtree-dir: dts/upstream git-subtree-split: 8531b4b4988c2c9bddc90ea74f2d3e2dca9d5056 --- This will bring us to the v6.13-dts tag of the devicetree-rebasing tree and so match v6.13 release. Changes and changelog omitted due to size, and everyone who is listed as a maintainer of a platform with OF_UPSTREAM enabled has been bcc'd, while other lists were cc'd to avoid being marked as spam, hopefully. -- Tom
|
[PATCH] board: amlogic: odroid-n2: remove amlogic prefix from fdtdir path
2
Commit 834e7c8136c6 ("dts: meson-g12a: Switch to using upstream DT") changed Amlogic configs to contain the default /amlogic device-tree path prefix, e.g. for odroid-n2: CONFIG_DEFAULT_DEVICE_TREE="amlogic/meson-g12b-odroid-n2" The board files also prefix amlogic when using fdtdir resulting in an /amlogic/amlogic/meson-g12b-odroid-n2.dtb path which is invalid with most distro packaging. Drop the prefix here to align with the board configs. This resolves fdtdir boot on Odroid N2/C4/HC4. Signed-off-by: Christian Hewitt <christianshewitt@...> --- board/amlogic/odroid-n2/odroid-n2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/board/amlogic/odroid-n2/odroid-n2.c b/board/amlogic/odroid-n2/odroid-n2.c index ae953d0e4ba..e98580631ec 100644 --- a/board/amlogic/odroid-n2/odroid-n2.c +++ b/board/amlogic/odroid-n2/odroid-n2.c @@ -62,7 +62,7 @@ static void odroid_set_fdtfile(char *soc, char *variant) { char s[128]; - snprintf(s, sizeof(s), "amlogic/meson-%s-odroid-%s.dtb", soc, variant); + snprintf(s, sizeof(s), "meson-%s-odroid-%s.dtb", soc, variant); env_set("fdtfile", s); } -- 2.34.1
|
[PATCH 1/2] tools: mkimage: Add Amlogic Boot Image type
4
Add support for creating an Amlogic Boot Image that pass CHK in BL1 on Amlogic AArch64 SoCs. Images can optionally be signed for secure boot scenario, however creation of signed images has not been implemented. Example of how to use it: # Create an amlogic boot image tools/mkimage -T amlimage -n gxbb -d u-boot-spl.bin u-boot-amlogic.bin # List boot image header information tools/mkimage -l u-boot-amlogic.bin # Extract amlogic boot image payload tools/dumpimage -T amlimage -o bl2-payload.bin u-boot-amlogic.bin Or with binman using something like: binman { u-boot-amlogic { filename = "u-boot-amlogic.bin"; pad-byte = <0xff>; mkimage { filename = "bl2.bin"; args = "-n", "gxbb", "-T", "amlimage"; u-boot-spl { }; }; }; }; Signed-off-by: Jonas Karlman <jonas@...> --- MAINTAINERS | 1 + boot/image.c | 1 + include/image.h | 1 + tools/Makefile | 1 + tools/amlimage.c | 246 +++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 250 insertions(+) create mode 100644 tools/amlimage.c diff --git a/MAINTAINERS b/MAINTAINERS index ba31f86feb6d..6a92daa489da 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -181,6 +181,7 @@ F: drivers/video/meson/ F: drivers/watchdog/meson_gxbb_wdt.c F: include/configs/meson64.h F: include/configs/meson64_android.h +F: tools/amlimage* F: doc/board/amlogic/ N: meson diff --git a/boot/image.c b/boot/image.c index abac254e0264..814ad182a525 100644 --- a/boot/image.c +++ b/boot/image.c @@ -183,6 +183,7 @@ static const table_entry_t uimage_type[] = { { IH_TYPE_FDT_LEGACY, "fdt_legacy", "legacy Image with Flat Device Tree ", }, { IH_TYPE_RENESAS_SPKG, "spkgimage", "Renesas SPKG Image" }, { IH_TYPE_STARFIVE_SPL, "sfspl", "StarFive SPL Image" }, + { IH_TYPE_AMLIMAGE, "amlimage", "Amlogic Boot Image" }, { -1, "", "", }, }; diff --git a/include/image.h b/include/image.h index 0a61dfd556c5..acad8997d190 100644 --- a/include/image.h +++ b/include/image.h @@ -232,6 +232,7 @@ enum image_type_t { IH_TYPE_FDT_LEGACY, /* Binary Flat Device Tree Blob in a Legacy Image */ IH_TYPE_RENESAS_SPKG, /* Renesas SPKG image */ IH_TYPE_STARFIVE_SPL, /* StarFive SPL image */ + IH_TYPE_AMLIMAGE, /* Amlogic Boot Image */ IH_TYPE_COUNT, /* Number of image types */ }; diff --git a/tools/Makefile b/tools/Makefile index ee08a9675df8..0dbc429d6419 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -100,6 +100,7 @@ ROCKCHIP_OBS = generated/lib/rc4.o rkcommon.o rkimage.o rksd.o rkspi.o # common objs for dumpimage and mkimage dumpimage-mkimage-objs := aisimage.o \ + amlimage.o \ atmelimage.o \ $(FIT_OBJS-y) \ $(FIT_SIG_OBJS-y) \ diff --git a/tools/amlimage.c b/tools/amlimage.c new file mode 100644 index 000000000000..9af795602e69 --- /dev/null +++ b/tools/amlimage.c @@ -0,0 +1,246 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +// Copyright Contributors to the U-Boot project. + +#include "imagetool.h" +#include <u-boot/sha256.h> + +/* + * Image contain data in the following order: + * Nonce 16 byte + * Header 64 byte + * Digest 32 byte + * Padding align up to 4K + * Payload + */ + +#define HEADER_MAGIC 0x4c4d4140 /* @AML */ +#define HEADER_OFFSET 0x10 /* 16 */ +#define HEADER_SIZE 0x40 /* 64 */ +#define PAYLOAD_OFFSET 0x1000 /* 4096 */ + +struct amlimage_header { + uint32_t magic; + uint32_t total_size; + uint8_t header_size; + uint8_t root_key_index; + uint8_t version_major; + uint8_t version_minor; + uint32_t padding1; + uint32_t digest_type; + uint32_t digest_offset; + uint32_t digest_size; + uint32_t data_offset; + uint32_t key_type; + uint32_t key_offset; + uint32_t key_size; + uint32_t data_size; + uint32_t payload_type; + uint32_t payload_offset; + uint32_t payload_size; + uint32_t padding2; +} __packed; + +struct amlimage_variant { + const char *name; + const struct amlimage_header hdr; +}; + +#define VARIANT(name, major, minor, size) \ + { name, { .magic = HEADER_MAGIC, .header_size = HEADER_SIZE, \ + .version_major = major, .version_minor = minor, \ + .payload_size = size, } } + +static const struct amlimage_variant variants[] = { + VARIANT("gxbb", 1, 0, 0xb000), + VARIANT("gxl", 1, 1, 0xb000), + VARIANT("gxm", 1, 1, 0xb000), +
|
[PATCH] board: odroid-n2: Add script and update docs for signing
2
Hi, I'm not a big fan of moving the instructions in a script, the script is already avaible in the amlogic-boot-fip project, so rather could you fix the documentation instead ? Thanks, Neil
|
[PATCH v5 00/13] Add video damage tracking
On Mon, Aug 21, 2023 at 01:50 PM Alper Nebi Yasak <alpernebiyasak@...> wrote: > > This is a rebase of Alexander Graf's video damage tracking series, with > some tests and other changes. The original cover letter is as follows: > > > > This patch set speeds up graphics output on ARM by a factor of 60x. > > > > On most ARM SBCs, we keep the frame buffer in DRAM and map it as cached, > > but need it accessible by the display controller which reads directly > > from a later point of consistency. Hence, we flush the frame buffer to > > DRAM on every change. The full frame buffer. > > > > Unfortunately, with the advent of 4k displays, we are seeing frame buffers > > that can take a while to flush out. This was reported by Da Xue with grub, > > which happily print 1000s of spaces on the screen to draw a menu. Every > > printed space triggers a cache flush. > > > > This patch set implements the easiest mitigation against this problem: > > Damage tracking. We remember the lowest common denominator region that was > > touched since the last video_sync() call and only flush that. The most > > typical writer to the frame buffer is the video console, which always > > writes rectangles of characters on the screen and syncs afterwards. > > > > With this patch set applied, we reduce drawing a large grub menu (with > > serial console attached for size information) on an RK3399-ROC system > > at 1440p from 55 seconds to less than 1 second. > > > > Version 2 also implements VIDEO_COPY using this mechanism, reducing its > > overhead compared to before as well. So even x86 systems should be faster > > with this now :). > > > > > > Alternatives considered: > > > > 1) Lazy sync - Sandbox does this. It only calls video_sync(true) ever > > so often. We are missing timers to do this generically. > > > > 2) Double buffering - We could try to identify whether anything changed > > at all and only draw to the FB if it did. That would require > > maintaining a second buffer that we need to scan. > > > > 3) Text buffer - Maintain a buffer of all text printed on the screen with > > respective location. Don't write if the old and new character are > > identical. This would limit applicability to text only and is an > > optimization on top of this patch set. > > > > 4) Hash screen lines - Create a hash (sha256?) over every line when it > > changes. Only flush when it does. I'm not sure if this would waste > > more time, memory and cache than the current approach. It would make > > full screen updates much more expensive. > > > Changes in v5: > - Add patch "video: test: Split copy frame buffer check into a function" > - Add patch "video: test: Support checking copy frame buffer contents" > - Add patch "video: test: Test partial updates of hardware frame buffer" > - Use xstart, ystart, xend, yend as names for damage region > - Document damage struct and fields in struct video_priv comment > - Return void from video_damage() > - Fix undeclared priv error in video_sync() > - Drop unused headers from video-uclass.c > - Use IS_ENABLED() instead of CONFIG_IS_ENABLED() > - Call video_damage() also in video_fill_part() > - Use met->baseline instead of priv->baseline > - Use fontdata->height/width instead of VIDEO_FONT_HEIGHT/WIDTH > - Update console_rotate.c video_damage() calls to pass video tests > - Remove mention about not having minimal damage for console_rotate.c > - Add patch "video: test: Test video damage tracking via vidconsole" > - Document new vdev field in struct efi_gop_obj comment > - Remove video_sync_copy() also from video_fill(), video_fill_part() > - Fix memmove() calls by removing the extra dev argument > - Call video_sync() before checking copy_fb in video tests > - Imply VIDEO_DAMAGE for video drivers instead of selecting it > - Imply VIDEO_DAMAGE also for VIDEO_TIDSS > > > v4: https://lore.kernel.org/all/20230103215004.22646-1-agraf@.../ > > > Changes in v4: > - Move damage clear to patch "dm: video: Add damage tracking API" > - Simplify first damage logic > - Remove VIDEO_DAMAGE default for ARM > - Skip damage on EfiBltVideoToBltBuffer > -
|
[GIT PULL] Please pull u-boot-dfu-next-20241126
2
Hi Tom, Please find some new developments for next: Android: - bootstd: Implement bootimage v2 support - bootstd: Support non-A/B in bootmeth_android - Migrate VIM3 and VIM3L to use bootmeth_android - bootstd: Additional test for bootimage v2 - bootstd: Optimize load time when reading partitions CI job: - https://source.denx.de/u-boot/custodians/u-boot-dfu/-/pipelines/23573 Thanks, Mattijs The following changes since commit 48380f9b2a12e3fc6339d6af5a154bded769d911: Merge tag 'v2025.01-rc3' into next (2024-11-25 17:34:08 -0600) are available in the Git repository at: https://source.denx.de/u-boot/custodians/u-boot-dfu.git tags/u-boot-dfu-next-20241126 for you to fetch changes up to abadcda24b100b8eb0f138085cca6595518cec85: bootstd: android: don't read whole partition sizes (2024-11-26 10:04:40 +0100) ---------------------------------------------------------------- u-boot-dfu-next-20241126 Android: - bootstd: Implement bootimage v2 support - bootstd: Support non-A/B in bootmeth_android - Migrate VIM3 and VIM3L to use bootmeth_android - bootstd: Additional test for bootimage v2 - bootstd: Optimize load time when reading partitions ---------------------------------------------------------------- Guillaume La Roque (5): bootstd: android: add support of bootimage v2 bootstd: android: add non-A/B image support configs: khadas-vim3l_android{_ab}: move on bootmeth android configs: khadas-vim3_android{_ab}: move on bootmeth android bootstd: Add test for Android boot image v2 Julien Masson (1): bootstd: android: don't read whole partition sizes arch/sandbox/dts/test.dts | 10 ++- boot/Kconfig | 1 - boot/bootmeth_android.c | 104 ++++++++++++++++++++++-------- boot/image-android.c | 45 +++++++++++++ configs/am62x_a53_android.config | 1 + configs/khadas-vim3_android_ab_defconfig | 7 +- configs/khadas-vim3_android_defconfig | 7 +- configs/khadas-vim3l_android_ab_defconfig | 7 +- configs/khadas-vim3l_android_defconfig | 7 +- configs/sandbox_defconfig | 1 + include/configs/khadas-vim3_android.h | 25 +++++-- include/configs/khadas-vim3l_android.h | 25 +++++-- include/configs/meson64_android.h | 6 -- include/image.h | 24 +++++++ test/boot/bootflow.c | 29 ++++++++- test/py/tests/test_ut.py | 49 ++++++++++++++ 16 files changed, 297 insertions(+), 51 deletions(-)
|
[PATCH v4 0/5] Add support of Android Boot Image version 2 and non-AB image
2
Actually bootmethod android only support android boot image version 4 and with AB image, some old platform wtill use android boot image version 2 with AB or without AB slot. This patchset add support of both version 2 and non-AB slot images. It's fixed in same time a boot issue seen on khadas vim3{l} board with 16GB eMMC patchset was tested on khadas VIM3 and VIM3L with AOSP main branch and android-mainline kernel and with TI AM62P with android release provided by TI. Signed-off-by: Guillaume La Roque <glaroque@...> --- Changes in v4: - test: fix test after patch done on it by Mattijs : https://lore.kernel.org/r/all/20241123024300.GY3600562@bill-the-cat/ - Link to v3: https://lore.kernel.org/r/20241119-adnroidv2-v3-0-45baa486fb31@... Changes in v3: - Remove gpio recovery stuff not needed anymore. - Link to v2: https://lore.kernel.org/r/20241114-adnroidv2-v2-0-015bffb1373a@... Changes in v2: - Drop patch 3 (configs: khadas-vim3{l}: fix userdata size) already applied - Apply Tested-by and Reviewed-by from v1 - Fix comments - Revert malloc/free for slot_suffix - Remove vim3/vim3l stuff in meson64_android.h - Link to v1: https://lore.kernel.org/r/20241017-adnroidv2-v1-0-781c939902c9@... --- Guillaume La Roque (5): bootstd: android: add support of bootimage v2 bootstd: android: add non-A/B image support configs: khadas-vim3l_android{_ab}: move on bootmeth android configs: khadas-vim3_android{_ab}: move on bootmeth android bootstd: Add test for Android boot image v2 arch/sandbox/dts/test.dts | 10 +++- boot/Kconfig | 1 - boot/bootmeth_android.c | 78 +++++++++++++++++++++---------- configs/am62x_a53_android.config | 1 + configs/khadas-vim3_android_ab_defconfig | 7 ++- configs/khadas-vim3_android_defconfig | 7 ++- configs/khadas-vim3l_android_ab_defconfig | 7 ++- configs/khadas-vim3l_android_defconfig | 7 ++- configs/sandbox_defconfig | 1 + include/configs/khadas-vim3_android.h | 25 ++++++++-- include/configs/khadas-vim3l_android.h | 25 ++++++++-- include/configs/meson64_android.h | 6 --- test/boot/bootflow.c | 29 ++++++++++-- test/py/tests/test_ut.py | 49 +++++++++++++++++++ 14 files changed, 206 insertions(+), 47 deletions(-) --- base-commit: 48380f9b2a12e3fc6339d6af5a154bded769d911 change-id: 20241015-adnroidv2-a01dca609707 Best regards, -- Guillaume La Roque <glaroque@...>
|