All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
@ 2017-02-17  7:57 Eddie Cai
  2017-02-22  3:59 ` Simon Glass
  0 siblings, 1 reply; 10+ messages in thread
From: Eddie Cai @ 2017-02-17  7:57 UTC (permalink / raw
  To: u-boot

Auto write GPT table if fail to get GPT table when scan_dev_for_boot_part

Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
---
 arch/arm/mach-rockchip/rk3036-board.c | 20 ++++++++++++++-
 arch/arm/mach-rockchip/rk3288-board.c | 20 ++++++++++++++-
 arch/arm/mach-rockchip/rk3399-board.c | 46 +++++++++++++++++++++++++++++++++++
 3 files changed, 84 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk3399-board.c

diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c
index bf2b268..e9aeaff 100644
--- a/arch/arm/mach-rockchip/rk3036-board.c
+++ b/arch/arm/mach-rockchip/rk3036-board.c
@@ -51,7 +51,25 @@ __weak int rk_board_late_init(void)
 int board_late_init(void)
 {
 	setup_boot_mode();
-
+	setenv("scan_dev_for_boot_part",
+			"part list ${devtype} ${devnum} -bootable test; "
+			"if env exists test; then "
+			       "echo Found valid partition table; "
+			"else "
+	               "echo No valid partition table, write the original partition table; "
+			       "gpt write ${devtype} ${devnum} ${partitions}; "
+			       "mmc rescan;"
+			"fi;"
+			"part list ${devtype} ${devnum} -bootable devplist; "
+			"env exists devplist || setenv devplist 1; "
+			"for distro_bootpart in ${devplist}; do "
+			    "if fstype ${devtype} "
+			            "${devnum}:${distro_bootpart} "
+			            "bootfstype; then "
+			        "run scan_dev_for_boot; "
+			      "fi; "
+			"done\0"
+	);
 	return rk_board_late_init();
 }
 
diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
index 9894a25..386b155 100644
--- a/arch/arm/mach-rockchip/rk3288-board.c
+++ b/arch/arm/mach-rockchip/rk3288-board.c
@@ -74,7 +74,25 @@ int board_late_init(void)
 {
 	setup_boot_mode();
 	rk3288_qos_init();
-
+	setenv("scan_dev_for_boot_part",
+			"part list ${devtype} ${devnum} -bootable test; "
+			"if env exists test; then "
+			       "echo Found valid partition table; "
+			"else "
+	               "echo No valid partition table, write the original partition table; "
+			       "gpt write ${devtype} ${devnum} ${partitions}; "
+			       "mmc rescan;"
+			"fi;"
+			"part list ${devtype} ${devnum} -bootable devplist; "
+			"env exists devplist || setenv devplist 1; "
+			"for distro_bootpart in ${devplist}; do "
+			    "if fstype ${devtype} "
+			            "${devnum}:${distro_bootpart} "
+			            "bootfstype; then "
+			        "run scan_dev_for_boot; "
+			      "fi; "
+			"done\0"
+	);
 	return rk_board_late_init();
 }
 
diff --git a/arch/arm/mach-rockchip/rk3399-board.c b/arch/arm/mach-rockchip/rk3399-board.c
new file mode 100644
index 0000000..3777643
--- /dev/null
+++ b/arch/arm/mach-rockchip/rk3399-board.c
@@ -0,0 +1,46 @@
+/*
+ * (C) Copyright 2017 ockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <clk.h>
+#include <dm.h>
+#include <ram.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/periph.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+__weak int rk_board_late_init(void)
+{
+	return 0;
+}
+
+int board_late_init(void)
+{
+	setenv("scan_dev_for_boot_part",
+			"part list ${devtype} ${devnum} -bootable test; "
+			"if env exists test; then "
+			       "echo Found valid partition table; "
+			"else "
+	               "echo No valid partition table, write the original partition table; "
+			       "gpt write ${devtype} ${devnum} ${partitions}; "
+			       "mmc rescan;"
+			"fi;"
+			"part list ${devtype} ${devnum} -bootable devplist; "
+			"env exists devplist || setenv devplist 1; "
+			"for distro_bootpart in ${devplist}; do "
+			    "if fstype ${devtype} "
+			            "${devnum}:${distro_bootpart} "
+			            "bootfstype; then "
+			        "run scan_dev_for_boot; "
+			      "fi; "
+			"done\0"
+	);
+	return rk_board_late_init();
+}
+
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
  2017-02-17  7:57 [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC Eddie Cai
@ 2017-02-22  3:59 ` Simon Glass
  2017-02-22  9:05   ` Eddie Cai
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Glass @ 2017-02-22  3:59 UTC (permalink / raw
  To: u-boot

Hi Eddie,

On 17 February 2017 at 00:57, Eddie Cai <eddie.cai.linux@gmail.com> wrote:
> Auto write GPT table if fail to get GPT table when scan_dev_for_boot_part
>
> Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
> ---
>  arch/arm/mach-rockchip/rk3036-board.c | 20 ++++++++++++++-
>  arch/arm/mach-rockchip/rk3288-board.c | 20 ++++++++++++++-
>  arch/arm/mach-rockchip/rk3399-board.c | 46 +++++++++++++++++++++++++++++++++++
>  3 files changed, 84 insertions(+), 2 deletions(-)
>  create mode 100644 arch/arm/mach-rockchip/rk3399-board.c
>
> diff --git a/arch/arm/mach-rockchip/rk3036-board.c b/arch/arm/mach-rockchip/rk3036-board.c
> index bf2b268..e9aeaff 100644
> --- a/arch/arm/mach-rockchip/rk3036-board.c
> +++ b/arch/arm/mach-rockchip/rk3036-board.c
> @@ -51,7 +51,25 @@ __weak int rk_board_late_init(void)
>  int board_late_init(void)
>  {
>         setup_boot_mode();
> -
> +       setenv("scan_dev_for_boot_part",
> +                       "part list ${devtype} ${devnum} -bootable test; "
> +                       "if env exists test; then "
> +                              "echo Found valid partition table; "
> +                       "else "
> +                      "echo No valid partition table, write the original partition table; "
> +                              "gpt write ${devtype} ${devnum} ${partitions}; "
> +                              "mmc rescan;"
> +                       "fi;"
> +                       "part list ${devtype} ${devnum} -bootable devplist; "
> +                       "env exists devplist || setenv devplist 1; "
> +                       "for distro_bootpart in ${devplist}; do "
> +                           "if fstype ${devtype} "
> +                                   "${devnum}:${distro_bootpart} "
> +                                   "bootfstype; then "
> +                               "run scan_dev_for_boot; "
> +                             "fi; "
> +                       "done\0"
> +       );
>         return rk_board_late_init();
>  }
>
> diff --git a/arch/arm/mach-rockchip/rk3288-board.c b/arch/arm/mach-rockchip/rk3288-board.c
> index 9894a25..386b155 100644
> --- a/arch/arm/mach-rockchip/rk3288-board.c
> +++ b/arch/arm/mach-rockchip/rk3288-board.c
> @@ -74,7 +74,25 @@ int board_late_init(void)
>  {
>         setup_boot_mode();
>         rk3288_qos_init();
> -
> +       setenv("scan_dev_for_boot_part",
> +                       "part list ${devtype} ${devnum} -bootable test; "
> +                       "if env exists test; then "
> +                              "echo Found valid partition table; "
> +                       "else "
> +                      "echo No valid partition table, write the original partition table; "
> +                              "gpt write ${devtype} ${devnum} ${partitions}; "
> +                              "mmc rescan;"
> +                       "fi;"
> +                       "part list ${devtype} ${devnum} -bootable devplist; "
> +                       "env exists devplist || setenv devplist 1; "
> +                       "for distro_bootpart in ${devplist}; do "
> +                           "if fstype ${devtype} "
> +                                   "${devnum}:${distro_bootpart} "
> +                                   "bootfstype; then "
> +                               "run scan_dev_for_boot; "
> +                             "fi; "
> +                       "done\0"
> +       );
>         return rk_board_late_init();
>  }
>
> diff --git a/arch/arm/mach-rockchip/rk3399-board.c b/arch/arm/mach-rockchip/rk3399-board.c
> new file mode 100644
> index 0000000..3777643
> --- /dev/null
> +++ b/arch/arm/mach-rockchip/rk3399-board.c
> @@ -0,0 +1,46 @@
> +/*
> + * (C) Copyright 2017 ockchip Electronics Co., Ltd
> + *
> + * SPDX-License-Identifier:     GPL-2.0+
> + */
> +
> +#include <common.h>
> +#include <clk.h>
> +#include <dm.h>
> +#include <ram.h>
> +#include <syscon.h>
> +#include <asm/io.h>
> +#include <asm/arch/clock.h>
> +#include <asm/arch/periph.h>
> +
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +__weak int rk_board_late_init(void)
> +{
> +       return 0;
> +}
> +
> +int board_late_init(void)
> +{
> +       setenv("scan_dev_for_boot_part",
> +                       "part list ${devtype} ${devnum} -bootable test; "
> +                       "if env exists test; then "
> +                              "echo Found valid partition table; "
> +                       "else "
> +                      "echo No valid partition table, write the original partition table; "
> +                              "gpt write ${devtype} ${devnum} ${partitions}; "
> +                              "mmc rescan;"
> +                       "fi;"
> +                       "part list ${devtype} ${devnum} -bootable devplist; "
> +                       "env exists devplist || setenv devplist 1; "
> +                       "for distro_bootpart in ${devplist}; do "
> +                           "if fstype ${devtype} "
> +                                   "${devnum}:${distro_bootpart} "
> +                                   "bootfstype; then "
> +                               "run scan_dev_for_boot; "
> +                             "fi; "
> +                       "done\0"

What is the purpose of this setenv()?

> +       );
> +       return rk_board_late_init();
> +}
> +
> --
> 2.7.4
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
  2017-02-22  3:59 ` Simon Glass
