diff mbox series

[meta-rockchip] Stop u-boot sections partition table

Message ID 20231003012643.113550-1-anthony.t.davies@gmail.com
State New
Headers show
Series [meta-rockchip] Stop u-boot sections partition table | expand

Commit Message

Anthony Davies Oct. 3, 2023, 1:26 a.m. UTC
From: Anthony Davies <anthony.t.davies@gmail.com>

When checking the partition table of builds using this layer you get
numerous extra partitions due to each bootloader entry creating a
partition. --no-table on these entries should stop this from happening.

Signed-off-by: Anthony Davies <anthony.t.davies@gmail.com>
---
 wic/rockchip.wks | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Quentin Schulz Oct. 3, 2023, 10:22 a.m. UTC | #1
Hi Anthony,

On 10/3/23 03:26, Anthony Davies via lists.yoctoproject.org wrote:
> From: Anthony Davies <anthony.t.davies@gmail.com>
> 
> When checking the partition table of builds using this layer you get
> numerous extra partitions due to each bootloader entry creating a
> partition. --no-table on these entries should stop this from happening.
> 
> Signed-off-by: Anthony Davies <anthony.t.davies@gmail.com>

While this is annoying in some aspects, it's also very nice when you 
want to flash a new U-Boot manually for example. You just need to flash 
the raw file in the partition directly instead of having to figure out 
which offset to use. FWIW, I actually do flash by offset instead of by 
partition and I have to remember the offsets for different products (we 
don't use Rockchip's defaults :) ) and I guess this would make things 
easier.

So,
Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Up to Trevor to decide what to do with the patch :)

Cheers,
Quentin

> ---
>   wic/rockchip.wks | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/wic/rockchip.wks b/wic/rockchip.wks
> index 1cc30ae..eb50d8c 100644
> --- a/wic/rockchip.wks
> +++ b/wic/rockchip.wks
> @@ -15,11 +15,11 @@
>   #   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 loader1    --offset 32     --fixed-size 4000K            --source rawcopy           --no-table                            --sourceparams="file=${SPL_BINARY}"
> +part reserved1  --offset 4032   --fixed-size 64K                                         --no-table
> +part reserved2  --offset 4096   --fixed-size 4096K                                       --no-table
> +part loader2    --offset 8192   --fixed-size 4096K            --source rawcopy           --no-table                            --sourceparams="file=u-boot.${UBOOT_SUFFIX}"
> +part atf        --offset 12288  --fixed-size 4096K                                       --no-table
>   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
>   
> 
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#61208): https://lists.yoctoproject.org/g/yocto/message/61208
> Mute This Topic: https://lists.yoctoproject.org/mt/101726546/6293953
> Group Owner: yocto+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [quentin.schulz@theobroma-systems.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Trevor Woerner Oct. 3, 2023, 1:42 p.m. UTC | #2
On Tue 2023-10-03 @ 12:22:01 PM, Quentin Schulz wrote:
> Hi Anthony,
> 
> On 10/3/23 03:26, Anthony Davies via lists.yoctoproject.org wrote:
> > From: Anthony Davies <anthony.t.davies@gmail.com>
> > 
> > When checking the partition table of builds using this layer you get
> > numerous extra partitions due to each bootloader entry creating a
> > partition. --no-table on these entries should stop this from happening.
> > 
> > Signed-off-by: Anthony Davies <anthony.t.davies@gmail.com>
> 
> While this is annoying in some aspects, it's also very nice when you want to
> flash a new U-Boot manually for example. You just need to flash the raw file
> in the partition directly instead of having to figure out which offset to
> use. FWIW, I actually do flash by offset instead of by partition and I have
> to remember the offsets for different products (we don't use Rockchip's
> defaults :) ) and I guess this would make things easier.
> 
> So,
> Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> 
> Up to Trevor to decide what to do with the patch :)

The whole point of partitions is to keep things safely separated from each
other, avoid overruns that clobber adjacent things, and make it easier to
modify contents (flash a partition instead of magic offsets). I've worked with
a device that had hidden/magic offsets and ended up redefining the partition
table to call everything its own partition.

I don't know what we'd be gaining be keeping these "partitions" hidden?

