Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03217C636CC for ; Sun, 5 Feb 2023 23:50:31 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C5FBE85A5C; Mon, 6 Feb 2023 00:50:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="T5mIyIdK"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9738C85755; Mon, 6 Feb 2023 00:50:27 +0100 (CET) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7C11485AAA for ; Mon, 6 Feb 2023 00:50:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=souajih@baylibre.com Received: by mail-wm1-x32d.google.com with SMTP id hn2-20020a05600ca38200b003dc5cb96d46so9630406wmb.4 for ; Sun, 05 Feb 2023 15:50:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pjkCdqSPl56TGFuNjE3QEp3nVE92C57gyXB5SfXPqYE=; b=T5mIyIdKd6d0indfw/IQ+/fATllFa7gyaZzrGokkXNNoRKl43f/obvTsA6Uded/abw 7K1M8nKfS4BxMhEQKyTkFkmD2luhx4TD9/eUy3GqAwMamSvLQWPeFYJlHIt4H4r5gE2o p6b1dB2/yZYkmZjGOGkzXLnIkElUOwqLPG9Ap0RYZThxUilELtYrdGLm4DGp3XFi38fa m5xpjmdHkRxP3xddENFId4imi/B3peQuWzrfKQ13jcDpmVVICUC1FR0Zt0Omhi3kwVe7 EgccdbMqmVWtyskH+bZ4LukDSb0zhyW9mO4TTZplfqxfz2CdvPULONg4lZCST99faHYR j87Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pjkCdqSPl56TGFuNjE3QEp3nVE92C57gyXB5SfXPqYE=; b=xtqmotJUyjg4sD5Srx7W2YXjNHw5ZqltNdG8soLMyBeHRRirmuFut5w/PNOk5dU03t V4RTWxoiQL1rk0aJ7o4t/4c/kvCM6/SA5pMTSd3jzntGmrVZVxrrJNKnxGdvLh24+XVK tAFvgbdwfnOBNyNilaJUAT04xYnFEZC/epcso16r82yO41P3rp6/5PheTlDHsT3s+RYh GD/8kR1QH2DFQu4NKYz6LNkH54yfkiqckEy3SyaVprn/XxpNyOZ4zk9guy1kYO+MagXM +iBMaXKlTfhukT7QyQSOtzejlR0ZEBcfms+gQ4S4BWkAg0/7+XZLRAfFR16x/IaRKoxs 5SjA== X-Gm-Message-State: AO0yUKV2tHUDeaHweMCQPL3dijinY6L1Aax3M9Bk8K20xEj3aSJXDVm9 Xt+TpmWtwZJmnnsqpyJ4ZATZaQ== X-Google-Smtp-Source: AK7set8aE68OlwZ4DkWtVKJ+X/yipHG4DMz8y/pJd59yDt0NaDULLKPmXc5Q6+3gyPD6zYzy8AgqLw== X-Received: by 2002:a05:600c:3504:b0:3df:30c9:4865 with SMTP id h4-20020a05600c350400b003df30c94865mr16379831wmq.26.1675641023961; Sun, 05 Feb 2023 15:50:23 -0800 (PST) Received: from safae-ThinkPad-T480.. ([2a04:cec0:11ad:6643:93a:a991:f152:4df7]) by smtp.gmail.com with ESMTPSA id w2-20020a5d6802000000b002bfb1de74absm7430196wru.114.2023.02.05.15.50.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Feb 2023 15:50:23 -0800 (PST) From: Safae Ouajih To: sjg@chromium.org Cc: u-boot@lists.denx.de, sean.anderson@seco.com, r.stratiienko@gmail.com, mkorpershoek@baylibre.com, glaroque@baylibre.com, khilman@baylibre.com Subject: [PATCH v3 00/19] Support android boot image v3/v4 Date: Mon, 6 Feb 2023 00:50:02 +0100 Message-Id: <20230205235021.355410-1-souajih@baylibre.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Hello everyone, * This is based on Roman Stratiienko's work to support boot image header version 3 and 4. * This supports the new boot image headers v3, v4 and bootconfig feature. https://source.android.com/docs/core/architecture/bootloader/boot-image-header https://source.android.com/docs/core/architecture/bootloader/implementing-bootconfig - Tested on Amlogic Khadas vim3l, a reference board for Android Open Source Project https://www.khadas.com/vim3l And on AM625 Texas Instruments board with 5.10 linux kernel Main changes : - New partition : vendor boot, with a specific vendor ramdisk - DTB is stored in the vendor boot partition - The generic ramdisk is placed after the vendor ramdisk - Bootconfig feature support Here is a link to see the related android boot flow changes on KHADAS vim3l as an example: https://gitlab.baylibre.com/baylibre/amlogic/atv/u-boot/-/commits/souajih/BootImagev4/ Changes in v3: - Ddd documentation for v3,v4 boot image header - Add mkbootimg tool to Dockerfile - Add full comments for functions/structs in include/image.h and include/android_image.h - Add map_sysmem() to make the boot work on Sandbox - Rename andr_vendor_img_hdr -> andr_vnd_boot_img_hdr Changes in v2: - Rework parts of the code to fix the abootimg test: test_abootimg - Update test_abootimg to support boot image header v4 - Remove LIBXBC library, import and adapt the functions to support bootconfig feature - Rename the used structures : andr_boot_img_hdr_v0_v1_v2 -> andr_boot_img_hdr_v0 andr_boot_img_hdr_v3_v4 -> andr_boot_img_hdr_v3 andr_vendor_boot_img_hdr_v3_v4 -> andr_vendor_img_hdr Safae Ouajih (19): android: boot: rename andr_img_hdr -> andr_boot_img_hdr_v0 android: boot: support vendor boot image in abootimg android: boot: replace android_image_check_header android: boot: add boot image header v3 and v4 structures android: boot: kcomp: support andr_image_data android: boot: move to andr_image_data structure android: boot: content print is not supported for v3,v4 header version android: boot: boot image header v3,v4 do not support recovery DTBO android: boot: add vendor boot image to prepare for v3,v4 support android: boot: update android_image_get_data to support v3,v4 android: boot: ramdisk: support vendor ramdisk android: boot: support extra command line android: boot: update android_image_get_dtb_img_addr to support v3,v4 drivers: fastboot: zImage flashing is not supported for v3,v4 android: boot: support boot image header version 3 and 4 android: boot: support bootconfig doc: android: add documentation for v3,v4 boot image header test/py: android: extend abootimg test Dockerfile: add mkbootimg tool boot/bootm.c | 37 +- boot/image-android.c | 461 ++++++++++++++++---- boot/image-board.c | 19 +- boot/image-fdt.c | 5 +- cmd/abootimg.c | 75 +++- doc/android/boot-image.rst | 13 +- drivers/fastboot/fb_mmc.c | 19 +- include/android_image.h | 228 +++++++++- include/image.h | 173 +++++++- test/py/tests/test_android/test_abootimg.py | 136 +++++- tools/docker/Dockerfile | 4 + 11 files changed, 1009 insertions(+), 161 deletions(-) -- 2.34.1