From patchwork Fri Feb 16 08:29:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Woerner X-Patchwork-Id: 39499 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2074C48260 for ; Fri, 16 Feb 2024 08:29:38 +0000 (UTC) Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by mx.groups.io with SMTP id smtpd.web10.14487.1708072176043498024 for ; Fri, 16 Feb 2024 00:29:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ayGf7bWS; spf=pass (domain: gmail.com, ip: 209.85.219.52, mailfrom: twoerner@gmail.com) Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-6818aa08a33so16747976d6.0 for ; Fri, 16 Feb 2024 00:29:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708072174; x=1708676974; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YJqsbq8CMoCEOTdMXsSQ72nfQDIbQFtlb+IZ1RhEtPE=; b=ayGf7bWSFLvNfZeszHw1cmVG3pJyo9il3BHGbsiX8mCVxurwUT8yjkrjS/wmxVz0Yh axq9Ktmo0d7sH2Gy6Scoz/OwV5O+bNYRh9vuluQnWMIrYxGLYBU5gNzsqCmNgYq5vxou i/3K+H66Do2cWNTUs7ia2r8Pd2Ndlv64HWReiEi7MhLLsUXsWs4hiD41zcxrkk/AfyI8 NcWFVtZR85jLNNW8svpC/ywECNohP1JyOPPhQqI1INDhwN9j07crP8Hkd/qExOjbIt+5 4y0pA/9XBxgHLn0FnRo3ujIeKZF7iSRW5Q2P+41t11WhbcQccjUUSAXXpHCJd2xGghln FS0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708072174; x=1708676974; 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=YJqsbq8CMoCEOTdMXsSQ72nfQDIbQFtlb+IZ1RhEtPE=; b=NRML5gPqYM25EZv2qWy0WTGU0G1uPDmk7AoLTiW0qtkZRHuaMELCe9DSJkueeqEH+l KVgSwyb20kYBxXl7/b427r5P6ynjhbf9pH5x9Ijogp4Vl5qpuHWPfw3iKOlK1jffmczi z0SWTt7FWvBL9+qcqE8PX3tylMKcJLCLw6NUNLE5vxbbGKm0a0WEugA/hIs9Uhp26TE6 KsG/OnUSeMqrgTLH2DRvEC/f4E/2bO2tJKzKcHTKeuwKXcfhQrQKn6fSmZZ5OYauGPdU q+CUo0UCsAhBRbpo8TAzeC5ZQ2EpK3vj/F+STx5XqJJehjHeRPkV4hHP7/RiC22dDTU8 ltfQ== X-Gm-Message-State: AOJu0YxkjUQcn1c9Bv1FhCyflQCBv+ksgRj+OGbKS6OX037BzVEICF0C n1PDnPqllxKt1XioW5H6yibr60mTuCFZ6VcoDjLowz75GjjfAxhZuQcDVtn1 X-Google-Smtp-Source: AGHT+IHpXTl0wWFtv3GkxeqbS2PEqG2jKQZM21QEei5/3jtaao1cavDAQ+jD6Jov8Xq1aYXIUf5CyQ== X-Received: by 2002:a05:6214:44a0:b0:68f:11bf:4213 with SMTP id on32-20020a05621444a000b0068f11bf4213mr10572176qvb.23.1708072174014; Fri, 16 Feb 2024 00:29:34 -0800 (PST) Received: from localhost.localdomain (pppoe-209-91-167-254.vianet.ca. [209.91.167.254]) by smtp.gmail.com with ESMTPSA id ma17-20020a0562145b1100b0068cd399760fsm1522701qvb.61.2024.02.16.00.29.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 00:29:33 -0800 (PST) From: Trevor Woerner To: yocto@lists.yoctoproject.org Cc: Quentin Schulz Subject: [meta-rockchip][PATCH v2 1/4] rockchip.wks: specify fstype Date: Fri, 16 Feb 2024 03:29:19 -0500 Message-ID: <20240216082922.7873-1-twoerner@gmail.com> X-Mailer: git-send-email 2.43.0.76.g1a87c842ece3 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 16 Feb 2024 08:29:38 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/62512 If the wks file doesn't specify, the assumption is that each partition contains a vfat-formatted filesystem. Most of the partitions in the Rockchip layout don't have filesystems. Implicitly setting the fstype to vfat causes wic to format the partitions. It doesn't make sense to format the rawcopy partitions as vfat just to immediately overwrite them with binaries, and it wastes time formatting partitions that won't ever be used as filesystems. Reviewed-by: Quentin Schulz Signed-off-by: Trevor Woerner --- changes in v2: - reword the commit message to add clarity - add Quentin's tag --- wic/rockchip.wks | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/wic/rockchip.wks b/wic/rockchip.wks index fac0b8f70112..b14ec0d1690a 100644 --- a/wic/rockchip.wks +++ b/wic/rockchip.wks @@ -17,12 +17,12 @@ # boot 32768 229376 # root 262144 - (suggested) -part loader1 --offset 32 --fixed-size 4000K --source rawcopy --sourceparams="file=${SPL_BINARY}" -part reserved1 --offset 4032 --fixed-size 64K -part reserved2 --offset 4096 --fixed-size 4096K -part loader2 --offset 8192 --fixed-size 4096K --source rawcopy --sourceparams="file=u-boot.${UBOOT_SUFFIX}" -part atf --offset 12288 --fixed-size 4096K -part /boot --offset 16384 --size 114688K --active --source bootimg-partition --fstype=vfat --label boot --use-uuid --sourceparams="loader=u-boot" -part / --source rootfs --fstype=ext4 --label root --use-uuid +part loader1 --offset 32 --fixed-size 4000K --fstype=none --source rawcopy --sourceparams="file=${SPL_BINARY}" +part reserved1 --offset 4032 --fixed-size 64K --fstype=none +part reserved2 --offset 4096 --fixed-size 4096K --fstype=none +part loader2 --offset 8192 --fixed-size 4096K --fstype=none --source rawcopy --sourceparams="file=u-boot.${UBOOT_SUFFIX}" +part atf --offset 12288 --fixed-size 4096K --fstype=none +part /boot --offset 16384 --size 114688K --fstype=vfat --active --source bootimg-partition --label boot --use-uuid --sourceparams="loader=u-boot" +part / --fstype=ext4 --source rootfs --label root --use-uuid bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw rootfstype=ext4 init=/sbin/init" From patchwork Fri Feb 16 08:29:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Woerner X-Patchwork-Id: 39500 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2EDDC48BEC for ; Fri, 16 Feb 2024 08:29:38 +0000 (UTC) Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) by mx.groups.io with SMTP id smtpd.web11.14615.1708072178417036995 for ; Fri, 16 Feb 2024 00:29:38 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=DIdu2oJR; spf=pass (domain: gmail.com, ip: 209.85.219.42, mailfrom: twoerner@gmail.com) Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-68f111b9d92so10236296d6.1 for ; Fri, 16 Feb 2024 00:29:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708072176; x=1708676976; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DzErnKoX7RPoSPv4XRVR+s4YTsyEqSB+ereBaKmYqEw=; b=DIdu2oJRlSw2iXgeSKamCjEUu55KPCi8+5YgzTMDEZcKQcoZ5M535krEemH9rDBOzS IffnaPdDAJGV8djSSivYa5X+OuZhqI3yD1nZl6jo1wK5eEEp3OOsc5lRG9bYCCUqQu5/ eOR+VDs2/1Ibo5PhbYUtCql1tL8BnBlpC/LDREyoskDxxy5xuSL0IEQWFizr6GPbwSl1 OvYie1gedA+4FvzTQ6QN4OWFZsVrz5lpKhRHBTAsR8dGkA/WTArTeKpDMKhJ/P+ji5eF neqeec8twSbhOtfRMzAaY9wvktjds9m6BDj8whWBIW1Q7p2UYFkQprSTd73srn2pNZuN Q0Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708072176; x=1708676976; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DzErnKoX7RPoSPv4XRVR+s4YTsyEqSB+ereBaKmYqEw=; b=dK8qwfD6jtuCYMh4+nzqEQXRCpcNsD36yWdO0Vv4WSxLGYGQmq+9LGEN1cbF8aqOBd lTNh8j8PZN1kdn8MBJOz83B9GV+2bWtzv2vlnU8geo9tLm7wha4uh20oXGktdoixdGpG Gb+UmuoX2OdI5VsvzeRi9TKeRFrqoD5pxvMx7sZB2A2iSIbVmxhUDNYJ+jGYNay8prTY 9i05gpdZpv/icqnpIR98Z7sj/S//WfqEH1v3Ly6UuQgrccsDZm/XVNpnuTfZvrvPz+ay XtRX6T1KMzwMwYBlC51SzOdBiIjo/Lev2oNKArnZZqrPZUp3YpVMy8wfC2SE38s8ILgJ 9XJg== X-Gm-Message-State: AOJu0YwRonUAnm6IT0ECycs/DIhtXmWQpu+kcdr9YDcx3J+jEagOOTG5 LvpCScfXh49LZ/SGVL9hLNSLf4cKeZjlYUvT9z90ICzuKqH4Se5OfwDbfoP6 X-Google-Smtp-Source: AGHT+IF+QMWKILil6DK3MOzw+UAuZCT7TUEj6DnXnEiiBH6l3dfpO0f5Hfm0476J7NszHa8gvwTs9g== X-Received: by 2002:a05:6214:3d0c:b0:68f:487:d26c with SMTP id ol12-20020a0562143d0c00b0068f0487d26cmr6618920qvb.46.1708072176314; Fri, 16 Feb 2024 00:29:36 -0800 (PST) Received: from localhost.localdomain (pppoe-209-91-167-254.vianet.ca. [209.91.167.254]) by smtp.gmail.com with ESMTPSA id ma17-20020a0562145b1100b0068cd399760fsm1522701qvb.61.2024.02.16.00.29.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 00:29:34 -0800 (PST) From: Trevor Woerner To: yocto@lists.yoctoproject.org Subject: [meta-rockchip][PATCH v2 2/4] rockchip.wks: add all Rockchip partitions Date: Fri, 16 Feb 2024 03:29:20 -0500 Message-ID: <20240216082922.7873-2-twoerner@gmail.com> X-Mailer: git-send-email 2.43.0.76.g1a87c842ece3 In-Reply-To: <20240216082922.7873-1-twoerner@gmail.com> References: <20240216082922.7873-1-twoerner@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 16 Feb 2024 08:29:38 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/62513 Rockchip defines the expected layout/map of the default storage device. Fill out the wks description so it matches. https://opensource.rock-chips.com/wiki_Partitions Note: in the Rockchip layout, not all partitions are expected to show up in the gpt partition table. This patch uses "--no-table" to only number the partitions that are numbered in the Rockchip wiki, as well as to give these partitions the partition numbers indicated in the wiki. Note: there is a mistake in the Rockchip table (which I've copied verbatim here). Going by the values of the "Start Sector", the size of the "reserved1" partition is listed as being 2x its actual size/number of sectors. Expected: Partition Start Sector Number of Sectors Partition Size PartNum in GPT Requirements MBR 0 00000000 1 00000001 512 0.5KB Primary GPT 1 00000001 63 0000003F 32256 31.5KB loader1 64 00000040 7104 00001bc0 4096000 2.5MB 1 preloader (miniloader or U-Boot SPL) Vendor Storage 7168 00001c00 512 00000200 262144 256KB SN, MAC and etc. Reserved Space 7680 00001e00 384 00000180 196608 192KB Not used reserved1 8064 00001f80 128 00000080 65536 64KB legacy DRM key U-Boot ENV 8128 00001fc0 64 00000040 32768 32KB reserved2 8192 00002000 8192 00002000 4194304 4MB legacy parameter loader2 16384 00004000 8192 00002000 4194304 4MB 2 U-Boot or UEFI trust 24576 00006000 8192 00002000 4194304 4MB 3 trusted-os like ATF, OP-TEE boot 32768 00008000 229376 00038000 117440512 112MB 4 kernel, dtb, extlinux.conf, ramdisk rootfs 262144 00040000 - - - -MB 5 Linux system Prior to this patch: # fdisk -l /dev/mmcblk1 GPT PMBR size mismatch (1504727 != 30375935) will be corrected by write. The backup GPT table is not on the end of the device. Disk /dev/mmcblk1: 14.48 GiB, 15552479232 bytes, 30375936 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 00000000-0000-0000-0000-00004D9B9EF0 Device Start End Sectors Size Type /dev/mmcblk1p1 64 8063 8000 3.9M Microsoft basic data /dev/mmcblk1p2 8064 8191 128 64K Microsoft basic data /dev/mmcblk1p3 8192 16383 8192 4M Microsoft basic data /dev/mmcblk1p4 16384 24575 8192 4M Microsoft basic data /dev/mmcblk1p5 24576 32767 8192 4M Microsoft basic data /dev/mmcblk1p6 32768 330955 298188 145.6M Microsoft basic data /dev/mmcblk1p7 330956 1504693 1173738 573.1M Linux filesystem New: # fdisk -l /dev/mmcblk1 GPT PMBR size mismatch (1504727 != 30375935) will be corrected by write. The backup GPT table is not on the end of the device. Disk /dev/mmcblk1: 14.48 GiB, 15552479232 bytes, 30375936 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: gpt Disk identifier: 00000000-0000-0000-0000-00004D9B9EF0 Device Start End Sectors Size Type /dev/mmcblk1p1 64 7167 7104 3.5M Linux filesystem /dev/mmcblk1p2 16384 24575 8192 4M Linux filesystem /dev/mmcblk1p3 24576 32767 8192 4M Linux filesystem /dev/mmcblk1p4 32768 330955 298188 145.6M Microsoft basic data /dev/mmcblk1p5 330956 1504693 1173738 573.1M Linux filesystem Signed-off-by: Trevor Woerner Reviewed-by: Quentin Schulz --- changes in v2: - expand the commit message to show past, expected, and new behaviour - spell out that vstorage stands for "vendor storage" --- wic/rockchip.wks | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/wic/rockchip.wks b/wic/rockchip.wks index b14ec0d1690a..034443d90050 100644 --- a/wic/rockchip.wks +++ b/wic/rockchip.wks @@ -9,17 +9,23 @@ # wic uses 1KB blocks. The following table uses 512 byte sectors: # # Partition Start Sector Number of Sectors -# loader1 64 8000 (idbloader / U-Boot SPL) -# reserved1 8064 128 -# reserved2 8192 8192 +# loader1 64 7104 (idbloader / U-Boot SPL) +# vstorage 7168 512 (vendor storage: e.g. serial number, MAC address, etc) +# reserved 7680 384 (not used) +# reserved1 8064 64 (legacy DRM key) +# uboot_env 8128 64 (U-Boot environment) +# reserved2 8192 8192 (legacy parameters, ATAGS, etc) # loader2 16384 8192 (U-Boot proper) -# atf 24576 8192 +# atf 24576 8192 (trusted OS e.g. ATR, OP-TEE, etc) # boot 32768 229376 # root 262144 - (suggested) -part loader1 --offset 32 --fixed-size 4000K --fstype=none --source rawcopy --sourceparams="file=${SPL_BINARY}" -part reserved1 --offset 4032 --fixed-size 64K --fstype=none -part reserved2 --offset 4096 --fixed-size 4096K --fstype=none +part loader1 --offset 32 --fixed-size 3552K --fstype=none --source rawcopy --sourceparams="file=${SPL_BINARY}" +part vstorage --offset 3584 --fixed-size 256K --fstype=none --no-table +part reserved --offset 3840 --fixed-size 192K --fstype=none --no-table +part reserved1 --offset 4032 --fixed-size 32K --fstype=none --no-table +part uboot_env --offset 4064 --fixed-size 32K --fstype=none --no-table +part reserved2 --offset 4096 --fixed-size 4096K --fstype=none --no-table part loader2 --offset 8192 --fixed-size 4096K --fstype=none --source rawcopy --sourceparams="file=u-boot.${UBOOT_SUFFIX}" part atf --offset 12288 --fixed-size 4096K --fstype=none part /boot --offset 16384 --size 114688K --fstype=vfat --active --source bootimg-partition --label boot --use-uuid --sourceparams="loader=u-boot" From patchwork Fri Feb 16 08:29:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Woerner X-Patchwork-Id: 39502 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7ED0C48BEB for ; Fri, 16 Feb 2024 08:29:48 +0000 (UTC) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by mx.groups.io with SMTP id smtpd.web10.14489.1708072181063803987 for ; Fri, 16 Feb 2024 00:29:41 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=b3pAZa4G; spf=pass (domain: gmail.com, ip: 209.85.219.43, mailfrom: twoerner@gmail.com) Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-6861538916cso10217236d6.3 for ; Fri, 16 Feb 2024 00:29:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708072179; x=1708676979; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=/0zjx/UDQy0kfZLjqxEhpLYDP3NbE1jSLoNjUKggU1s=; b=b3pAZa4GN0rRJ2oufU2LRuNO5slLqPyZyX/GbMxGOasoHziapRWCbxzxfT0vEs1pDd TwIVrsxeIbLp4u6BPrAbyx2vhy1Nh+pfWummFpn38hXtr1Z/PZiATRIXsnSgoFJImJlr zZlkIGx1wXqy37PSkk/dwwPn6ek02fiHfcWK+OXKE4kRZ4e2lhtOjHMtEMTr192MRkeQ HuA+S/TJpCY4Q8/Z8iPH5csZNkI6e58HsfwA0aDYrf1rs0bpBNnOUiZeyliKO1pSQPWy 66T4wE7l6h4yEqQmwhJ7mbRLapXtDUdVJEU0ljx1rR7PLtqBEoneqb7oEr2mdDgcjU4n 0p8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708072179; x=1708676979; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/0zjx/UDQy0kfZLjqxEhpLYDP3NbE1jSLoNjUKggU1s=; b=FY5O4omPp8R4njNe9aeJYRyLs0CVd9t6sRIFrhRP+qZnu92fBqfemT/mhWBgyofIC1 Ju/effzPAKx/d78o7iQy350v189tEfpu9xEyTNpT+ryFb0dYb13KghViYKC44RmZAQps D/To19Ya20ngn2GgOI1iAUEjGvJZNRUalyVGDQCWBfTdCy6ibl0W33WXrbUvx1BtrMWr Dr+jF9Qcvqp2imcHbVzv2GIkmyiE5VDIkQ99QKtvncjOKeLoflzfjXTevBKld/laTmCk +XeRBjqSLz1Fwxhy+oB2VzW49ts/Eft5rGR2mGvcfDhTmWVfN9CkzysVLFadJRIEseI3 crig== X-Gm-Message-State: AOJu0YwoI7AsojV8AXAZvegfLEcl2J3M7t7bwpDnQ8Z8M1wxI8KTKt/5 RlrZ/YADbE8Wn+A0HB7PbW6+qxhpRwk9YyVGcblNO8YdIcXOt8hCxEofn0N6 X-Google-Smtp-Source: AGHT+IFHpabd550BP3kIuFWUet7y8FG9PskFzojJwEfcl37dg8zIZZ+u7ufVybLJGM7RHlS0VDbzZw== X-Received: by 2002:a05:6214:29c7:b0:68c:4f18:b057 with SMTP id gh7-20020a05621429c700b0068c4f18b057mr4839122qvb.39.1708072178872; Fri, 16 Feb 2024 00:29:38 -0800 (PST) Received: from localhost.localdomain (pppoe-209-91-167-254.vianet.ca. [209.91.167.254]) by smtp.gmail.com with ESMTPSA id ma17-20020a0562145b1100b0068cd399760fsm1522701qvb.61.2024.02.16.00.29.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 00:29:36 -0800 (PST) From: Trevor Woerner To: yocto@lists.yoctoproject.org Subject: [meta-rockchip][PATCH v2 3/4] remove /boot partition Date: Fri, 16 Feb 2024 03:29:21 -0500 Message-ID: <20240216082922.7873-3-twoerner@gmail.com> X-Mailer: git-send-email 2.43.0.76.g1a87c842ece3 In-Reply-To: <20240216082922.7873-1-twoerner@gmail.com> References: <20240216082922.7873-1-twoerner@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 16 Feb 2024 08:29:48 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/62514 In order to boot successfully, most Rockchip SoCs require a specific partitioning scheme which was defined many years (and many SoCs) ago. That partitioning scheme places the SPL and U-Boot at specific offsets at the start of the boot block device: https://opensource.rock-chips.com/wiki_Partitions The Rockchip partitioning scheme goes on to also define the locations and sizes of a number of additional partitions, including the "boot" and "root" partitions. Since both the SPL and U-Boot have already been placed on the block device, the "boot" partition only contains the extlinux config file and the kernel+dtb/fitImage; it doesn't contain any bootloader artifacts (other than the extlinux config). The location and size of the SPL partition is a hard dependency since the BOOTROM etched inside the Rockchip SoCs is programmed to load and run a validated binary it finds at this location. The locations, sizes, and contents of the "boot" and "root" partitions are not so rigid since it is U-Boot which interacts with them. U-Boot is very flexible with how it finds boot components, and in its support for various devices, filesystems, sizes, etc. Both oe-core's U-Boot metadata and wic's bootimg-partition script contain logic to generate the extlinux pieces required for a bootloader to boot a Linux system. If both are enabled, the wic pieces silently clobber the U-Boot pieces. However, the mechanisms contained in the U-Boot metadata are much more flexible, from a user's point of view, than the mechanisms in wic's bootimg-partition. If a user wishes to setup some sort of A/B redundant update mechanism, they must have redundant root partitions (in order to update their filesystem contents) but they also need to have redundant boot partitions if they wish to update the kernel as part of their update mechanism. Pairing redundant kernel partitions with redundant filesystem partitions becomes unnecessarily complicated. Therefore it makes sense to combine the kernel and the filesystem into the same partition so that both the kernel and filesystem are updated, or rolled back, in lock-step as one unit. Specific kernel versions and configurations often have dependencies on user-space components and versions. The /boot location is not going away. This patch simply transfers responsibility for its creation to the more flexible U-Boot mechanism and includes the kernel as part of the same partition as the root filesystem. Not only does it add flexibility, it also makes update schemes more straightforward. Although having a separate /boot partition is a "requirement" of the Rockchip partitioning scheme, it is not an actual hard requirement when using a flexible, open-source bootloader (such as U-Boot) instead of using Rockchip's proprietary miniloader, preloader, and trust.img. Signed-off-by: Trevor Woerner --- changes in v2: - add UBOOT_EXTLINUX_FDT and tweak UBOOT_EXTLINUX_FDTDIR to modify their behaviour based on whether or not KERNEL_IMAGETYPE is fitImage - remove extraneous WKS_FILE_DEPENDS - remove "--ptable gpt" from wks - move newly added "earlycon" to UBOOT_EXTLINUX_CONSOLE - re-word the commit message to better explain the behaviour of the Rockchip BootROM --- conf/machine/include/rockchip-defaults.inc | 2 ++ conf/machine/include/rockchip-extlinux.inc | 12 ++++++++++++ conf/machine/include/rockchip-wic.inc | 20 ++------------------ wic/rockchip.wks | 8 ++------ 4 files changed, 18 insertions(+), 24 deletions(-) create mode 100644 conf/machine/include/rockchip-extlinux.inc diff --git a/conf/machine/include/rockchip-defaults.inc b/conf/machine/include/rockchip-defaults.inc index 3ce2e246ab0b..2387eb909934 100644 --- a/conf/machine/include/rockchip-defaults.inc +++ b/conf/machine/include/rockchip-defaults.inc @@ -19,3 +19,5 @@ XSERVER = " \ # misc SERIAL_CONSOLES ?= "1500000;ttyS2" +RK_CONSOLE_BAUD ?= "${@d.getVar('SERIAL_CONSOLES').split(';')[0]}" +RK_CONSOLE_DEVICE ?= "${@d.getVar('SERIAL_CONSOLES').split(';')[1].split()[0]}" diff --git a/conf/machine/include/rockchip-extlinux.inc b/conf/machine/include/rockchip-extlinux.inc new file mode 100644 index 000000000000..3af7ed629e34 --- /dev/null +++ b/conf/machine/include/rockchip-extlinux.inc @@ -0,0 +1,12 @@ +UBOOT_EXTLINUX ?= "1" +UBOOT_EXTLINUX_ROOT ?= "root=PARTLABEL=root" +UBOOT_EXTLINUX_FDTDIR ?= "${@bb.utils.contains('KERNEL_IMAGETYPE', 'fitImage', '', '/boot', d)}" +NONFITDT ?= "${@d.getVar('KERNEL_DEVICETREE').split('/')[1]}" +UBOOT_EXTLINUX_FDT ?= "${@bb.utils.contains('KERNEL_IMAGETYPE', 'fitImage', '', '${NONFITDT}', d)}" +UBOOT_EXTLINUX_CONSOLE ?= "earlycon console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8" +UBOOT_EXTLINUX_KERNEL_ARGS ?= "rootwait rw rootfstype=ext4" +UBOOT_EXTLINUX_KERNEL_IMAGE ?= "/boot/${KERNEL_IMAGETYPE}" +UBOOT_EXTLINUX_LABELS ?= "default" +UBOOT_EXTLINUX_MENU_DESCRIPTION:default ?= "${MACHINE}" + +MACHINE_ESSENTIAL_EXTRA_RRECOMMENDS += "u-boot-extlinux" diff --git a/conf/machine/include/rockchip-wic.inc b/conf/machine/include/rockchip-wic.inc index 67a8310f7d6a..147a36685d7d 100644 --- a/conf/machine/include/rockchip-wic.inc +++ b/conf/machine/include/rockchip-wic.inc @@ -1,33 +1,17 @@ # common meta-rockchip wic/wks items +require conf/machine/include/rockchip-extlinux.inc + SPL_BINARY ?= "idbloader.img" IMAGE_FSTYPES += "wic wic.bmap" WKS_FILE ?= "rockchip.wks" WKS_FILE_DEPENDS ?= " \ - mtools-native \ - dosfstools-native \ e2fsprogs-native \ virtual/bootloader \ - virtual/kernel \ - " -# KERNEL_DEVICETREE follows the pattern of 'rockchip/${SOC_FAMILY}-${BOARD}.dtb' -# but is placed in the deploy directory as simply '${SOC_FAMILY}-${BOARD}.dtb' -# therefore we have to strip off the 'rockchip/' for IMAGE_BOOT_FILES -NONFITDT="${@d.getVar('KERNEL_DEVICETREE').split('/')[1]}" -IMAGE_BOOT_FILES = " \ - ${KERNEL_IMAGETYPE} \ - ${@bb.utils.contains('KERNEL_IMAGETYPE', 'fitImage', '', '${NONFITDT}', d)} \ " -# use the first-defined ; pair in SERIAL_CONSOLES -# for the console parameter in the wks files -RK_CONSOLE_BAUD ?= "${@d.getVar('SERIAL_CONSOLES').split(';')[0]}" -RK_CONSOLE_DEVICE ?= "${@d.getVar('SERIAL_CONSOLES').split(';')[1].split()[0]}" - WICVARS:append = " \ - RK_CONSOLE_BAUD \ - RK_CONSOLE_DEVICE \ SPL_BINARY \ UBOOT_SUFFIX \ " diff --git a/wic/rockchip.wks b/wic/rockchip.wks index 034443d90050..4fccdf668c50 100644 --- a/wic/rockchip.wks +++ b/wic/rockchip.wks @@ -17,8 +17,7 @@ # reserved2 8192 8192 (legacy parameters, ATAGS, etc) # loader2 16384 8192 (U-Boot proper) # atf 24576 8192 (trusted OS e.g. ATR, OP-TEE, etc) -# boot 32768 229376 -# root 262144 - (suggested) +# root 32768 - part loader1 --offset 32 --fixed-size 3552K --fstype=none --source rawcopy --sourceparams="file=${SPL_BINARY}" part vstorage --offset 3584 --fixed-size 256K --fstype=none --no-table @@ -28,7 +27,4 @@ part uboot_env --offset 4064 --fixed-size 32K --fstype=none --no-table part reserved2 --offset 4096 --fixed-size 4096K --fstype=none --no-table part loader2 --offset 8192 --fixed-size 4096K --fstype=none --source rawcopy --sourceparams="file=u-boot.${UBOOT_SUFFIX}" part atf --offset 12288 --fixed-size 4096K --fstype=none -part /boot --offset 16384 --size 114688K --fstype=vfat --active --source bootimg-partition --label boot --use-uuid --sourceparams="loader=u-boot" -part / --fstype=ext4 --source rootfs --label root --use-uuid - -bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw rootfstype=ext4 init=/sbin/init" +part / --offset 16384 --fstype=ext4 --active --source rootfs --label root From patchwork Fri Feb 16 08:29:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Woerner X-Patchwork-Id: 39501 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 aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7F08C48BEC for ; Fri, 16 Feb 2024 08:29:48 +0000 (UTC) Received: from mail-vk1-f182.google.com (mail-vk1-f182.google.com [209.85.221.182]) by mx.groups.io with SMTP id smtpd.web11.14618.1708072183644381577 for ; Fri, 16 Feb 2024 00:29:43 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=YdaBQ4d6; spf=pass (domain: gmail.com, ip: 209.85.221.182, mailfrom: twoerner@gmail.com) Received: by mail-vk1-f182.google.com with SMTP id 71dfb90a1353d-4c02a92d563so99875e0c.3 for ; Fri, 16 Feb 2024 00:29:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708072181; x=1708676981; darn=lists.yoctoproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MScIlaWu/gGTHej418QyST67qfbY+e54NUTk1ABCW7o=; b=YdaBQ4d6a73Cx/LZneWCCsvcDBc3nJ+cZ0WXEWdOnrsm3ZOFR9NbdR+C64dKGfe+o3 Pyta4oZ+250d7Izgsc+PVRLgWEy6hirVkXv6Be2QaV4zR+5lFVerh/MuHgFwPrFF4PTQ VUl3HE2Oq40UAN0+yeS9EsX2jAVL0twDJAL4m8HC4UrpC+p19bO5ZIiDWfuWTfAUx9jl s8JO6IvyWWwuqyjO3GTzhaxOBxkoWcZcrGykT5XuaCe7S1R+VnAY3hfOwYpTXAPsjM6M zmc+ACTRypqK3uRYsT+hkF3H7iWPQzcb/Noc1pKFTDQeEOS31lsK117+PupkYsz20egl xPBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708072181; x=1708676981; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MScIlaWu/gGTHej418QyST67qfbY+e54NUTk1ABCW7o=; b=PpMACLpZ6+8G7l0P/kT1qLd3/ZVSWEkkTJkfVhwDQQWIQFI/Jf/cDD92AEkqkzTkTI wo/2IFdtLvrtPLKvQX1Ip8Z6tYzs0NI2h9pjfuB3KbmuvnLTaq+YbuBcYtFjarw3R3S7 vX/+wEHxfsDk91okKPnAhWR+yc7m1WO2i3F9oVEzax2DURKv124pif9jpwnV7G7T0lpy eP9v5RM6vKkllBB7zloMx9csK/pxoJmrFzHA8ZPAr+jlFRSzDeReiPfKyO2yCz1T3pNl tv/nYFZSl1IYFSL+/dOXilJ+hRas/2am1uIH/+VqVobyKE5eixa+M3osEbqY/XvGOsWO GHxw== X-Gm-Message-State: AOJu0YzYcerz8E/s909nOfpR0Jiner0bIOqAowd+Lq/noD0A8+cHVJw1 toA8j42qQMyatRJ4kk59Ker/AcO5aCpL/wfoioYt6811WP+BJ6gt/xf3RjQW X-Google-Smtp-Source: AGHT+IHOLeURqvftHuZHLUqxWZzy6pM8Zc68rnWyEI++TzlcJxYZK3ywuCqFDhTHdji4ylvSJ/ho4g== X-Received: by 2002:a1f:cd43:0:b0:4bd:752b:8d3d with SMTP id d64-20020a1fcd43000000b004bd752b8d3dmr3427638vkg.9.1708072181340; Fri, 16 Feb 2024 00:29:41 -0800 (PST) Received: from localhost.localdomain (pppoe-209-91-167-254.vianet.ca. [209.91.167.254]) by smtp.gmail.com with ESMTPSA id ma17-20020a0562145b1100b0068cd399760fsm1522701qvb.61.2024.02.16.00.29.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 00:29:39 -0800 (PST) From: Trevor Woerner To: yocto@lists.yoctoproject.org Cc: Quentin Schulz Subject: [meta-rockchip][PATCH v2 4/4] wks file cleanup Date: Fri, 16 Feb 2024 03:29:22 -0500 Message-ID: <20240216082922.7873-4-twoerner@gmail.com> X-Mailer: git-send-email 2.43.0.76.g1a87c842ece3 In-Reply-To: <20240216082922.7873-1-twoerner@gmail.com> References: <20240216082922.7873-1-twoerner@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 16 Feb 2024 08:29:48 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/62515 Cleanup the elements of the wic/rockchip.wks file so they take up less horizontal space. Reviewed-by: Quentin Schulz Signed-off-by: Trevor Woerner --- changes in v2: - add Quentin's tag --- wic/rockchip.wks | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wic/rockchip.wks b/wic/rockchip.wks index 4fccdf668c50..1dcd9d69ada6 100644 --- a/wic/rockchip.wks +++ b/wic/rockchip.wks @@ -19,12 +19,12 @@ # atf 24576 8192 (trusted OS e.g. ATR, OP-TEE, etc) # root 32768 - -part loader1 --offset 32 --fixed-size 3552K --fstype=none --source rawcopy --sourceparams="file=${SPL_BINARY}" +part loader1 --offset 32 --fixed-size 3552K --fstype=none --source rawcopy --sourceparams="file=${SPL_BINARY}" part vstorage --offset 3584 --fixed-size 256K --fstype=none --no-table part reserved --offset 3840 --fixed-size 192K --fstype=none --no-table part reserved1 --offset 4032 --fixed-size 32K --fstype=none --no-table part uboot_env --offset 4064 --fixed-size 32K --fstype=none --no-table part reserved2 --offset 4096 --fixed-size 4096K --fstype=none --no-table -part loader2 --offset 8192 --fixed-size 4096K --fstype=none --source rawcopy --sourceparams="file=u-boot.${UBOOT_SUFFIX}" +part loader2 --offset 8192 --fixed-size 4096K --fstype=none --source rawcopy --sourceparams="file=u-boot.${UBOOT_SUFFIX}" part atf --offset 12288 --fixed-size 4096K --fstype=none -part / --offset 16384 --fstype=ext4 --active --source rootfs --label root +part / --offset 16384 --active --fstype=ext4 --label root --source rootfs