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 5FB2DC433EF for ; Tue, 22 Feb 2022 18:50:39 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C7CC983C2D; Tue, 22 Feb 2022 19:50:28 +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="R4aodFVP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8566783C77; Tue, 22 Feb 2022 19:50:21 +0100 (CET) Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) (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 A3D5683C21 for ; Tue, 22 Feb 2022 19:50:11 +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-ej1-x62e.google.com with SMTP id bg10so45756734ejb.4 for ; Tue, 22 Feb 2022 10:50:11 -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=sShW7ONZVj8KmlC6lLQsMe2+q5Gy2hMA6otmbz1lyAI=; b=R4aodFVPHsU63B4KXqpjqzbbCETOSVFnsG95w8yyG1+h96koH9+oGfUV3GeElqfrVq Qkwj0ynf2vKOjMJIcg8cof2ZHQ/i6cZrUHUTcx+QsC1oko7CtUAxPLIKEpxUPHQNHPV/ wAwnwCNImQWnzIOt0/QZVTTGcxXn7wumQAPCFCbW81dUecehJm/tqBdjkq+2PEeb0T5u bvahGK/f5l4mprNtiIhH+oj7bRxlJ+p753hwavobxW94BftaQxl6+B99blNTXDhDh1Ph bdT8ssml1WWafLvfZow5dhjtiMgehjokXtSxUigE/KTaYfHHTqxNFMzIVky5AYZwCYIl aHsw== 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=sShW7ONZVj8KmlC6lLQsMe2+q5Gy2hMA6otmbz1lyAI=; b=13S864WrFbmNY9TTeaIhefjSHJe68+qkvDz261aFGeZurMaR8tgIp325fltZenHcAK lFXyRhWStVbP/zLC4Z9DByRI2hGd7TYqVz8BbhXEuiArT5KoIiKkzMJONOsjHVakztNo yPDzYbccXr4P1/PYo+3MwrRw/IV3omYf9oYinEQ1idMCic462g0fpHYJwLiJ3kuTfYIX jFYq8Yvru6WqUre0qhUJlTS5K3iQBYNJBWWIX1rxbydH7SCtmlqnuCufCaZDJNDnjnkf gkew/asJ/4FfHlf/GvPYhZNz0r3uyEcN8Ctw9F3X6Z9aZiRJL65q6BAO4eozfstl/DwX 3QWw== X-Gm-Message-State: AOAM532JlsQuanlmKboh/JKgF8Riw3hO/L58oszk1SHrFxKRhj09PHw5 EHy3hDrmbIFAp42t63uLr8ACXl+Qswo= X-Google-Smtp-Source: ABdhPJz0dUEhn2kmbe9FJFpnQhpep3SSDOzxRdbhTeAsIWDBLwqw+ORRDuDaeaW1RwzWsqMKODeoOg== X-Received: by 2002:a17:906:40c9:b0:6cf:1fb3:aca with SMTP id a9-20020a17090640c900b006cf1fb30acamr19681143ejk.101.1645555810936; Tue, 22 Feb 2022 10:50:10 -0800 (PST) Received: from localhost.localdomain ([46.216.60.43]) by smtp.gmail.com with ESMTPSA id i1sm6568592ejy.138.2022.02.22.10.50.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:50:10 -0800 (PST) From: Dzmitry Sankouski To: u-boot@lists.denx.de Cc: Dzmitry Sankouski , Ramon Fried Subject: [PATCH 2/3 v4] board: starqltechn: get board usable - add bootcmd and docs Date: Tue, 22 Feb 2022 21:49:53 +0300 Message-Id: <20220222184954.27024-3-dsankouski@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220222184954.27024-1-dsankouski@gmail.com> References: <20220222184954.27024-1-dsankouski@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 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 - add framebuffer node, u-boot logo and video console - 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: Dzmitry Sankouski Cc: Ramon Fried --- Changes for v2: - change signed off line - add CONFIG_SAVE_PREV_BL_FDT_ADDR. It's needed to boot android stock kernel - change bootcmd to source bootscript from FIT image for more flexibility Changes for v3: - enable simple framebuffer - enable video console - add preboot variable - remove 0x prefix in name in device tree Changes for v4: - fix uart driver pinmux - remove serial from stdout and stderr env - disable serial driver, because it's crashes autoboot arch/arm/dts/sdm845.dtsi | 6 ++-- arch/arm/dts/starqltechn-uboot.dtsi | 9 ++++-- arch/arm/dts/starqltechn.dts | 13 ++++++-- configs/starqltechn_defconfig | 21 ++++++++++--- doc/board/qualcomm/sdm845.rst | 47 ++++++++++++++++++++++++++++- include/configs/sdm845.h | 8 +++++ 6 files changed, 90 insertions(+), 14 deletions(-) diff --git a/arch/arm/dts/sdm845.dtsi b/arch/arm/dts/sdm845.dtsi index 1185b71216..6f2fb20d68 100644 --- a/arch/arm/dts/sdm845.dtsi +++ b/arch/arm/dts/sdm845.dtsi @@ -48,10 +48,8 @@ /* DEBUG UART */ qup_uart9: qup-uart9-default { - pinmux { - pins = "GPIO_4", "GPIO_5"; - function = "qup9"; - }; + pins = "GPIO_4", "GPIO_5"; + function = "gpio"; }; }; diff --git a/arch/arm/dts/starqltechn-uboot.dtsi b/arch/arm/dts/starqltechn-uboot.dtsi index d8d75e018a..b55cccfe14 100644 --- a/arch/arm/dts/starqltechn-uboot.dtsi +++ b/arch/arm/dts/starqltechn-uboot.dtsi @@ -8,15 +8,18 @@ / { + framebuffer@9D400000 { + u-boot,dm-pre-reloc; + }; soc { u-boot,dm-pre-reloc; + serial@a84000 { + u-boot,dm-pre-reloc; + }; gcc { clock-controller@100000 { u-boot,dm-pre-reloc; }; - serial@0xa84000 { - u-boot,dm-pre-reloc; - }; gpio_north@3900000 { u-boot,dm-pre-reloc; }; diff --git a/arch/arm/dts/starqltechn.dts b/arch/arm/dts/starqltechn.dts index 387420f30b..0261388319 100644 --- a/arch/arm/dts/starqltechn.dts +++ b/arch/arm/dts/starqltechn.dts @@ -34,9 +34,18 @@ method = "smc"; }; + framebuffer: framebuffer@9D400000 { + compatible = "simple-framebuffer"; + reg = <0 0x9D400000 0 (2960 * 1440 * 4)>;//2400000 + width = <1440>; + height = <2960>; + stride = <(1440 * 4)>; + format = "a8r8g8b8"; + }; + soc: soc { - serial@0xa84000 { - status = "ok"; + serial@a84000 { + status = "okay"; }; pinctrl@3900000 { diff --git a/configs/starqltechn_defconfig b/configs/starqltechn_defconfig index f57bb859cc..75e8409c4d 100644 --- a/configs/starqltechn_defconfig +++ b/configs/starqltechn_defconfig @@ -2,16 +2,18 @@ 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 +# CONFIG_REQUIRE_SERIAL_CONSOLE is not set # CONFIG_NET is not set # CONFIG_DM_STDIO is not set CONFIG_CLK=y @@ -20,5 +22,16 @@ CONFIG_PM8916_GPIO=y CONFIG_PINCTRL=y CONFIG_DM_PMIC=y CONFIG_PMIC_PM8916=y -CONFIG_MSM_GENI_SERIAL=y +# CONFIG_MSM_GENI_SERIAL is not set CONFIG_SPMI_MSM=y +CONFIG_LINUX_KERNEL_IMAGE_HEADER=y +CONFIG_SAVE_PREV_BL_INITRAMFS_START_ADDR=y +CONFIG_SAVE_PREV_BL_FDT_ADDR=y +CONFIG_DM_VIDEO=y +CONFIG_VIDEO_LOGO=y +CONFIG_CMD_VIDCONSOLE=y +CONFIG_CONSOLE_NORMAL=y +CONFIG_SYS_WHITE_ON_BLACK=y +CONFIG_VIDEO_DT_SIMPLEFB=y +CONFIG_VIDEO_SIMPLE=y +CONFIG_CMD_BMP=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..ba57323c74 100644 --- a/include/configs/sdm845.h +++ b/include/configs/sdm845.h @@ -16,6 +16,14 @@ /* Generic Timer Definitions */ #define COUNTER_FREQUENCY 19000000 +#define CONFIG_EXTRA_ENV_SETTINGS \ + "bootm_size=0x4000000\0" \ + "bootm_low=0x80000000\0" \ + "stdout=vidconsole\0" \ + "stderr=vidconsole\0" \ + "preboot=source $prevbl_initrd_start_addr:prebootscript\0" \ + "bootcmd=source $prevbl_initrd_start_addr:bootscript\0" + /* Size of malloc() pool */ #define CONFIG_SYS_BOOTM_LEN SZ_64M -- 2.20.1