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 B5AC2C00528 for ; Fri, 4 Aug 2023 09:51:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CE4EE86667; Fri, 4 Aug 2023 11:51:36 +0200 (CEST) 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="HO71jCMs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4C156867C9; Fri, 4 Aug 2023 11:51:35 +0200 (CEST) Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) (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 C2461862DA for ; Fri, 4 Aug 2023 11:51:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alpernebiyasak@gmail.com Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-317798b359aso1589520f8f.1 for ; Fri, 04 Aug 2023 02:51:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691142692; x=1691747492; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=RzvrRb2Ugw9QU46q8I9Dp0GjHfAOk5XEyKraGE/7Suc=; b=HO71jCMszjmPbq3P5Q772v+oYkk2fk8iwZNSpbXSh+deM67FzhmpkDGIaCp80wriAO 46iqlETKBXU2PA2DEL8kzjtKCCrEQSjW5+S1+IwbycpeU8XaUpw/70gJdw76QShZpA4D zdN/43w3p0LwjOibw6nmFsPak5/0yzuyURdloGryImicCU02Rj6uB9FI68qNFez8o+Sg ykuJz2IsrMqSTl9byD18RjJi0cK3Pa7JZhA6i7BgDWay4nFfl8/zbLGFbWV3Z5yI/0fV kCVHF+/QTCoOJJ+STN4XY/alO262wccM8OTlDKKK4LcIs0oOUPIDVC9q5kOX8lwY2MY9 mFrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691142692; x=1691747492; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RzvrRb2Ugw9QU46q8I9Dp0GjHfAOk5XEyKraGE/7Suc=; b=ZuXqrNltcx0l8K+vtOZNXaUq/drsrQm9zcErgM3XXF4zqRFnb41hKnh7vJwPix+JOF s/kffJkAsY4zSnd2+OTs4gGL45Vdl8S9lnh/b1A6IIPvi0YKx4EkowyqiLfHzGgv2vDG 3GoEtokX6vcWIHnjKj0r92MabTtNbPUH6mCCJEKQqvsavqZLIgALerwRIl7pDKytG6Vu EqKDlFEsQCVB0toLkIpDwkfdj1ujLSeXNRE5OSqJR9rdN55nRRpdZb7jzjMe+EFT2WeY 7fIDr+ICTqBm+pvRQRGbkZcWZT+K8VZCpIcXDdVuEoUsnTHEC6vkHLcuoqAkSQSNeu0U Ijzg== X-Gm-Message-State: AOJu0Yz9G+F8znerV9Hb1sNafu4Nfu3cqvzrPXAt16NGdbcNANJ1guU4 vwNohyZ8xQZDzww1fH9bap0= X-Google-Smtp-Source: AGHT+IG+a/Ojog8ZenXDfh5fel+yl1xTWknO0ZuejVzgHOgPvQ6H3YSDM+Hc3YUKpYKq8D5YyWzpig== X-Received: by 2002:adf:e94b:0:b0:313:f463:9d40 with SMTP id m11-20020adfe94b000000b00313f4639d40mr939576wrn.65.1691142691904; Fri, 04 Aug 2023 02:51:31 -0700 (PDT) Received: from [192.168.0.79] ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id c11-20020a5d4f0b000000b0030fa3567541sm2080505wru.48.2023.08.04.02.51.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Aug 2023 02:51:31 -0700 (PDT) Message-ID: <81f33eb8-2c4a-2716-2516-b297bdbc37b8@gmail.com> Date: Fri, 4 Aug 2023 12:51:29 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 00/16] bootstd: Improve ChromiumOS support To: Simon Glass Cc: U-Boot Mailing List , Bin Meng , Daniel Golle , Heinrich Schuchardt , Mattijs Korpershoek , =?UTF-8?Q?Pali_Roh=C3=A1r?= , Safae Ouajih References: <20230730171709.917352-1-sjg@chromium.org> <0b60edb3-df58-1ff4-9087-2ed19dbbc11d@gmail.com> Content-Language: en-US, tr, en-GB From: Alper Nebi Yasak In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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.8 at phobos.denx.de X-Virus-Status: Clean (Note that I'm not objecting to merging the patchset as is, just detailing future work you/I might want to do for non-CrOS userspace support for this bootmeth.) On 2023-08-04 06:02 +03:00, Simon Glass wrote: > On Thu, 3 Aug 2023 at 15:31, Alper Nebi Yasak wrote: >> I guess it boils down to: >> >> - Enable booting from any chromeos_kernel partition (not just 2 & 4) > > How do you know which ones hold kernels, and which root disks > correspond to each kernel? You should search all those with FE3A2A5D-4F32-41A7-B725-ACCC3285A309 as their GPT partition type GUID. They are ordered wrt/ the type-specific Successful, Priority, Tries attribute flags (bits 56, 55-52, 51-48). The firmware is also supposed to modify these (decrement Tries on each boot attempt, set Priority = 0 if Tries == 0). All these are stock depthcharge behaviour, see ChromiumOS docs [5]. The kernels don't necessarily correspond to a specific root, that's a per-OS concept. For example on Debian, I have two or three of these partitions for the same rootfs used in a cyclic fashion to have A/B-style automatic fallback for kernel/initramfs changes. And there may not be a rootfs at all, like how Debian Installer runs entirely from its initramfs. [5] ChromiumOS Docs - Disk Format - Selecting the kernel https://chromium.googlesource.com/chromiumos/docs/+/HEAD/disk_format.md#selecting-the-kernel >> - Fixup the ramdisk addr/size in x86 setup info after reading the kernel > > But ChromeOS doesn't use ramdisk, right? Not in this way, AFAIK it embeds one into vmlinuz during compile-time? I guess the ramdisk addr/size in x86 setup is 0/0 for ChromeOS indicating there isn't (an external) one. But depthcharge is so minimalistic that it loads everything at a fixed address and passes x86 setup unchanged as prepared beforehand, so I can append a ramdisk to vmlinuz and tell Linux where that will end up in memory behind depthcharge's back. (A bit more complicated than that.) So the thing is, when bootmeth_cros reads the "kernel" data into memory somewhere other than 0x100000, the x86 setup from my images will be pointing to an unrelated location as the ramdisk, which Linux will fail to interpret as a ramdisk and panic. >> - Prepend cros_secure to kernel cmdline > > Does it have to be at the start of the cmdline? Also, the cmdline > comes from cros at present, so does include that normally. I think > the best way is for you to give it a try and see what is needed. Doesn't have to be at the start, but Depthcharge unconditionally prepends it, I do see multiple "cros_secure"s on ChromeOS /proc/cmdline. I'd like to have that here too as a way to identify the boot method, since non-CrOS userspaces will not have configured cmdline to have that. In Debian Installer, I do `grep cros_secure /proc/cmdline` to see if we should set up with depthcharge-tools or something else like GRUB. (Yeah, I should be testing this, but stretched myself too thin.) >> There's a ready made debian-installer image if you want to test [2]. Has >> a partitioning bug defaulting to MBR, but otherwise can install for CrOS >> verified boot as well. (It's what took my last year away from U-Boot). >> >> [1] depthcharge-tools -- Tools to manage the Chrome OS bootloader >> https://github.com/alpernebbi/depthcharge-tools >> >> [2] Debian Installer netboot image for amd64 Chromebooks >> https://d-i.debian.org/daily-images/amd64/daily/netboot/depthcharge/ > > I see the installer, but how do I actually run it on bob, say? I hoped the names were self-evident, but I know I should be writing docs on them, just postponing until they are in better shape. Basically `gzip -d