> 
> Cheers,
> Quentin
> 
> > ---
> >   wic/rockchip.wks | 10 +++++-----
> >   1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > diff --git a/wic/rockchip.wks b/wic/rockchip.wks
> > index 1cc30ae..eb50d8c 100644
> > --- a/wic/rockchip.wks
> > +++ b/wic/rockchip.wks
> > @@ -15,11 +15,11 @@
> >   #   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 loader1    --offset 32     --fixed-size 4000K            --source rawcopy           --no-table                            --sourceparams="file=${SPL_BINARY}"
> > +part reserved1  --offset 4032   --fixed-size 64K                                         --no-table
> > +part reserved2  --offset 4096   --fixed-size 4096K                                       --no-table
> > +part loader2    --offset 8192   --fixed-size 4096K            --source rawcopy           --no-table                            --sourceparams="file=u-boot.${UBOOT_SUFFIX}"
> > +part atf        --offset 12288  --fixed-size 4096K                                       --no-table
> >   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
> > 
> > 
> > 
> > -=-=-=-=-=-=-=-=-=-=-=-
> > Links: You receive all messages sent to this group.
> > View/Reply Online (#61208): https://lists.yoctoproject.org/g/yocto/message/61208
> > Mute This Topic: https://lists.yoctoproject.org/mt/101726546/6293953
> > Group Owner: yocto+owner@lists.yoctoproject.org
> > Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [quentin.schulz@theobroma-systems.com]
> > -=-=-=-=-=-=-=-=-=-=-=-
> >
Anthony Davies Oct. 3, 2023, 10:55 p.m. UTC | #3
On Wed, 4 Oct 2023 at 00:42, Trevor Woerner <twoerner@gmail.com> wrote:
>
> On Tue 2023-10-03 @ 12:22:01 PM, Quentin Schulz wrote:
> > Hi Anthony,
> >
> > On 10/3/23 03:26, Anthony Davies via lists.yoctoproject.org wrote:
> > > From: Anthony Davies <anthony.t.davies@gmail.com>
> > >
> > > When checking the partition table of builds using this layer you get
> > > numerous extra partitions due to each bootloader entry creating a
> > > partition. --no-table on these entries should stop this from happening.
> > >
> > > Signed-off-by: Anthony Davies <anthony.t.davies@gmail.com>
> >
> > While this is annoying in some aspects, it's also very nice when you want to
> > flash a new U-Boot manually for example. You just need to flash the raw file
> > in the partition directly instead of having to figure out which offset to
> > use. FWIW, I actually do flash by offset instead of by partition and I have
> > to remember the offsets for different products (we don't use Rockchip's
> > defaults :) ) and I guess this would make things easier.
> >
> > So,
> > Reviewed-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> >
> > Up to Trevor to decide what to do with the patch :)
>
> The whole point of partitions is to keep things safely separated from each
> other, avoid overruns that clobber adjacent things, and make it easier to
> modify contents (flash a partition instead of magic offsets). I've worked with
> a device that had hidden/magic offsets and ended up redefining the partition
> table to call everything its own partition.
>
> I don't know what we'd be gaining be keeping these "partitions" hidden?
>
> >
> > Cheers,
> > Quentin
> >
> > > ---
> > >   wic/rockchip.wks | 10 +++++-----
> > >   1 file changed, 5 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/wic/rockchip.wks b/wic/rockchip.wks
> > > index 1cc30ae..eb50d8c 100644
> > > --- a/wic/rockchip.wks
> > > +++ b/wic/rockchip.wks
> > > @@ -15,11 +15,11 @@
> > >   #   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 loader1    --offset 32     --fixed-size 4000K            --source rawcopy           --no-table                            --sourceparams="file=${SPL_BINARY}"
> > > +part reserved1  --offset 4032   --fixed-size 64K                                         --no-table
> > > +part reserved2  --offset 4096   --fixed-size 4096K                                       --no-table
> > > +part loader2    --offset 8192   --fixed-size 4096K            --source rawcopy           --no-table                            --sourceparams="file=u-boot.${UBOOT_SUFFIX}"
> > > +part atf        --offset 12288  --fixed-size 4096K                                       --no-table
> > >   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
> > >
> > >
> > >
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > > Links: You receive all messages sent to this group.
> > > View/Reply Online (#61208): https://lists.yoctoproject.org/g/yocto/message/61208
> > > Mute This Topic: https://lists.yoctoproject.org/mt/101726546/6293953
> > > Group Owner: yocto+owner@lists.yoctoproject.org
> > > Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [quentin.schulz@theobroma-systems.com]
> > > -=-=-=-=-=-=-=-=-=-=-=-
> > >
Differences in style I guess. To me a partition is really something
you are supposed to be able to format and mount.

To be honest I would be more likely to format the wrong partition and
blow away the binary as I would over run or use an incorrect offset, I
tend to format more then replace a binary file manually.

Having partitions for u-boot binaries is not something I have come across before

I agree with Quentin, ultimately it's up to you as the maintainer.
diff mbox series

Patch

diff --git a/wic/rockchip.wks b/wic/rockchip.wks
index 1cc30ae..eb50d8c 100644
--- a/wic/rockchip.wks
+++ b/wic/rockchip.wks
@@ -15,11 +15,11 @@ 
 #   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 loader1    --offset 32     --fixed-size 4000K            --source rawcopy           --no-table                            --sourceparams="file=${SPL_BINARY}"
+part reserved1  --offset 4032   --fixed-size 64K                                         --no-table
+part reserved2  --offset 4096   --fixed-size 4096K                                       --no-table
+part loader2    --offset 8192   --fixed-size 4096K            --source rawcopy           --no-table                            --sourceparams="file=u-boot.${UBOOT_SUFFIX}"
+part atf        --offset 12288  --fixed-size 4096K                                       --no-table
 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