From mboxrd@z Thu Jan 1 00:00:00 1970 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 EAE0DC433EF for ; Thu, 27 Jan 2022 15:33:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5EF92837D2; Thu, 27 Jan 2022 16:33:25 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="fr7HFEfz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4E26F837AB; Thu, 27 Jan 2022 16:33:22 +0100 (CET) Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) (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 3D14C8354B for ; Thu, 27 Jan 2022 16:33:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=dsankouski@gmail.com Received: by mail-qv1-xf29.google.com with SMTP id hu2so3110229qvb.8 for ; Thu, 27 Jan 2022 07:33:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pOy+nlHOF0hOomDaiOfwGVC2DMk4s6zrU5HFYpvqLBQ=; b=fr7HFEfzIws90sb9B1AGCIFfzpTSdBiv/+isZz/DGDPKTrbP7tbHEluqFq2z6TT716 fh6el8poZgW1hjeVSGc3lc6dqr0Cg/yqSiBPElBolBLlZUoiAoow3C8DDssiFAQUOgf/ Rqc2PYTL/Gfj9JE5uarpWwhzDsRyzWSLFhGVTFd4Hg48Qc+xCOUphkArjTWgEGYCwRDF Fz3rkz9upJMGg+rTjWMBgphTBzT63vkgiBTsin6Da3+agpEGR6EwTMgB5KH6WqS3JWY9 h0oJ77/Pv1fF9kZ4DMsG52FnZw3pkbD20Ahptjb4eaoPlZo00TTHw6ncPcaJAIWSCjyl m8yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pOy+nlHOF0hOomDaiOfwGVC2DMk4s6zrU5HFYpvqLBQ=; b=1o2atd+DUOrSPn0vmJUiiJgQL8aQCGbXur4QDteR78fUzJ4zVOyPW6IGuqm52tbnzO 9GskKUjoF0xcfnjs2oTk2CLrW6vPBRtXAMnC8g2PQCgibDhpx4DO/l5qJe/EPUEd/fXQ Rd2hoiU8iTWhbXgCCfu5vTQnep/0dUakepej5wyMKZy+IeIIqXCzFiU1wr5093CIpavl 8v/Ch9KU36ZD9SDE1Tmod9X+tf2v67jgX7fgtEh6uLYnbyqXw/qZ1B5R6e7bXODZzz7i JzFBe0dHU2ZnZaRJ17S06uUC5T0rlU6bkPcXagvgq+ETiZKBpe4uRKN4HjUtwZ8msrec GLbg== X-Gm-Message-State: AOAM530kK/fIeXsSYBbv75PhfiETkodTgVWifpz4sBbPky28mt967FpT YASeyAbg8QU7tin/IZprfkIMj1gmh/s= X-Google-Smtp-Source: ABdhPJymTEVZEfylC2h5BGY3z3/jPFrJVKRyBpkPX9X2KaVak9uyCD4nLqTsyRGYDG1+FRLhLi/rtQ== X-Received: by 2002:a05:6214:529c:: with SMTP id kj28mr3547843qvb.101.1643297596730; Thu, 27 Jan 2022 07:33:16 -0800 (PST) Received: from localhost.localdomain ([86.57.159.214]) by smtp.gmail.com with ESMTPSA id u16sm1599127qko.130.2022.01.27.07.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 07:33:16 -0800 (PST) From: sankouski-dzmitry X-Google-Original-From: sankouski-dzmitry To: u-boot@lists.denx.de Cc: Dzmitry Sankouski , sankouski-dzmitry , Ramon Fried Subject: [PATCH 2/3] board: starqltechn: get board usable - add bootcmd and docs Date: Thu, 27 Jan 2022 18:32:33 +0300 Message-Id: <20220127153234.1964353-3-sankouski.dzmitry@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220127153234.1964353-1-sankouski.dzmitry@gmail.com> References: <20220127153234.1964353-1-sankouski.dzmitry@gmail.com> 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.5 at phobos.denx.de X-Virus-Status: Clean From: Dzmitry Sankouski U-boot is intended to replace linux kernel in android boot image(ABL), and it's FIT payload to replace initramfs file. The boot process is similar to boot image with linux: - android bootloader (ABL) unpacks android boot image - ABL sets `linux,initrd-start property` in chosen node in unpacked FDT - ABL sets x0 register to FDT address, and passes control to u-boot - u-boot reads x0 register, and stores it in `prevbl_fdt_addr` env variable - u-boot reads `linux,initrd-start` property, and stores it in `prevbl_initrd_start_addr` In this way, u-boot bootcmd relies on `prevbl_initrd_start_addr` env variable, and boils down to `bootm $prevbl_initrd_start_addr`. If more control on boot process is desired, pack a boot script in FIT image, and put it to default configuration What done: - strip unneeded config options - add FIT image support - increase LMB_MAX_REGIONS, to store all linux dtb reserved memory regions - add linux kernel image header Uart driver causes hang, when u-boot is used in android boot image instead of linux. Temporary disable console driver, until investigated and fixed. Signed-off-by: sankouski-dzmitry Cc: Ramon Fried --- configs/starqltechn_defconfig | 12 ++++++--- doc/board/qualcomm/sdm845.rst | 47 ++++++++++++++++++++++++++++++++++- include/configs/sdm845.h | 5 ++++ 3 files changed, 59 insertions(+), 5 deletions(-) diff --git a/configs/starqltechn_defconfig b/configs/starqltechn_defconfig index f57bb859cc..48b16c1da5 100644 --- a/configs/starqltechn_defconfig +++ b/configs/starqltechn_defconfig @@ -2,13 +2,14 @@ CONFIG_ARM=y CONFIG_SKIP_LOWLEVEL_INIT=y CONFIG_POSITION_INDEPENDENT=y CONFIG_ARCH_SNAPDRAGON=y -CONFIG_SYS_TEXT_BASE=0x80000000 -CONFIG_SYS_MALLOC_LEN=0x81f000 CONFIG_DEFAULT_DEVICE_TREE="starqltechn" +CONFIG_BOOTDELAY=0 +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y CONFIG_TARGET_STARQLTECHN=y CONFIG_IDENT_STRING="\nSamsung S9 SM-G9600" CONFIG_SYS_LOAD_ADDR=0x80000000 -CONFIG_USE_PREBOOT=y +CONFIG_LMB_MAX_REGIONS=64 # CONFIG_DISPLAY_CPUINFO is not set CONFIG_HUSH_PARSER=y CONFIG_CMD_GPIO=y @@ -20,5 +21,8 @@ CONFIG_PM8916_GPIO=y CONFIG_PINCTRL=y CONFIG_DM_PMIC=y CONFIG_PMIC_PM8916=y -CONFIG_MSM_GENI_SERIAL=y +CONFIG_REQUIRE_SERIAL_CONSOLE=n +CONFIG_MSM_GENI_SERIAL=n CONFIG_SPMI_MSM=y +CONFIG_LINUX_KERNEL_IMAGE_HEADER=y +CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR=y diff --git a/doc/board/qualcomm/sdm845.rst b/doc/board/qualcomm/sdm845.rst index cd46cbe9cf..b00a30a313 100644 --- a/doc/board/qualcomm/sdm845.rst +++ b/doc/board/qualcomm/sdm845.rst @@ -17,7 +17,9 @@ It is loaded as an Android boot image through ABL Installation ------------ -First, setup ``CROSS_COMPILE`` for aarch64. Then, build U-Boot for your board:: +Build +^^^^^^^^^^^^^^^^^^^^^^^^ +Setup ``CROSS_COMPILE`` for aarch64 and build U-Boot for your board:: $ export CROSS_COMPILE= $ make _defconfig @@ -25,6 +27,49 @@ First, setup ``CROSS_COMPILE`` for aarch64. Then, build U-Boot for your board:: This will build ``u-boot.bin`` in the configured output directory. +Generate FIT image +^^^^^^^^^^^^^^^^^^^^^^^^ +See doc/uImage.FIT for more details + +Pack android boot image +^^^^^^^^^^^^^^^^^^^^^^^^ +We'll assemble android boot image with ``u-boot.bin`` instead of linux kernel, +and FIT image instead of ``initramfs``. Android bootloader expect gzipped kernel +with appended dtb, so let's mimic linux to satisfy stock bootloader: + +- create dump dtb:: + + workdir=/tmp/prepare_payload + mkdir -p "$workdir" + cd "$workdir" + mock_dtb="$workdir"/payload_mock.dtb + + dtc -I dts -O dtb -o "$mock_dtb" << EOF + /dts-v1/; + / { + memory { + /* We expect the bootloader to fill in the size */ + reg = <0 0 0 0>; + }; + + chosen { }; + }; + EOF + +- gzip u-boot ``gzip u-boot.bin`` +- append dtb to gzipped u-boot: ``cat u-boot.bin.gz "$mock_dtb" > u-boot.bin.gz-dtb`` + +Now we've got everything to build android boot image::: + + mkbootimg --base 0x0 --kernel_offset 0x00008000 \ + --ramdisk_offset 0x02000000 --tags_offset 0x01e00000 \ + --pagesize 4096 --second_offset 0x00f00000 \ + --ramdisk "$fit_image" \ + --kernel u-boot.bin.gz-dtb \ + -o boot.img + +Flash image with your phone's flashing method. + Boards ------------ starqlte diff --git a/include/configs/sdm845.h b/include/configs/sdm845.h index af9ba197d4..398986bfcb 100644 --- a/include/configs/sdm845.h +++ b/include/configs/sdm845.h @@ -16,6 +16,11 @@ /* Generic Timer Definitions */ #define COUNTER_FREQUENCY 19000000 +#define CONFIG_EXTRA_ENV_SETTINGS \ + "bootm_size=0x4000000\0" \ + "bootcmd=bootm $prevbl_initrd_start_addr\0" \ + "bootm_low=0x80000000\0" + /* Size of malloc() pool */ #define CONFIG_SYS_BOOTM_LEN SZ_64M -- 2.25.1