@ 2017-02-22  9:05   ` Eddie Cai
  2017-02-22 14:12     ` Eddie Cai
  0 siblings, 1 reply; 10+ messages in thread
From: Eddie Cai @ 2017-02-22  9:05 UTC (permalink / raw
  To: u-boot

Hi Simon

2017-02-22 11:59 GMT+08:00 Simon Glass <sjg@chromium.org>:

> Hi Eddie,
>
> On 17 February 2017 at 00:57, Eddie Cai <eddie.cai.linux@gmail.com> wrote:
> > Auto write GPT table if fail to get GPT table when scan_dev_for_boot_part
> >
> > Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
> > ---
> >  arch/arm/mach-rockchip/rk3036-board.c | 20 ++++++++++++++-
> >  arch/arm/mach-rockchip/rk3288-board.c | 20 ++++++++++++++-
> >  arch/arm/mach-rockchip/rk3399-board.c | 46
> +++++++++++++++++++++++++++++++++++
> >  3 files changed, 84 insertions(+), 2 deletions(-)
> >  create mode 100644 arch/arm/mach-rockchip/rk3399-board.c
> >
> > diff --git a/arch/arm/mach-rockchip/rk3036-board.c
> b/arch/arm/mach-rockchip/rk3036-board.c
> > index bf2b268..e9aeaff 100644
> > --- a/arch/arm/mach-rockchip/rk3036-board.c
> > +++ b/arch/arm/mach-rockchip/rk3036-board.c
> > @@ -51,7 +51,25 @@ __weak int rk_board_late_init(void)
> >  int board_late_init(void)
> >  {
> >         setup_boot_mode();
> > -
> > +       setenv("scan_dev_for_boot_part",
> > +                       "part list ${devtype} ${devnum} -bootable test; "
> > +                       "if env exists test; then "
> > +                              "echo Found valid partition table; "
> > +                       "else "
> > +                      "echo No valid partition table, write the
> original partition table; "
> > +                              "gpt write ${devtype} ${devnum}
> ${partitions}; "
> > +                              "mmc rescan;"
> > +                       "fi;"
> > +                       "part list ${devtype} ${devnum} -bootable
> devplist; "
> > +                       "env exists devplist || setenv devplist 1; "
> > +                       "for distro_bootpart in ${devplist}; do "
> > +                           "if fstype ${devtype} "
> > +                                   "${devnum}:${distro_bootpart} "
> > +                                   "bootfstype; then "
> > +                               "run scan_dev_for_boot; "
> > +                             "fi; "
> > +                       "done\0"
> > +       );
> >         return rk_board_late_init();
> >  }
> >
> > diff --git a/arch/arm/mach-rockchip/rk3288-board.c
> b/arch/arm/mach-rockchip/rk3288-board.c
> > index 9894a25..386b155 100644
> > --- a/arch/arm/mach-rockchip/rk3288-board.c
> > +++ b/arch/arm/mach-rockchip/rk3288-board.c
> > @@ -74,7 +74,25 @@ int board_late_init(void)
> >  {
> >         setup_boot_mode();
> >         rk3288_qos_init();
> > -
> > +       setenv("scan_dev_for_boot_part",
> > +                       "part list ${devtype} ${devnum} -bootable test; "
> > +                       "if env exists test; then "
> > +                              "echo Found valid partition table; "
> > +                       "else "
> > +                      "echo No valid partition table, write the
> original partition table; "
> > +                              "gpt write ${devtype} ${devnum}
> ${partitions}; "
> > +                              "mmc rescan;"
> > +                       "fi;"
> > +                       "part list ${devtype} ${devnum} -bootable
> devplist; "
> > +                       "env exists devplist || setenv devplist 1; "
> > +                       "for distro_bootpart in ${devplist}; do "
> > +                           "if fstype ${devtype} "
> > +                                   "${devnum}:${distro_bootpart} "
> > +                                   "bootfstype; then "
> > +                               "run scan_dev_for_boot; "
> > +                             "fi; "
> > +                       "done\0"
> > +       );
> >         return rk_board_late_init();
> >  }
> >
> > diff --git a/arch/arm/mach-rockchip/rk3399-board.c
> b/arch/arm/mach-rockchip/rk3399-board.c
> > new file mode 100644
> > index 0000000..3777643
> > --- /dev/null
> > +++ b/arch/arm/mach-rockchip/rk3399-board.c
> > @@ -0,0 +1,46 @@
> > +/*
> > + * (C) Copyright 2017 ockchip Electronics Co., Ltd
> > + *
> > + * SPDX-License-Identifier:     GPL-2.0+
> > + */
> > +
> > +#include <common.h>
> > +#include <clk.h>
> > +#include <dm.h>
> > +#include <ram.h>
> > +#include <syscon.h>
> > +#include <asm/io.h>
> > +#include <asm/arch/clock.h>
> > +#include <asm/arch/periph.h>
> > +
> > +DECLARE_GLOBAL_DATA_PTR;
> > +
> > +__weak int rk_board_late_init(void)
> > +{
> > +       return 0;
> > +}
> > +
> > +int board_late_init(void)
> > +{
> > +       setenv("scan_dev_for_boot_part",
> > +                       "part list ${devtype} ${devnum} -bootable test; "
> > +                       "if env exists test; then "
> > +                              "echo Found valid partition table; "
> > +                       "else "
> > +                      "echo No valid partition table, write the
> original partition table; "
> > +                              "gpt write ${devtype} ${devnum}
> ${partitions}; "
> > +                              "mmc rescan;"
> > +                       "fi;"
> > +                       "part list ${devtype} ${devnum} -bootable
> devplist; "
> > +                       "env exists devplist || setenv devplist 1; "
> > +                       "for distro_bootpart in ${devplist}; do "
> > +                           "if fstype ${devtype} "
> > +                                   "${devnum}:${distro_bootpart} "
> > +                                   "bootfstype; then "
> > +                               "run scan_dev_for_boot; "
> > +                             "fi; "
> > +                       "done\0"
>
> What is the purpose of this setenv()?
>
Auto write GPT table when scan_dev_for_boot_part fail to find a valid one

>
> > +       );
> > +       return rk_board_late_init();
> > +}
> > +
> > --
> > 2.7.4
> >
>
> Regards,
> Simon
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
  2017-02-22  9:05   ` Eddie Cai
@ 2017-02-22 14:12     ` Eddie Cai
  2017-02-23  3:33       ` Simon Glass
  0 siblings, 1 reply; 10+ messages in thread
From: Eddie Cai @ 2017-02-22 14:12 UTC (permalink / raw
  To: u-boot

Hi Simon

2017-02-22 17:05 GMT+08:00 Eddie Cai <eddie.cai.linux@gmail.com>:

> Hi Simon
>
> 2017-02-22 11:59 GMT+08:00 Simon Glass <sjg@chromium.org>:
>
>> Hi Eddie,
>>
>> On 17 February 2017 at 00:57, Eddie Cai <eddie.cai.linux@gmail.com>
>> wrote:
>> > Auto write GPT table if fail to get GPT table when
>> scan_dev_for_boot_part
>> >
>> > Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
>> > ---
>> >  arch/arm/mach-rockchip/rk3036-board.c | 20 ++++++++++++++-
>> >  arch/arm/mach-rockchip/rk3288-board.c | 20 ++++++++++++++-
>> >  arch/arm/mach-rockchip/rk3399-board.c | 46
>> +++++++++++++++++++++++++++++++++++
>> >  3 files changed, 84 insertions(+), 2 deletions(-)
>> >  create mode 100644 arch/arm/mach-rockchip/rk3399-board.c
>> >
>> > diff --git a/arch/arm/mach-rockchip/rk3036-board.c
>> b/arch/arm/mach-rockchip/rk3036-board.c
>> > index bf2b268..e9aeaff 100644
>> > --- a/arch/arm/mach-rockchip/rk3036-board.c
>> > +++ b/arch/arm/mach-rockchip/rk3036-board.c
>> > @@ -51,7 +51,25 @@ __weak int rk_board_late_init(void)
>> >  int board_late_init(void)
>> >  {
>> >         setup_boot_mode();
>> > -
>> > +       setenv("scan_dev_for_boot_part",
>> > +                       "part list ${devtype} ${devnum} -bootable test;
>> "
>> > +                       "if env exists test; then "
>> > +                              "echo Found valid partition table; "
>> > +                       "else "
>> > +                      "echo No valid partition table, write the
>> original partition table; "
>> > +                              "gpt write ${devtype} ${devnum}
>> ${partitions}; "
>> > +                              "mmc rescan;"
>> > +                       "fi;"
>> > +                       "part list ${devtype} ${devnum} -bootable
>> devplist; "
>> > +                       "env exists devplist || setenv devplist 1; "
>> > +                       "for distro_bootpart in ${devplist}; do "
>> > +                           "if fstype ${devtype} "
>> > +                                   "${devnum}:${distro_bootpart} "
>> > +                                   "bootfstype; then "
>> > +                               "run scan_dev_for_boot; "
>> > +                             "fi; "
>> > +                       "done\0"
>> > +       );
>> >         return rk_board_late_init();
>> >  }
>> >
>> > diff --git a/arch/arm/mach-rockchip/rk3288-board.c
>> b/arch/arm/mach-rockchip/rk3288-board.c
>> > index 9894a25..386b155 100644
>> > --- a/arch/arm/mach-rockchip/rk3288-board.c
>> > +++ b/arch/arm/mach-rockchip/rk3288-board.c
>> > @@ -74,7 +74,25 @@ int board_late_init(void)
>> >  {
>> >         setup_boot_mode();
>> >         rk3288_qos_init();
>> > -
>> > +       setenv("scan_dev_for_boot_part",
>> > +                       "part list ${devtype} ${devnum} -bootable test;
>> "
>> > +                       "if env exists test; then "
>> > +                              "echo Found valid partition table; "
>> > +                       "else "
>> > +                      "echo No valid partition table, write the
>> original partition table; "
>> > +                              "gpt write ${devtype} ${devnum}
>> ${partitions}; "
>> > +                              "mmc rescan;"
>> > +                       "fi;"
>> > +                       "part list ${devtype} ${devnum} -bootable
>> devplist; "
>> > +                       "env exists devplist || setenv devplist 1; "
>> > +                       "for distro_bootpart in ${devplist}; do "
>> > +                           "if fstype ${devtype} "
>> > +                                   "${devnum}:${distro_bootpart} "
>> > +                                   "bootfstype; then "
>> > +                               "run scan_dev_for_boot; "
>> > +                             "fi; "
>> > +                       "done\0"
>> > +       );
>> >         return rk_board_late_init();
>> >  }
>> >
>> > diff --git a/arch/arm/mach-rockchip/rk3399-board.c
>> b/arch/arm/mach-rockchip/rk3399-board.c
>> > new file mode 100644
>> > index 0000000..3777643
>> > --- /dev/null
>> > +++ b/arch/arm/mach-rockchip/rk3399-board.c
>> > @@ -0,0 +1,46 @@
>> > +/*
>> > + * (C) Copyright 2017 ockchip Electronics Co., Ltd
>> > + *
>> > + * SPDX-License-Identifier:     GPL-2.0+
>> > + */
>> > +
>> > +#include <common.h>
>> > +#include <clk.h>
>> > +#include <dm.h>
>> > +#include <ram.h>
>> > +#include <syscon.h>
>> > +#include <asm/io.h>
>> > +#include <asm/arch/clock.h>
>> > +#include <asm/arch/periph.h>
>> > +
>> > +DECLARE_GLOBAL_DATA_PTR;
>> > +
>> > +__weak int rk_board_late_init(void)
>> > +{
>> > +       return 0;
>> > +}
>> > +
>> > +int board_late_init(void)
>> > +{
>> > +       setenv("scan_dev_for_boot_part",
>> > +                       "part list ${devtype} ${devnum} -bootable test;
>> "
>> > +                       "if env exists test; then "
>> > +                              "echo Found valid partition table; "
>> > +                       "else "
>> > +                      "echo No valid partition table, write the
>> original partition table; "
>> > +                              "gpt write ${devtype} ${devnum}
>> ${partitions}; "
>> > +                              "mmc rescan;"
>> > +                       "fi;"
>> > +                       "part list ${devtype} ${devnum} -bootable
>> devplist; "
>> > +                       "env exists devplist || setenv devplist 1; "
>> > +                       "for distro_bootpart in ${devplist}; do "
>> > +                           "if fstype ${devtype} "
>> > +                                   "${devnum}:${distro_bootpart} "
>> > +                                   "bootfstype; then "
>> > +                               "run scan_dev_for_boot; "
>> > +                             "fi; "
>> > +                       "done\0"
>>
>> What is the purpose of this setenv()?
>>
> Auto write GPT table when scan_dev_for_boot_part fail to find a valid one
>
To be more clearly. If the GPT table in the boot media corrupted. Or there
is no GPT table in the boot media.  The original scan_dev_for_boot_part
will fail to find a  bootable partition. I just let it write GPT table when
can not find a valid one.

>
>> > +       );
>> > +       return rk_board_late_init();
>> > +}
>> > +
>> > --
>> > 2.7.4
>> >
>>
>> Regards,
>> Simon
>>
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
  2017-02-22 14:12     ` Eddie Cai
@ 2017-02-23  3:33       ` Simon Glass
  2017-03-06  6:46         ` Eddie Cai
  0 siblings, 1 reply; 10+ messages in thread
From: Simon Glass @ 2017-02-23  3:33 UTC (permalink / raw
  To: u-boot

Hi Eddie,

On 22 February 2017 at 07:12, Eddie Cai <eddie.cai.linux@gmail.com> wrote:
> Hi Simon
>
> 2017-02-22 17:05 GMT+08:00 Eddie Cai <eddie.cai.linux@gmail.com>:
>>
>> Hi Simon
>>
>> 2017-02-22 11:59 GMT+08:00 Simon Glass <sjg@chromium.org>:
>>>
>>> Hi Eddie,
>>>
>>> On 17 February 2017 at 00:57, Eddie Cai <eddie.cai.linux@gmail.com>
>>> wrote:
>>> > Auto write GPT table if fail to get GPT table when
>>> > scan_dev_for_boot_part
>>> >
>>> > Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
>>> > ---
>>> >  arch/arm/mach-rockchip/rk3036-board.c | 20 ++++++++++++++-
>>> >  arch/arm/mach-rockchip/rk3288-board.c | 20 ++++++++++++++-
>>> >  arch/arm/mach-rockchip/rk3399-board.c | 46
>>> > +++++++++++++++++++++++++++++++++++
>>> >  3 files changed, 84 insertions(+), 2 deletions(-)
>>> >  create mode 100644 arch/arm/mach-rockchip/rk3399-board.c
>>> >
>>> > diff --git a/arch/arm/mach-rockchip/rk3036-board.c
>>> > b/arch/arm/mach-rockchip/rk3036-board.c
>>> > index bf2b268..e9aeaff 100644
>>> > --- a/arch/arm/mach-rockchip/rk3036-board.c
>>> > +++ b/arch/arm/mach-rockchip/rk3036-board.c
>>> > @@ -51,7 +51,25 @@ __weak int rk_board_late_init(void)
>>> >  int board_late_init(void)
>>> >  {
>>> >         setup_boot_mode();
>>> > -
>>> > +       setenv("scan_dev_for_boot_part",
>>> > +                       "part list ${devtype} ${devnum} -bootable test;
>>> > "
>>> > +                       "if env exists test; then "
>>> > +                              "echo Found valid partition table; "
>>> > +                       "else "
>>> > +                      "echo No valid partition table, write the
>>> > original partition table; "
>>> > +                              "gpt write ${devtype} ${devnum}
>>> > ${partitions}; "
>>> > +                              "mmc rescan;"
>>> > +                       "fi;"
>>> > +                       "part list ${devtype} ${devnum} -bootable
>>> > devplist; "
>>> > +                       "env exists devplist || setenv devplist 1; "
>>> > +                       "for distro_bootpart in ${devplist}; do "
>>> > +                           "if fstype ${devtype} "
>>> > +                                   "${devnum}:${distro_bootpart} "
>>> > +                                   "bootfstype; then "
>>> > +                               "run scan_dev_for_boot; "
>>> > +                             "fi; "
>>> > +                       "done\0"
>>> > +       );
>>> >         return rk_board_late_init();
>>> >  }
>>> >
>>> > diff --git a/arch/arm/mach-rockchip/rk3288-board.c
>>> > b/arch/arm/mach-rockchip/rk3288-board.c
>>> > index 9894a25..386b155 100644
>>> > --- a/arch/arm/mach-rockchip/rk3288-board.c
>>> > +++ b/arch/arm/mach-rockchip/rk3288-board.c
>>> > @@ -74,7 +74,25 @@ int board_late_init(void)
>>> >  {
>>> >         setup_boot_mode();
>>> >         rk3288_qos_init();
>>> > -
>>> > +       setenv("scan_dev_for_boot_part",
>>> > +                       "part list ${devtype} ${devnum} -bootable test;
>>> > "
>>> > +                       "if env exists test; then "
>>> > +                              "echo Found valid partition table; "
>>> > +                       "else "
>>> > +                      "echo No valid partition table, write the
>>> > original partition table; "
>>> > +                              "gpt write ${devtype} ${devnum}
>>> > ${partitions}; "
>>> > +                              "mmc rescan;"
>>> > +                       "fi;"
>>> > +                       "part list ${devtype} ${devnum} -bootable
>>> > devplist; "
>>> > +                       "env exists devplist || setenv devplist 1; "
>>> > +                       "for distro_bootpart in ${devplist}; do "
>>> > +                           "if fstype ${devtype} "
>>> > +                                   "${devnum}:${distro_bootpart} "
>>> > +                                   "bootfstype; then "
>>> > +                               "run scan_dev_for_boot; "
>>> > +                             "fi; "
>>> > +                       "done\0"
>>> > +       );
>>> >         return rk_board_late_init();
>>> >  }
>>> >
>>> > diff --git a/arch/arm/mach-rockchip/rk3399-board.c
>>> > b/arch/arm/mach-rockchip/rk3399-board.c
>>> > new file mode 100644
>>> > index 0000000..3777643
>>> > --- /dev/null
>>> > +++ b/arch/arm/mach-rockchip/rk3399-board.c
>>> > @@ -0,0 +1,46 @@
>>> > +/*
>>> > + * (C) Copyright 2017 ockchip Electronics Co., Ltd
>>> > + *
>>> > + * SPDX-License-Identifier:     GPL-2.0+
>>> > + */
>>> > +
>>> > +#include <common.h>
>>> > +#include <clk.h>
>>> > +#include <dm.h>
>>> > +#include <ram.h>
>>> > +#include <syscon.h>
>>> > +#include <asm/io.h>
>>> > +#include <asm/arch/clock.h>
>>> > +#include <asm/arch/periph.h>
>>> > +
>>> > +DECLARE_GLOBAL_DATA_PTR;
>>> > +
>>> > +__weak int rk_board_late_init(void)
>>> > +{
>>> > +       return 0;
>>> > +}
>>> > +
>>> > +int board_late_init(void)
>>> > +{
>>> > +       setenv("scan_dev_for_boot_part",
>>> > +                       "part list ${devtype} ${devnum} -bootable test;
>>> > "
>>> > +                       "if env exists test; then "
>>> > +                              "echo Found valid partition table; "
>>> > +                       "else "
>>> > +                      "echo No valid partition table, write the
>>> > original partition table; "
>>> > +                              "gpt write ${devtype} ${devnum}
>>> > ${partitions}; "
>>> > +                              "mmc rescan;"
>>> > +                       "fi;"
>>> > +                       "part list ${devtype} ${devnum} -bootable
>>> > devplist; "
>>> > +                       "env exists devplist || setenv devplist 1; "
>>> > +                       "for distro_bootpart in ${devplist}; do "
>>> > +                           "if fstype ${devtype} "
>>> > +                                   "${devnum}:${distro_bootpart} "
>>> > +                                   "bootfstype; then "
>>> > +                               "run scan_dev_for_boot; "
>>> > +                             "fi; "
>>> > +                       "done\0"
>>>
>>> What is the purpose of this setenv()?
>>
>> Auto write GPT table when scan_dev_for_boot_part fail to find a valid one
>
> To be more clearly. If the GPT table in the boot media corrupted. Or there
> is no GPT table in the boot media.  The original scan_dev_for_boot_part will
> fail to find a  bootable partition. I just let it write GPT table when can
> not find a valid one.
>>>

OK, but you should not be changing the environment in your code. Can
you add your changes to the default environment (and put them in a
common file so that we don't have to repeat the same thing in each
file)?

Regards,
Simon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
  2017-02-23  3:33       ` Simon Glass
@ 2017-03-06  6:46         ` Eddie Cai
  2017-03-08  1:30           ` Eddie Cai
  0 siblings, 1 reply; 10+ messages in thread
From: Eddie Cai @ 2017-03-06  6:46 UTC (permalink / raw
  To: u-boot

Hi Simon

2017-02-23 11:33 GMT+08:00 Simon Glass <sjg@chromium.org>:

> Hi Eddie,
>
> On 22 February 2017 at 07:12, Eddie Cai <eddie.cai.linux@gmail.com> wrote:
> > Hi Simon
> >
> > 2017-02-22 17:05 GMT+08:00 Eddie Cai <eddie.cai.linux@gmail.com>:
> >>
> >> Hi Simon
> >>
> >> 2017-02-22 11:59 GMT+08:00 Simon Glass <sjg@chromium.org>:
> >>>
> >>> Hi Eddie,
> >>>
> >>> On 17 February 2017 at 00:57, Eddie Cai <eddie.cai.linux@gmail.com>
> >>> wrote:
> >>> > Auto write GPT table if fail to get GPT table when
> >>> > scan_dev_for_boot_part
> >>> >
> >>> > Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
> >>> > ---
> >>> >  arch/arm/mach-rockchip/rk3036-board.c | 20 ++++++++++++++-
> >>> >  arch/arm/mach-rockchip/rk3288-board.c | 20 ++++++++++++++-
> >>> >  arch/arm/mach-rockchip/rk3399-board.c | 46
> >>> > +++++++++++++++++++++++++++++++++++
> >>> >  3 files changed, 84 insertions(+), 2 deletions(-)
> >>> >  create mode 100644 arch/arm/mach-rockchip/rk3399-board.c
> >>> >
> >>> > diff --git a/arch/arm/mach-rockchip/rk3036-board.c
> >>> > b/arch/arm/mach-rockchip/rk3036-board.c
> >>> > index bf2b268..e9aeaff 100644
> >>> > --- a/arch/arm/mach-rockchip/rk3036-board.c
> >>> > +++ b/arch/arm/mach-rockchip/rk3036-board.c
> >>> > @@ -51,7 +51,25 @@ __weak int rk_board_late_init(void)
> >>> >  int board_late_init(void)
> >>> >  {
> >>> >         setup_boot_mode();
> >>> > -
> >>> > +       setenv("scan_dev_for_boot_part",
> >>> > +                       "part list ${devtype} ${devnum} -bootable
> test;
> >>> > "
> >>> > +                       "if env exists test; then "
> >>> > +                              "echo Found valid partition table; "
> >>> > +                       "else "
> >>> > +                      "echo No valid partition table, write the
> >>> > original partition table; "
> >>> > +                              "gpt write ${devtype} ${devnum}
> >>> > ${partitions}; "
> >>> > +                              "mmc rescan;"
> >>> > +                       "fi;"
> >>> > +                       "part list ${devtype} ${devnum} -bootable
> >>> > devplist; "
> >>> > +                       "env exists devplist || setenv devplist 1; "
> >>> > +                       "for distro_bootpart in ${devplist}; do "
> >>> > +                           "if fstype ${devtype} "
> >>> > +                                   "${devnum}:${distro_bootpart} "
> >>> > +                                   "bootfstype; then "
> >>> > +                               "run scan_dev_for_boot; "
> >>> > +                             "fi; "
> >>> > +                       "done\0"
> >>> > +       );
> >>> >         return rk_board_late_init();
> >>> >  }
> >>> >
> >>> > diff --git a/arch/arm/mach-rockchip/rk3288-board.c
> >>> > b/arch/arm/mach-rockchip/rk3288-board.c
> >>> > index 9894a25..386b155 100644
> >>> > --- a/arch/arm/mach-rockchip/rk3288-board.c
> >>> > +++ b/arch/arm/mach-rockchip/rk3288-board.c
> >>> > @@ -74,7 +74,25 @@ int board_late_init(void)
> >>> >  {
> >>> >         setup_boot_mode();
> >>> >         rk3288_qos_init();
> >>> > -
> >>> > +       setenv("scan_dev_for_boot_part",
> >>> > +                       "part list ${devtype} ${devnum} -bootable
> test;
> >>> > "
> >>> > +                       "if env exists test; then "
> >>> > +                              "echo Found valid partition table; "
> >>> > +                       "else "
> >>> > +                      "echo No valid partition table, write the
> >>> > original partition table; "
> >>> > +                              "gpt write ${devtype} ${devnum}
> >>> > ${partitions}; "
> >>> > +                              "mmc rescan;"
> >>> > +                       "fi;"
> >>> > +                       "part list ${devtype} ${devnum} -bootable
> >>> > devplist; "
> >>> > +                       "env exists devplist || setenv devplist 1; "
> >>> > +                       "for distro_bootpart in ${devplist}; do "
> >>> > +                           "if fstype ${devtype} "
> >>> > +                                   "${devnum}:${distro_bootpart} "
> >>> > +                                   "bootfstype; then "
> >>> > +                               "run scan_dev_for_boot; "
> >>> > +                             "fi; "
> >>> > +                       "done\0"
> >>> > +       );
> >>> >         return rk_board_late_init();
> >>> >  }
> >>> >
> >>> > diff --git a/arch/arm/mach-rockchip/rk3399-board.c
> >>> > b/arch/arm/mach-rockchip/rk3399-board.c
> >>> > new file mode 100644
> >>> > index 0000000..3777643
> >>> > --- /dev/null
> >>> > +++ b/arch/arm/mach-rockchip/rk3399-board.c
> >>> > @@ -0,0 +1,46 @@
> >>> > +/*
> >>> > + * (C) Copyright 2017 ockchip Electronics Co., Ltd
> >>> > + *
> >>> > + * SPDX-License-Identifier:     GPL-2.0+
> >>> > + */
> >>> > +
> >>> > +#include <common.h>
> >>> > +#include <clk.h>
> >>> > +#include <dm.h>
> >>> > +#include <ram.h>
> >>> > +#include <syscon.h>
> >>> > +#include <asm/io.h>
> >>> > +#include <asm/arch/clock.h>
> >>> > +#include <asm/arch/periph.h>
> >>> > +
> >>> > +DECLARE_GLOBAL_DATA_PTR;
> >>> > +
> >>> > +__weak int rk_board_late_init(void)
> >>> > +{
> >>> > +       return 0;
> >>> > +}
> >>> > +
> >>> > +int board_late_init(void)
> >>> > +{
> >>> > +       setenv("scan_dev_for_boot_part",
> >>> > +                       "part list ${devtype} ${devnum} -bootable
> test;
> >>> > "
> >>> > +                       "if env exists test; then "
> >>> > +                              "echo Found valid partition table; "
> >>> > +                       "else "
> >>> > +                      "echo No valid partition table, write the
> >>> > original partition table; "
> >>> > +                              "gpt write ${devtype} ${devnum}
> >>> > ${partitions}; "
> >>> > +                              "mmc rescan;"
> >>> > +                       "fi;"
> >>> > +                       "part list ${devtype} ${devnum} -bootable
> >>> > devplist; "
> >>> > +                       "env exists devplist || setenv devplist 1; "
> >>> > +                       "for distro_bootpart in ${devplist}; do "
> >>> > +                           "if fstype ${devtype} "
> >>> > +                                   "${devnum}:${distro_bootpart} "
> >>> > +                                   "bootfstype; then "
> >>> > +                               "run scan_dev_for_boot; "
> >>> > +                             "fi; "
> >>> > +                       "done\0"
> >>>
> >>> What is the purpose of this setenv()?
> >>
> >> Auto write GPT table when scan_dev_for_boot_part fail to find a valid
> one
> >
> > To be more clearly. If the GPT table in the boot media corrupted. Or
> there
> > is no GPT table in the boot media.  The original scan_dev_for_boot_part
> will
> > fail to find a  bootable partition. I just let it write GPT table when
> can
> > not find a valid one.
> >>>
>
> OK, but you should not be changing the environment in your code. Can
> you add your changes to the default environment (and put them in a
> common file so that we don't have to repeat the same thing in each
> file)?
>
done

>
> Regards,
> Simon
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
  2017-03-06  6:46         ` Eddie Cai
@ 2017-03-08  1:30           ` Eddie Cai
  2017-03-08  9:29             ` Sjoerd Simons
  0 siblings, 1 reply; 10+ messages in thread
From: Eddie Cai @ 2017-03-08  1:30 UTC (permalink / raw
  To: u-boot

Hi Simon

2017-03-06 14:46 GMT+08:00 Eddie Cai <eddie.cai.linux@gmail.com>:

> Hi Simon
>
> 2017-02-23 11:33 GMT+08:00 Simon Glass <sjg@chromium.org>:
>
>> Hi Eddie,
>>
>> On 22 February 2017 at 07:12, Eddie Cai <eddie.cai.linux@gmail.com>
>> wrote:
>> > Hi Simon
>> >
>> > 2017-02-22 17:05 GMT+08:00 Eddie Cai <eddie.cai.linux@gmail.com>:
>> >>
>> >> Hi Simon
>> >>
>> >> 2017-02-22 11:59 GMT+08:00 Simon Glass <sjg@chromium.org>:
>> >>>
>> >>> Hi Eddie,
>> >>>
>> >>> On 17 February 2017 at 00:57, Eddie Cai <eddie.cai.linux@gmail.com>
>> >>> wrote:
>> >>> > Auto write GPT table if fail to get GPT table when
>> >>> > scan_dev_for_boot_part
>> >>> >
>> >>> > Signed-off-by: Eddie Cai <eddie.cai.linux@gmail.com>
>> >>> > ---
>> >>> >  arch/arm/mach-rockchip/rk3036-board.c | 20 ++++++++++++++-
>> >>> >  arch/arm/mach-rockchip/rk3288-board.c | 20 ++++++++++++++-
>> >>> >  arch/arm/mach-rockchip/rk3399-board.c | 46
>> >>> > +++++++++++++++++++++++++++++++++++
>> >>> >  3 files changed, 84 insertions(+), 2 deletions(-)
>> >>> >  create mode 100644 arch/arm/mach-rockchip/rk3399-board.c
>> >>> >
>> >>> > diff --git a/arch/arm/mach-rockchip/rk3036-board.c
>> >>> > b/arch/arm/mach-rockchip/rk3036-board.c
>> >>> > index bf2b268..e9aeaff 100644
>> >>> > --- a/arch/arm/mach-rockchip/rk3036-board.c
>> >>> > +++ b/arch/arm/mach-rockchip/rk3036-board.c
>> >>> > @@ -51,7 +51,25 @@ __weak int rk_board_late_init(void)
>> >>> >  int board_late_init(void)
>> >>> >  {
>> >>> >         setup_boot_mode();
>> >>> > -
>> >>> > +       setenv("scan_dev_for_boot_part",
>> >>> > +                       "part list ${devtype} ${devnum} -bootable
>> test;
>> >>> > "
>> >>> > +                       "if env exists test; then "
>> >>> > +                              "echo Found valid partition table; "
>> >>> > +                       "else "
>> >>> > +                      "echo No valid partition table, write the
>> >>> > original partition table; "
>> >>> > +                              "gpt write ${devtype} ${devnum}
>> >>> > ${partitions}; "
>> >>> > +                              "mmc rescan;"
>> >>> > +                       "fi;"
>> >>> > +                       "part list ${devtype} ${devnum} -bootable
>> >>> > devplist; "
>> >>> > +                       "env exists devplist || setenv devplist 1; "
>> >>> > +                       "for distro_bootpart in ${devplist}; do "
>> >>> > +                           "if fstype ${devtype} "
>> >>> > +                                   "${devnum}:${distro_bootpart} "
>> >>> > +                                   "bootfstype; then "
>> >>> > +                               "run scan_dev_for_boot; "
>> >>> > +                             "fi; "
>> >>> > +                       "done\0"
>> >>> > +       );
>> >>> >         return rk_board_late_init();
>> >>> >  }
>> >>> >
>> >>> > diff --git a/arch/arm/mach-rockchip/rk3288-board.c
>> >>> > b/arch/arm/mach-rockchip/rk3288-board.c
>> >>> > index 9894a25..386b155 100644
>> >>> > --- a/arch/arm/mach-rockchip/rk3288-board.c
>> >>> > +++ b/arch/arm/mach-rockchip/rk3288-board.c
>> >>> > @@ -74,7 +74,25 @@ int board_late_init(void)
>> >>> >  {
>> >>> >         setup_boot_mode();
>> >>> >         rk3288_qos_init();
>> >>> > -
>> >>> > +       setenv("scan_dev_for_boot_part",
>> >>> > +                       "part list ${devtype} ${devnum} -bootable
>> test;
>> >>> > "
>> >>> > +                       "if env exists test; then "
>> >>> > +                              "echo Found valid partition table; "
>> >>> > +                       "else "
>> >>> > +                      "echo No valid partition table, write the
>> >>> > original partition table; "
>> >>> > +                              "gpt write ${devtype} ${devnum}
>> >>> > ${partitions}; "
>> >>> > +                              "mmc rescan;"
>> >>> > +                       "fi;"
>> >>> > +                       "part list ${devtype} ${devnum} -bootable
>> >>> > devplist; "
>> >>> > +                       "env exists devplist || setenv devplist 1; "
>> >>> > +                       "for distro_bootpart in ${devplist}; do "
>> >>> > +                           "if fstype ${devtype} "
>> >>> > +                                   "${devnum}:${distro_bootpart} "
>> >>> > +                                   "bootfstype; then "
>> >>> > +                               "run scan_dev_for_boot; "
>> >>> > +                             "fi; "
>> >>> > +                       "done\0"
>> >>> > +       );
>> >>> >         return rk_board_late_init();
>> >>> >  }
>> >>> >
>> >>> > diff --git a/arch/arm/mach-rockchip/rk3399-board.c
>> >>> > b/arch/arm/mach-rockchip/rk3399-board.c
>> >>> > new file mode 100644
>> >>> > index 0000000..3777643
>> >>> > --- /dev/null
>> >>> > +++ b/arch/arm/mach-rockchip/rk3399-board.c
>> >>> > @@ -0,0 +1,46 @@
>> >>> > +/*
>> >>> > + * (C) Copyright 2017 ockchip Electronics Co., Ltd
>> >>> > + *
>> >>> > + * SPDX-License-Identifier:     GPL-2.0+
>> >>> > + */
>> >>> > +
>> >>> > +#include <common.h>
>> >>> > +#include <clk.h>
>> >>> > +#include <dm.h>
>> >>> > +#include <ram.h>
>> >>> > +#include <syscon.h>
>> >>> > +#include <asm/io.h>
>> >>> > +#include <asm/arch/clock.h>
>> >>> > +#include <asm/arch/periph.h>
>> >>> > +
>> >>> > +DECLARE_GLOBAL_DATA_PTR;
>> >>> > +
>> >>> > +__weak int rk_board_late_init(void)
>> >>> > +{
>> >>> > +       return 0;
>> >>> > +}
>> >>> > +
>> >>> > +int board_late_init(void)
>> >>> > +{
>> >>> > +       setenv("scan_dev_for_boot_part",
>> >>> > +                       "part list ${devtype} ${devnum} -bootable
>> test;
>> >>> > "
>> >>> > +                       "if env exists test; then "
>> >>> > +                              "echo Found valid partition table; "
>> >>> > +                       "else "
>> >>> > +                      "echo No valid partition table, write the
>> >>> > original partition table; "
>> >>> > +                              "gpt write ${devtype} ${devnum}
>> >>> > ${partitions}; "
>> >>> > +                              "mmc rescan;"
>> >>> > +                       "fi;"
>> >>> > +                       "part list ${devtype} ${devnum} -bootable
>> >>> > devplist; "
>> >>> > +                       "env exists devplist || setenv devplist 1; "
>> >>> > +                       "for distro_bootpart in ${devplist}; do "
>> >>> > +                           "if fstype ${devtype} "
>> >>> > +                                   "${devnum}:${distro_bootpart} "
>> >>> > +                                   "bootfstype; then "
>> >>> > +                               "run scan_dev_for_boot; "
>> >>> > +                             "fi; "
>> >>> > +                       "done\0"
>> >>>
>> >>> What is the purpose of this setenv()?
>> >>
>> >> Auto write GPT table when scan_dev_for_boot_part fail to find a valid
>> one
>> >
>> > To be more clearly. If the GPT table in the boot media corrupted. Or
>> there
>> > is no GPT table in the boot media.  The original scan_dev_for_boot_part
>> will
>> > fail to find a  bootable partition. I just let it write GPT table when
>> can
>> > not find a valid one.
>> >>>
>>
>> OK, but you should not be changing the environment in your code. Can
>> you add your changes to the default environment (and put them in a
>> common file so that we don't have to repeat the same thing in each
>> file)?
>>
> done
>
Look like Tom don't like put this changes to default environment. See [0].
I think I would have to limit this change on Rockchip SoC because i can
only guarantee GPT table exist on Rockchip SoC. What do you think?
[0]: https://patchwork.ozlabs.org/patch/735557/

>
>> Regards,
>> Simon
>>
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
  2017-03-08  1:30           ` Eddie Cai
@ 2017-03-08  9:29             ` Sjoerd Simons
  2017-03-08 14:38               ` Eddie Cai
  0 siblings, 1 reply; 10+ messages in thread
From: Sjoerd Simons @ 2017-03-08  9:29 UTC (permalink / raw
  To: u-boot

On Wed, 2017-03-08 at 09:30 +0800, Eddie Cai wrote:
> Hi Simon
> 
> 2017-03-06 14:46 GMT+08:00 Eddie Cai <eddie.cai.linux@gmail.com>:
> 
> > Hi Simon
> > 
> > 2017-02-23 11:33 GMT+08:00 Simon Glass <sjg@chromium.org>:
> > 
> > > Hi Eddie,
> > > 
> > > On 22 February 2017 at 07:12, Eddie Cai <eddie.cai.linux@gmail.co
> > > m>
> > > wrote:
> > > > Hi Simon
> > > > 

> Look like Tom don't like put this changes to default environment. See
> [0].
> I think I would have to limit this change on Rockchip SoC because i
> can
> only guarantee GPT table exist on Rockchip SoC. What do you think?
> [0]: https://patchwork.ozlabs.org/patch/735557/

How can you guarantee that it exists on all rockchip deployments? This
very much depends on the software stack/image people use on rockchip
boards.

One of the nice things about the distro bootcmds is that it's a
flexible generic setup which should just work regardless of how systems
are installed (as long as some basic conventions are followed). There
isn't really a requirement for people to use GPT on those system.

Also from a quick look, this seems to want to automatically write GPT
tables on whatever boot device is scanned, not just the internal media.
So you're adding a big potential for destroying peoples SD cards here
:)

Fwiw I'm also not sure what actual value of writing a GPT table is?
It's extremely unlikely that this would then allow you to successfully
boot from the device afterwards.

-- 
Sjoerd Simons
Collabora Ltd.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
  2017-03-08  9:29             ` Sjoerd Simons
@ 2017-03-08 14:38               ` Eddie Cai
  2017-03-09  9:59                 ` Sjoerd Simons
  0 siblings, 1 reply; 10+ messages in thread
From: Eddie Cai @ 2017-03-08 14:38 UTC (permalink / raw
  To: u-boot

2017-03-08 17:29 GMT+08:00 Sjoerd Simons <sjoerd.simons@collabora.co.uk>:

> On Wed, 2017-03-08 at 09:30 +0800, Eddie Cai wrote:
> > Hi Simon
> >
> > 2017-03-06 14:46 GMT+08:00 Eddie Cai <eddie.cai.linux@gmail.com>:
> >
> > > Hi Simon
> > >
> > > 2017-02-23 11:33 GMT+08:00 Simon Glass <sjg@chromium.org>:
> > >
> > > > Hi Eddie,
> > > >
> > > > On 22 February 2017 at 07:12, Eddie Cai <eddie.cai.linux@gmail.co
> > > > m>
> > > > wrote:
> > > > > Hi Simon
> > > > >
>
> > Look like Tom don't like put this changes to default environment. See
> > [0].
> > I think I would have to limit this change on Rockchip SoC because i
> > can
> > only guarantee GPT table exist on Rockchip SoC. What do you think?
> > [0]: https://patchwork.ozlabs.org/patch/735557/
>
> How can you guarantee that it exists on all rockchip deployments? This
> very much depends on the software stack/image people use on rockchip
> boards.
>
We define PARTS_DEFAULT in rockchip-common.h. All rockchip SoC based board
include this file.
#define PARTS_DEFAULT \
"uuid_disk=${uuid_gpt_disk};" \
"name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};" \
"name=reserved1,size=64K,uuid=${uuid_gpt_reserved1};" \
"name=reserved2,size=4M,uuid=${uuid_gpt_reserved2};" \
"name=loader2,size=4MB,uuid=${uuid_gpt_loader2};" \
"name=atf,size=4M,uuid=${uuid_gpt_atf};" \
"name=boot,size=112M,bootable,uuid=${uuid_gpt_boot};" \
"name=rootfs,size=-,uuid=${uuid_gpt_rootfs};\0" \

>
> One of the nice things about the distro bootcmds is that it's a
> flexible generic setup which should just work regardless of how systems
> are installed (as long as some basic conventions are followed). There
> isn't really a requirement for people to use GPT on those system.
>
That is correct. Also that is why i want to limit the change on Rockchip
SoC based board.

>
> Also from a quick look, this seems to want to automatically write GPT
> tables on whatever boot device is scanned, not just the internal media.
> So you're adding a big potential for destroying peoples SD cards here
> :)
>
Yes, I should limit it on the first boot device.

>
> Fwiw I'm also not sure what actual value of writing a GPT table is?
> It's extremely unlikely that this would then allow you to successfully
> boot from the device afterwards.
>
It is PARTS_DEFAULT. For Rockchip SoC, It defined in rockchip-common.h

>
> --
> Sjoerd Simons
> Collabora Ltd.
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC
  2017-03-08 14:38               ` Eddie Cai
@ 2017-03-09  9:59                 ` Sjoerd Simons
  0 siblings, 0 replies; 10+ messages in thread
From: Sjoerd Simons @ 2017-03-09  9:59 UTC (permalink / raw
  To: u-boot

On Wed, 2017-03-08 at 22:38 +0800, Eddie Cai wrote:
> 2017-03-08 17:29 GMT+08:00 Sjoerd Simons <sjoerd.simons@collabora.co.
> uk>:
> 
> > On Wed, 2017-03-08 at 09:30 +0800, Eddie Cai wrote:
> > > Hi Simon
> > > 
> > > 2017-03-06 14:46 GMT+08:00 Eddie Cai <eddie.cai.linux@gmail.com>:
> > > 
> > > > Hi Simon
> > > > 
> > > > 2017-02-23 11:33 GMT+08:00 Simon Glass <sjg@chromium.org>:
> > > > 
> > > > > Hi Eddie,
> > > > > 
> > > > > On 22 February 2017 at 07:12, Eddie Cai <eddie.cai.linux@gmai
> > > > > l.co
> > > > > m>
> > > > > wrote:
> > > > > > Hi Simon
> > > > > > 
> > > Look like Tom don't like put this changes to default environment.
> > > See
> > > [0].
> > > I think I would have to limit this change on Rockchip SoC because
> > > i
> > > can
> > > only guarantee GPT table exist on Rockchip SoC. What do you
> > > think?
> > > [0]: https://patchwork.ozlabs.org/patch/735557/
> > 
> > How can you guarantee that it exists on all rockchip deployments?
> > This
> > very much depends on the software stack/image people use on
> > rockchip
> > boards.
> > 
> 
> We define PARTS_DEFAULT in rockchip-common.h. All rockchip SoC based
> board
> include this file.
> #define PARTS_DEFAULT \
> "uuid_disk=${uuid_gpt_disk};" \
> "name=loader1,start=32K,size=4000K,uuid=${uuid_gpt_loader1};" \
> "name=reserved1,size=64K,uuid=${uuid_gpt_reserved1};" \
> "name=reserved2,size=4M,uuid=${uuid_gpt_reserved2};" \
> "name=loader2,size=4MB,uuid=${uuid_gpt_loader2};" \
> "name=atf,size=4M,uuid=${uuid_gpt_atf};" \
> "name=boot,size=112M,bootable,uuid=${uuid_gpt_boot};" \
> "name=rootfs,size=-,uuid=${uuid_gpt_rootfs};\0" \

Yeah, that's not the partition everyone *must* use for rockchip though.
Definately not the one distributions (or I myself use for our rockchip
images) on their installations. This is somewhat specific to a
deployment not generic :)

> > 
> > One of the nice things about the distro bootcmds is that it's a
> > flexible generic setup which should just work regardless of how
> > systems
> > are installed (as long as some basic conventions are followed).
> > There
> > isn't really a requirement for people to use GPT on those system.
> > 
> 
> That is correct. Also that is why i want to limit the change on
> Rockchip
> SoC based board.
> 
> > 
> > Also from a quick look, this seems to want to automatically write
> > GPT
> > tables on whatever boot device is scanned, not just the internal
> > media.
> > So you're adding a big potential for destroying peoples SD cards
> > here
> > :)
> > 
> 
> Yes, I should limit it on the first boot device.

Why do it at all? Especially automatically on boot?

I can see the point for forcing a given GPT partition table if using u-
boot to flash the emmc (via dfu or whatever), for which PARTS_DEFAULT
makes total sense. 

But in all other cases, u-boot should really not force policy here
necessarily and especially not do destructive changes without the user
requisting/triggering it specifically.

-- 
Sjoerd Simons
Collabora Ltd.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-03-09  9:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-17  7:57 [U-Boot] [PATCH] rockchip: set scan_dev_for_boot_part env for rockchip SoC Eddie Cai
2017-02-22  3:59 ` Simon Glass
2017-02-22  9:05   ` Eddie Cai
2017-02-22 14:12     ` Eddie Cai
2017-02-23  3:33       ` Simon Glass
2017-03-06  6:46         ` Eddie Cai
2017-03-08  1:30           ` Eddie Cai
2017-03-08  9:29             ` Sjoerd Simons
2017-03-08 14:38               ` Eddie Cai
2017-03-09  9:59                 ` Sjoerd Simons

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.