diff mbox

arm64: Fix the bug in fdt module

Message ID CADyBb7tz6416QE1AgqQAsTkSNp6KrYdoGJFs6jtVDgagT1yiXQ@mail.gmail.com
State New
Headers show

Commit Message

Fu Wei Fu Nov. 5, 2015, 1:39 p.m. UTC
Hi Vladimir,


On 5 November 2015 at 18:00, Vladimir 'phcoder' Serbinenko
<phcoder@gmail.com> wrote:
>
> Le 5 nov. 2015 10:48 AM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>
>> Hi Vladimir
>>
>> On 5 November 2015 at 17:45, Vladimir 'phcoder' Serbinenko
>> <phcoder@gmail.com> wrote:
>> >
>> > Le 5 nov. 2015 9:51 AM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>> >>
>> >> Hi Vladimir
>> >>
>> >> Please correct me :-)
>> >> Can I do this :
>> >>
>> >> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
>> >> index 2ef10d1..ea5831f 100644
>> >> --- a/grub-core/Makefile.core.def
>> >> +++ b/grub-core/Makefile.core.def
>> >> @@ -1665,7 +1665,6 @@ module = {
>> >>    ia64_efi = loader/ia64/efi/linux.c;
>> >>    arm = loader/arm/linux.c;
>> >>    arm64 = loader/arm64/linux.c;
>> >> -  fdt = lib/fdt.c;
>> >>    common = loader/linux.c;
>> >>    common = lib/cmdline.c;
>> >>    enable = noemu;
>> >> @@ -1674,7 +1673,9 @@ module = {
>> >>  module = {
>> >>    name = fdt;
>> >>    arm64 = loader/arm64/fdt.c;
>> >> -  enable = arm64;
>> >> +  arm = loader/arm/fdt.c;
>> > Where does this file come from?
>> >
>>
>> that is the file I am working on
>>
>> i just tried to let you know my thought.
>>
>> Is this way Ok for you? Please correct me if I misunderstand you
>>
> What is the reason to reshuffle fdt code for 32-bit arm?

reason:
we can delete fdt = lib/fdt.c; in linux module,
make this only in fdt module.


> Does it merge any code with arm64?

No, because arm64 uses uefi runtime service, but arm doesn't

> Will this code be used by anything besides linux module?

For arm64, as you know, yes, by xen_boot,
but for arm, NO

So maybe we can do this:


>
>>
>> >
>> >> +  common = lib/fdt.c;
>> >> +  enable = fdt;
>> >>  };
>> >>
>> >>  module = {
>> >>
>> >> On 4 November 2015 at 19:16, Vladimir 'phcoder' Serbinenko
>> >> <phcoder@gmail.com> wrote:
>> >> >
>> >> > Le 4 nov. 2015 12:12 PM, "Vladimir 'phcoder' Serbinenko"
>> >> > <phcoder@gmail.com>
>> >> > a écrit :
>> >> >>
>> >> >>
>> >> >> Le 4 nov. 2015 12:09 PM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>> >> >> >
>> >> >> >  Hi Vladimir,
>> >> >> >
>> >> >> > On 4 November 2015 at 19:06, Fu Wei <fu.wei@linaro.org> wrote:
>> >> >> > > Hi Vladimir,
>> >> >> > >
>> >> >> > > On 4 November 2015 at 18:47, Vladimir 'phcoder' Serbinenko
>> >> >> > > <phcoder@gmail.com> wrote:
>> >> >> > >>
>> >> >> > >> Le 4 nov. 2015 10:48 AM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>> >> >> > >>>
>> >> >> > >>> Hi Vladimir,
>> >> >> > >>>
>> >> >> > >>> Great thanks for your help :-)
>> >> >> > >>>
>> >> >> > >>>
>> >> >> > >>> On 4 November 2015 at 02:07, Vladimir 'phcoder' Serbinenko
>> >> >> > >>> <phcoder@gmail.com> wrote:
>> >> >> > >>> >
>> >> >> > >>> > Le 3 nov. 2015 9:56 AM, <fu.wei@linaro.org> a écrit :
>> >> >> > >>> >>
>> >> >> > >>> >> From: Fu Wei <fu.wei@linaro.org>
>> >> >> > >>> >>
>> >> >> > >>> >> This patch goes with commit:
>> >> >> > >>> >> 4d0cb755387d6f109b901386ed4d3d475df239fe
>> >> >> > >>> >>  arm64: Move FDT functions to separate module
>> >> >> > >>> >>
>> >> >> > >>> >> linux and xen_boot modules can't work without this patch.
>> >> >> > >>> >>
>> >> >> > >>> >> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>> >> >> > >>> >> ---
>> >> >> > >>> >>  grub-core/Makefile.core.def  | 1 +
>> >> >> > >>> >>  grub-core/loader/arm64/fdt.c | 5 +++++
>> >> >> > >>> >>  2 files changed, 6 insertions(+)
>> >> >> > >>> >>
>> >> >> > >>> >> diff --git a/grub-core/Makefile.core.def
>> >> >> > >>> >> b/grub-core/Makefile.core.def
>> >> >> > >>> >> index 2ef10d1..3ea4e49 100644
>> >> >> > >>> >> --- a/grub-core/Makefile.core.def
>> >> >> > >>> >> +++ b/grub-core/Makefile.core.def
>> >> >> > >>> >> @@ -1674,6 +1674,7 @@ module = {
>> >> >> > >>> >>  module = {
>> >> >> > >>> >>    name = fdt;
>> >> >> > >>> >>    arm64 = loader/arm64/fdt.c;
>> >> >> > >>> >> +  fdt = lib/fdt.c;
>> >> >> > >>> >>    enable = arm64;
>> >> >> > >>> >>  };
>> >> >> > >>> >>
>> >> >> > >>> > Please don't add same file to 2 different modules. Remove it
>> >> >> > >>> > from
>> >> >> > >>> > Linux
>> >> >> > >>> > module
>> >> >> > >>>
>> >> >> > >>> AFAIK, for now , only arm and arm64 are using lib/fdt.c
>> >> >> > >>> So please allow me to separate all the fdt code from
>> >> >> > >>> loader/arm/linux.c; just like arm64.
>> >> >> > >>>
>> >> >> > >> I don't think it's necessary at this point. Is xen_boot going
>> >> >> > >> to
>> >> >> > >> be
>> >> >> > >> available for 32-bit arm as well?
>> >> >> >
>> >> >> > And I would like to help to sort out the code for your new fdt
>> >> >> > module
>> >> >> > , If you don't mind.
>> >> >> >
>> >> >> > But according to my tests, I think we need "fdt = lib/fdt.c;" in
>> >> >> > module. If we don't separate fdt code from arm, we also need "fdt
>> >> >> > =
>> >> >> > lib/fdt.c;" in linux module.
>> >> >> >
>> >> >> > Please correct me if I misunderstand something, thanks
>> >> >> >
>> >> >> We need arm = lib/fdt.c in linux if we don't restructure. There is
>> >> >> no
>> >> >> reason to include lib/fdt.c in 2 different modules on arm64. Fdt in
>> >> >> first
>> >> >> part just mean arm and arm64 in this context
>> >> >>
>> >> > As an alternative: enable fdt module on all fdt platforms (enable =
>> >> > fdt)
>> >> > and
>> >> > put lib/fdt.c
>> >> >
>> >> >> > >>> This patch may become a patchset :-)
>> >> >> > >>>
>> >> >> > >>> >> diff --git a/grub-core/loader/arm64/fdt.c
>> >> >> > >>> >> b/grub-core/loader/arm64/fdt.c
>> >> >> > >>> >> index 5202c14..d160ca0 100644
>> >> >> > >>> >> --- a/grub-core/loader/arm64/fdt.c
>> >> >> > >>> >> +++ b/grub-core/loader/arm64/fdt.c
>> >> >> > >>> >> @@ -25,6 +25,10 @@
>> >> >> > >>> >>  #include <grub/file.h>
>> >> >> > >>> >>  #include <grub/efi/efi.h>
>> >> >> > >>> >>
>> >> >> > >>> >> +GRUB_MOD_LICENSE ("GPLv3+");
>> >> >> > >>> >> +
>> >> >> > >>> >> +static grub_dl_t my_mod;
>> >> >> > >>> >> +
>> >> >> > >>> > What's the reason for my_mod?
>> >> >> > >>>
>> >> >> > >>> this is for grub_dl_unref and grub_dl_ref. but I forgot to
>> >> >> > >>> check
>> >> >> > >>> this
>> >> >> > >>> again for this, sorry,
>> >> >> > >>> will add this later
>> >> >> > >>>
>> >> >> > >> Forget dl_ref and dl_unref. Linux module having a function
>> >> >> > >> reference
>> >> >> > >> is
>> >> >> > >> already good enough
>> >> >> > >>> >>  static void *loaded_fdt;
>> >> >> > >>> >>  static void *fdt;
>> >> >> > >>> >>
>> >> >> > >>> >> @@ -177,6 +181,7 @@ GRUB_MOD_INIT (fdt)
>> >> >> > >>> >>    cmd_devicetree =
>> >> >> > >>> >>      grub_register_command ("devicetree",
>> >> >> > >>> >> grub_cmd_devicetree,
>> >> >> > >>> >> 0,
>> >> >> > >>> >>                            N_("Load DTB file."));
>> >> >> > >>> >> +  my_mod = mod;
>> >> >> > >>> >>  }
>> >> >> > >>> >>
>> >> >> > >>> >>  GRUB_MOD_FINI (fdt)
>> >> >> > >>> >> --
>> >> >> > >>> >> 2.4.3
>> >> >> > >>> >>
>> >> >> > >>>
>> >> >> > >>>
>> >> >> > >>>
>> >> >> > >>> --
>> >> >> > >>> Best regards,
>> >> >> > >>>
>> >> >> > >>> Fu Wei
>> >> >> > >>> Software Engineer
>> >> >> > >>> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> >> >> > >>> Ph: +86 21 61221326(direct)
>> >> >> > >>> Ph: +86 186 2020 4684 (mobile)
>> >> >> > >>> Room 1512, Regus One Corporate Avenue,Level 15,
>> >> >> > >>> One Corporate Avenue,222 Hubin Road,Huangpu District,
>> >> >> > >>> Shanghai,China 200021
>> >> >> > >
>> >> >> > >
>> >> >> > >
>> >> >> > > --
>> >> >> > > Best regards,
>> >> >> > >
>> >> >> > > Fu Wei
>> >> >> > > Software Engineer
>> >> >> > > Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> >> >> > > Ph: +86 21 61221326(direct)
>> >> >> > > Ph: +86 186 2020 4684 (mobile)
>> >> >> > > Room 1512, Regus One Corporate Avenue,Level 15,
>> >> >> > > One Corporate Avenue,222 Hubin Road,Huangpu District,
>> >> >> > > Shanghai,China 200021
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > --
>> >> >> > Best regards,
>> >> >> >
>> >> >> > Fu Wei
>> >> >> > Software Engineer
>> >> >> > Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> >> >> > Ph: +86 21 61221326(direct)
>> >> >> > Ph: +86 186 2020 4684 (mobile)
>> >> >> > Room 1512, Regus One Corporate Avenue,Level 15,
>> >> >> > One Corporate Avenue,222 Hubin Road,Huangpu District,
>> >> >> > Shanghai,China 200021
>> >>
>> >>
>> >>
>> >> --
>> >> Best regards,
>> >>
>> >> Fu Wei
>> >> Software Engineer
>> >> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> >> Ph: +86 21 61221326(direct)
>> >> Ph: +86 186 2020 4684 (mobile)
>> >> Room 1512, Regus One Corporate Avenue,Level 15,
>> >> One Corporate Avenue,222 Hubin Road,Huangpu District,
>> >> Shanghai,China 200021
>>
>>
>>
>> --
>> Best regards,
>>
>> Fu Wei
>> Software Engineer
>> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> Ph: +86 21 61221326(direct)
>> Ph: +86 186 2020 4684 (mobile)
>> Room 1512, Regus One Corporate Avenue,Level 15,
>> One Corporate Avenue,222 Hubin Road,Huangpu District,
>> Shanghai,China 200021

Comments

Fu Wei Fu Nov. 5, 2015, 3:03 p.m. UTC | #1
Hi Vladimir,

Thanks for your help, I will test it on arm and arm64, then make a new patch


On 5 November 2015 at 22:53, Vladimir 'phcoder' Serbinenko
<phcoder@gmail.com> wrote:
>
> Le 5 nov. 2015 2:39 PM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>
>> Hi Vladimir,
>>
>>
>
>> On 5 November 2015 at 18:00, Vladimir 'phcoder' Serbinenko
>> <phcoder@gmail.com> wrote:
>> >
>> > Le 5 nov. 2015 10:48 AM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>> >>
>> >> Hi Vladimir
>> >>
>> >> On 5 November 2015 at 17:45, Vladimir 'phcoder' Serbinenko
>> >> <phcoder@gmail.com> wrote:
>> >> >
>> >> > Le 5 nov. 2015 9:51 AM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>> >> >>
>> >> >> Hi Vladimir
>> >> >>
>> >> >> Please correct me :-)
>> >> >> Can I do this :
>> >> >>
>> >> >> diff --git a/grub-core/Makefile.core.def
>> >> >> b/grub-core/Makefile.core.def
>> >> >> index 2ef10d1..ea5831f 100644
>> >> >> --- a/grub-core/Makefile.core.def
>> >> >> +++ b/grub-core/Makefile.core.def
>> >> >> @@ -1665,7 +1665,6 @@ module = {
>> >> >>    ia64_efi = loader/ia64/efi/linux.c;
>> >> >>    arm = loader/arm/linux.c;
>> >> >>    arm64 = loader/arm64/linux.c;
>> >> >> -  fdt = lib/fdt.c;
>> >> >>    common = loader/linux.c;
>> >> >>    common = lib/cmdline.c;
>> >> >>    enable = noemu;
>> >> >> @@ -1674,7 +1673,9 @@ module = {
>> >> >>  module = {
>> >> >>    name = fdt;
>> >> >>    arm64 = loader/arm64/fdt.c;
>> >> >> -  enable = arm64;
>> >> >> +  arm = loader/arm/fdt.c;
>> >> > Where does this file come from?
>> >> >
>> >>
>> >> that is the file I am working on
>> >>
>> >> i just tried to let you know my thought.
>> >>
>> >> Is this way Ok for you? Please correct me if I misunderstand you
>> >>
>> > What is the reason to reshuffle fdt code for 32-bit arm?
>>
>> reason:
>> we can delete fdt = lib/fdt.c; in linux module,
>> make this only in fdt module.
>>
> You don't need to actually shuffle any code. Just see the attached patch
>
>>
>> > Does it merge any code with arm64?
>>
>> No, because arm64 uses uefi runtime service, but arm doesn't
>>
>> > Will this code be used by anything besides linux module?
>>
>> For arm64, as you know, yes, by xen_boot,
>> but for arm, NO
>>
>> So maybe we can do this:
>>
>> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
>> index 3ea4e49..db36a68 100644
>> --- a/grub-core/Makefile.core.def
>> +++ b/grub-core/Makefile.core.def
>> @@ -1664,8 +1664,8 @@ module = {
>>    sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
>>    ia64_efi = loader/ia64/efi/linux.c;
>>    arm = loader/arm/linux.c;
>> +  arm = lib/fdt.c;
>>    arm64 = loader/arm64/linux.c;
>> -  fdt = lib/fdt.c;
>>    common = loader/linux.c;
>>    common = lib/cmdline.c;
>>    enable = noemu;
>> @@ -1674,7 +1674,7 @@ module = {
>>  module = {
>>    name = fdt;
>>    arm64 = loader/arm64/fdt.c;
>> -  fdt = lib/fdt.c;
>> +  common = lib/fdt.c;
>>    enable = arm64;
>>  };
>>
>>
>> >
>> >>
>> >> >
>> >> >> +  common = lib/fdt.c;
>> >> >> +  enable = fdt;
>> >> >>  };
>> >> >>
>> >> >>  module = {
>> >> >>
>> >> >> On 4 November 2015 at 19:16, Vladimir 'phcoder' Serbinenko
>> >> >> <phcoder@gmail.com> wrote:
>> >> >> >
>> >> >> > Le 4 nov. 2015 12:12 PM, "Vladimir 'phcoder' Serbinenko"
>> >> >> > <phcoder@gmail.com>
>> >> >> > a écrit :
>> >> >> >>
>> >> >> >>
>> >> >> >> Le 4 nov. 2015 12:09 PM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>> >> >> >> >
>> >> >> >> >  Hi Vladimir,
>> >> >> >> >
>> >> >> >> > On 4 November 2015 at 19:06, Fu Wei <fu.wei@linaro.org> wrote:
>> >> >> >> > > Hi Vladimir,
>> >> >> >> > >
>> >> >> >> > > On 4 November 2015 at 18:47, Vladimir 'phcoder' Serbinenko
>> >> >> >> > > <phcoder@gmail.com> wrote:
>> >> >> >> > >>
>> >> >> >> > >> Le 4 nov. 2015 10:48 AM, "Fu Wei" <fu.wei@linaro.org> a
>> >> >> >> > >> écrit :
>> >> >> >> > >>>
>> >> >> >> > >>> Hi Vladimir,
>> >> >> >> > >>>
>> >> >> >> > >>> Great thanks for your help :-)
>> >> >> >> > >>>
>> >> >> >> > >>>
>> >> >> >> > >>> On 4 November 2015 at 02:07, Vladimir 'phcoder' Serbinenko
>> >> >> >> > >>> <phcoder@gmail.com> wrote:
>> >> >> >> > >>> >
>> >> >> >> > >>> > Le 3 nov. 2015 9:56 AM, <fu.wei@linaro.org> a écrit :
>> >> >> >> > >>> >>
>> >> >> >> > >>> >> From: Fu Wei <fu.wei@linaro.org>
>> >> >> >> > >>> >>
>> >> >> >> > >>> >> This patch goes with commit:
>> >> >> >> > >>> >> 4d0cb755387d6f109b901386ed4d3d475df239fe
>> >> >> >> > >>> >>  arm64: Move FDT functions to separate module
>> >> >> >> > >>> >>
>> >> >> >> > >>> >> linux and xen_boot modules can't work without this
>> >> >> >> > >>> >> patch.
>> >> >> >> > >>> >>
>> >> >> >> > >>> >> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>> >> >> >> > >>> >> ---
>> >> >> >> > >>> >>  grub-core/Makefile.core.def  | 1 +
>> >> >> >> > >>> >>  grub-core/loader/arm64/fdt.c | 5 +++++
>> >> >> >> > >>> >>  2 files changed, 6 insertions(+)
>> >> >> >> > >>> >>
>> >> >> >> > >>> >> diff --git a/grub-core/Makefile.core.def
>> >> >> >> > >>> >> b/grub-core/Makefile.core.def
>> >> >> >> > >>> >> index 2ef10d1..3ea4e49 100644
>> >> >> >> > >>> >> --- a/grub-core/Makefile.core.def
>> >> >> >> > >>> >> +++ b/grub-core/Makefile.core.def
>> >> >> >> > >>> >> @@ -1674,6 +1674,7 @@ module = {
>> >> >> >> > >>> >>  module = {
>> >> >> >> > >>> >>    name = fdt;
>> >> >> >> > >>> >>    arm64 = loader/arm64/fdt.c;
>> >> >> >> > >>> >> +  fdt = lib/fdt.c;
>> >> >> >> > >>> >>    enable = arm64;
>> >> >> >> > >>> >>  };
>> >> >> >> > >>> >>
>> >> >> >> > >>> > Please don't add same file to 2 different modules. Remove
>> >> >> >> > >>> > it
>> >> >> >> > >>> > from
>> >> >> >> > >>> > Linux
>> >> >> >> > >>> > module
>> >> >> >> > >>>
>> >> >> >> > >>> AFAIK, for now , only arm and arm64 are using lib/fdt.c
>> >> >> >> > >>> So please allow me to separate all the fdt code from
>> >> >> >> > >>> loader/arm/linux.c; just like arm64.
>> >> >> >> > >>>
>> >> >> >> > >> I don't think it's necessary at this point. Is xen_boot
>> >> >> >> > >> going
>> >> >> >> > >> to
>> >> >> >> > >> be
>> >> >> >> > >> available for 32-bit arm as well?
>> >> >> >> >
>> >> >> >> > And I would like to help to sort out the code for your new fdt
>> >> >> >> > module
>> >> >> >> > , If you don't mind.
>> >> >> >> >
>> >> >> >> > But according to my tests, I think we need "fdt = lib/fdt.c;"
>> >> >> >> > in
>> >> >> >> > module. If we don't separate fdt code from arm, we also need
>> >> >> >> > "fdt
>> >> >> >> > =
>> >> >> >> > lib/fdt.c;" in linux module.
>> >> >> >> >
>> >> >> >> > Please correct me if I misunderstand something, thanks
>> >> >> >> >
>> >> >> >> We need arm = lib/fdt.c in linux if we don't restructure. There
>> >> >> >> is
>> >> >> >> no
>> >> >> >> reason to include lib/fdt.c in 2 different modules on arm64. Fdt
>> >> >> >> in
>> >> >> >> first
>> >> >> >> part just mean arm and arm64 in this context
>> >> >> >>
>> >> >> > As an alternative: enable fdt module on all fdt platforms (enable
>> >> >> > =
>> >> >> > fdt)
>> >> >> > and
>> >> >> > put lib/fdt.c
>> >> >> >
>> >> >> >> > >>> This patch may become a patchset :-)
>> >> >> >> > >>>
>> >> >> >> > >>> >> diff --git a/grub-core/loader/arm64/fdt.c
>> >> >> >> > >>> >> b/grub-core/loader/arm64/fdt.c
>> >> >> >> > >>> >> index 5202c14..d160ca0 100644
>> >> >> >> > >>> >> --- a/grub-core/loader/arm64/fdt.c
>> >> >> >> > >>> >> +++ b/grub-core/loader/arm64/fdt.c
>> >> >> >> > >>> >> @@ -25,6 +25,10 @@
>> >> >> >> > >>> >>  #include <grub/file.h>
>> >> >> >> > >>> >>  #include <grub/efi/efi.h>
>> >> >> >> > >>> >>
>> >> >> >> > >>> >> +GRUB_MOD_LICENSE ("GPLv3+");
>> >> >> >> > >>> >> +
>> >> >> >> > >>> >> +static grub_dl_t my_mod;
>> >> >> >> > >>> >> +
>> >> >> >> > >>> > What's the reason for my_mod?
>> >> >> >> > >>>
>> >> >> >> > >>> this is for grub_dl_unref and grub_dl_ref. but I forgot to
>> >> >> >> > >>> check
>> >> >> >> > >>> this
>> >> >> >> > >>> again for this, sorry,
>> >> >> >> > >>> will add this later
>> >> >> >> > >>>
>> >> >> >> > >> Forget dl_ref and dl_unref. Linux module having a function
>> >> >> >> > >> reference
>> >> >> >> > >> is
>> >> >> >> > >> already good enough
>> >> >> >> > >>> >>  static void *loaded_fdt;
>> >> >> >> > >>> >>  static void *fdt;
>> >> >> >> > >>> >>
>> >> >> >> > >>> >> @@ -177,6 +181,7 @@ GRUB_MOD_INIT (fdt)
>> >> >> >> > >>> >>    cmd_devicetree =
>> >> >> >> > >>> >>      grub_register_command ("devicetree",
>> >> >> >> > >>> >> grub_cmd_devicetree,
>> >> >> >> > >>> >> 0,
>> >> >> >> > >>> >>                            N_("Load DTB file."));
>> >> >> >> > >>> >> +  my_mod = mod;
>> >> >> >> > >>> >>  }
>> >> >> >> > >>> >>
>> >> >> >> > >>> >>  GRUB_MOD_FINI (fdt)
>> >> >> >> > >>> >> --
>> >> >> >> > >>> >> 2.4.3
>> >> >> >> > >>> >>
>> >> >> >> > >>>
>> >> >> >> > >>>
>> >> >> >> > >>>
>> >> >> >> > >>> --
>> >> >> >> > >>> Best regards,
>> >> >> >> > >>>
>> >> >> >> > >>> Fu Wei
>> >> >> >> > >>> Software Engineer
>> >> >> >> > >>> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> >> >> >> > >>> Ph: +86 21 61221326(direct)
>> >> >> >> > >>> Ph: +86 186 2020 4684 (mobile)
>> >> >> >> > >>> Room 1512, Regus One Corporate Avenue,Level 15,
>> >> >> >> > >>> One Corporate Avenue,222 Hubin Road,Huangpu District,
>> >> >> >> > >>> Shanghai,China 200021
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> > >
>> >> >> >> > > --
>> >> >> >> > > Best regards,
>> >> >> >> > >
>> >> >> >> > > Fu Wei
>> >> >> >> > > Software Engineer
>> >> >> >> > > Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> >> >> >> > > Ph: +86 21 61221326(direct)
>> >> >> >> > > Ph: +86 186 2020 4684 (mobile)
>> >> >> >> > > Room 1512, Regus One Corporate Avenue,Level 15,
>> >> >> >> > > One Corporate Avenue,222 Hubin Road,Huangpu District,
>> >> >> >> > > Shanghai,China 200021
>> >> >> >> >
>> >> >> >> >
>> >> >> >> >
>> >> >> >> > --
>> >> >> >> > Best regards,
>> >> >> >> >
>> >> >> >> > Fu Wei
>> >> >> >> > Software Engineer
>> >> >> >> > Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> >> >> >> > Ph: +86 21 61221326(direct)
>> >> >> >> > Ph: +86 186 2020 4684 (mobile)
>> >> >> >> > Room 1512, Regus One Corporate Avenue,Level 15,
>> >> >> >> > One Corporate Avenue,222 Hubin Road,Huangpu District,
>> >> >> >> > Shanghai,China 200021
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Best regards,
>> >> >>
>> >> >> Fu Wei
>> >> >> Software Engineer
>> >> >> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> >> >> Ph: +86 21 61221326(direct)
>> >> >> Ph: +86 186 2020 4684 (mobile)
>> >> >> Room 1512, Regus One Corporate Avenue,Level 15,
>> >> >> One Corporate Avenue,222 Hubin Road,Huangpu District,
>> >> >> Shanghai,China 200021
>> >>
>> >>
>> >>
>> >> --
>> >> Best regards,
>> >>
>> >> Fu Wei
>> >> Software Engineer
>> >> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> >> Ph: +86 21 61221326(direct)
>> >> Ph: +86 186 2020 4684 (mobile)
>> >> Room 1512, Regus One Corporate Avenue,Level 15,
>> >> One Corporate Avenue,222 Hubin Road,Huangpu District,
>> >> Shanghai,China 200021
>>
>>
>>
>> --
>> Best regards,
>>
>> Fu Wei
>> Software Engineer
>> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> Ph: +86 21 61221326(direct)
>> Ph: +86 186 2020 4684 (mobile)
>> Room 1512, Regus One Corporate Avenue,Level 15,
>> One Corporate Avenue,222 Hubin Road,Huangpu District,
>> Shanghai,China 200021
Fu Wei Fu Nov. 9, 2015, 2:09 p.m. UTC | #2
Hi Vladimir,
Since you have merged a patch for Makefile problem, we just need to
fix the license problem.
I have sent the new little patch for that

Great thanks! :-) .

On 5 November 2015 at 23:03, Fu Wei <fu.wei@linaro.org> wrote:
> Hi Vladimir,
>
> Thanks for your help, I will test it on arm and arm64, then make a new patch
>
>
> On 5 November 2015 at 22:53, Vladimir 'phcoder' Serbinenko
> <phcoder@gmail.com> wrote:
>>
>> Le 5 nov. 2015 2:39 PM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>>
>>> Hi Vladimir,
>>>
>>>
>>
>>> On 5 November 2015 at 18:00, Vladimir 'phcoder' Serbinenko
>>> <phcoder@gmail.com> wrote:
>>> >
>>> > Le 5 nov. 2015 10:48 AM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>> >>
>>> >> Hi Vladimir
>>> >>
>>> >> On 5 November 2015 at 17:45, Vladimir 'phcoder' Serbinenko
>>> >> <phcoder@gmail.com> wrote:
>>> >> >
>>> >> > Le 5 nov. 2015 9:51 AM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>> >> >>
>>> >> >> Hi Vladimir
>>> >> >>
>>> >> >> Please correct me :-)
>>> >> >> Can I do this :
>>> >> >>
>>> >> >> diff --git a/grub-core/Makefile.core.def
>>> >> >> b/grub-core/Makefile.core.def
>>> >> >> index 2ef10d1..ea5831f 100644
>>> >> >> --- a/grub-core/Makefile.core.def
>>> >> >> +++ b/grub-core/Makefile.core.def
>>> >> >> @@ -1665,7 +1665,6 @@ module = {
>>> >> >>    ia64_efi = loader/ia64/efi/linux.c;
>>> >> >>    arm = loader/arm/linux.c;
>>> >> >>    arm64 = loader/arm64/linux.c;
>>> >> >> -  fdt = lib/fdt.c;
>>> >> >>    common = loader/linux.c;
>>> >> >>    common = lib/cmdline.c;
>>> >> >>    enable = noemu;
>>> >> >> @@ -1674,7 +1673,9 @@ module = {
>>> >> >>  module = {
>>> >> >>    name = fdt;
>>> >> >>    arm64 = loader/arm64/fdt.c;
>>> >> >> -  enable = arm64;
>>> >> >> +  arm = loader/arm/fdt.c;
>>> >> > Where does this file come from?
>>> >> >
>>> >>
>>> >> that is the file I am working on
>>> >>
>>> >> i just tried to let you know my thought.
>>> >>
>>> >> Is this way Ok for you? Please correct me if I misunderstand you
>>> >>
>>> > What is the reason to reshuffle fdt code for 32-bit arm?
>>>
>>> reason:
>>> we can delete fdt = lib/fdt.c; in linux module,
>>> make this only in fdt module.
>>>
>> You don't need to actually shuffle any code. Just see the attached patch
>>
>>>
>>> > Does it merge any code with arm64?
>>>
>>> No, because arm64 uses uefi runtime service, but arm doesn't
>>>
>>> > Will this code be used by anything besides linux module?
>>>
>>> For arm64, as you know, yes, by xen_boot,
>>> but for arm, NO
>>>
>>> So maybe we can do this:
>>>
>>> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
>>> index 3ea4e49..db36a68 100644
>>> --- a/grub-core/Makefile.core.def
>>> +++ b/grub-core/Makefile.core.def
>>> @@ -1664,8 +1664,8 @@ module = {
>>>    sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
>>>    ia64_efi = loader/ia64/efi/linux.c;
>>>    arm = loader/arm/linux.c;
>>> +  arm = lib/fdt.c;
>>>    arm64 = loader/arm64/linux.c;
>>> -  fdt = lib/fdt.c;
>>>    common = loader/linux.c;
>>>    common = lib/cmdline.c;
>>>    enable = noemu;
>>> @@ -1674,7 +1674,7 @@ module = {
>>>  module = {
>>>    name = fdt;
>>>    arm64 = loader/arm64/fdt.c;
>>> -  fdt = lib/fdt.c;
>>> +  common = lib/fdt.c;
>>>    enable = arm64;
>>>  };
>>>
>>>
>>> >
>>> >>
>>> >> >
>>> >> >> +  common = lib/fdt.c;
>>> >> >> +  enable = fdt;
>>> >> >>  };
>>> >> >>
>>> >> >>  module = {
>>> >> >>
>>> >> >> On 4 November 2015 at 19:16, Vladimir 'phcoder' Serbinenko
>>> >> >> <phcoder@gmail.com> wrote:
>>> >> >> >
>>> >> >> > Le 4 nov. 2015 12:12 PM, "Vladimir 'phcoder' Serbinenko"
>>> >> >> > <phcoder@gmail.com>
>>> >> >> > a écrit :
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> Le 4 nov. 2015 12:09 PM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>> >> >> >> >
>>> >> >> >> >  Hi Vladimir,
>>> >> >> >> >
>>> >> >> >> > On 4 November 2015 at 19:06, Fu Wei <fu.wei@linaro.org> wrote:
>>> >> >> >> > > Hi Vladimir,
>>> >> >> >> > >
>>> >> >> >> > > On 4 November 2015 at 18:47, Vladimir 'phcoder' Serbinenko
>>> >> >> >> > > <phcoder@gmail.com> wrote:
>>> >> >> >> > >>
>>> >> >> >> > >> Le 4 nov. 2015 10:48 AM, "Fu Wei" <fu.wei@linaro.org> a
>>> >> >> >> > >> écrit :
>>> >> >> >> > >>>
>>> >> >> >> > >>> Hi Vladimir,
>>> >> >> >> > >>>
>>> >> >> >> > >>> Great thanks for your help :-)
>>> >> >> >> > >>>
>>> >> >> >> > >>>
>>> >> >> >> > >>> On 4 November 2015 at 02:07, Vladimir 'phcoder' Serbinenko
>>> >> >> >> > >>> <phcoder@gmail.com> wrote:
>>> >> >> >> > >>> >
>>> >> >> >> > >>> > Le 3 nov. 2015 9:56 AM, <fu.wei@linaro.org> a écrit :
>>> >> >> >> > >>> >>
>>> >> >> >> > >>> >> From: Fu Wei <fu.wei@linaro.org>
>>> >> >> >> > >>> >>
>>> >> >> >> > >>> >> This patch goes with commit:
>>> >> >> >> > >>> >> 4d0cb755387d6f109b901386ed4d3d475df239fe
>>> >> >> >> > >>> >>  arm64: Move FDT functions to separate module
>>> >> >> >> > >>> >>
>>> >> >> >> > >>> >> linux and xen_boot modules can't work without this
>>> >> >> >> > >>> >> patch.
>>> >> >> >> > >>> >>
>>> >> >> >> > >>> >> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>>> >> >> >> > >>> >> ---
>>> >> >> >> > >>> >>  grub-core/Makefile.core.def  | 1 +
>>> >> >> >> > >>> >>  grub-core/loader/arm64/fdt.c | 5 +++++
>>> >> >> >> > >>> >>  2 files changed, 6 insertions(+)
>>> >> >> >> > >>> >>
>>> >> >> >> > >>> >> diff --git a/grub-core/Makefile.core.def
>>> >> >> >> > >>> >> b/grub-core/Makefile.core.def
>>> >> >> >> > >>> >> index 2ef10d1..3ea4e49 100644
>>> >> >> >> > >>> >> --- a/grub-core/Makefile.core.def
>>> >> >> >> > >>> >> +++ b/grub-core/Makefile.core.def
>>> >> >> >> > >>> >> @@ -1674,6 +1674,7 @@ module = {
>>> >> >> >> > >>> >>  module = {
>>> >> >> >> > >>> >>    name = fdt;
>>> >> >> >> > >>> >>    arm64 = loader/arm64/fdt.c;
>>> >> >> >> > >>> >> +  fdt = lib/fdt.c;
>>> >> >> >> > >>> >>    enable = arm64;
>>> >> >> >> > >>> >>  };
>>> >> >> >> > >>> >>
>>> >> >> >> > >>> > Please don't add same file to 2 different modules. Remove
>>> >> >> >> > >>> > it
>>> >> >> >> > >>> > from
>>> >> >> >> > >>> > Linux
>>> >> >> >> > >>> > module
>>> >> >> >> > >>>
>>> >> >> >> > >>> AFAIK, for now , only arm and arm64 are using lib/fdt.c
>>> >> >> >> > >>> So please allow me to separate all the fdt code from
>>> >> >> >> > >>> loader/arm/linux.c; just like arm64.
>>> >> >> >> > >>>
>>> >> >> >> > >> I don't think it's necessary at this point. Is xen_boot
>>> >> >> >> > >> going
>>> >> >> >> > >> to
>>> >> >> >> > >> be
>>> >> >> >> > >> available for 32-bit arm as well?
>>> >> >> >> >
>>> >> >> >> > And I would like to help to sort out the code for your new fdt
>>> >> >> >> > module
>>> >> >> >> > , If you don't mind.
>>> >> >> >> >
>>> >> >> >> > But according to my tests, I think we need "fdt = lib/fdt.c;"
>>> >> >> >> > in
>>> >> >> >> > module. If we don't separate fdt code from arm, we also need
>>> >> >> >> > "fdt
>>> >> >> >> > =
>>> >> >> >> > lib/fdt.c;" in linux module.
>>> >> >> >> >
>>> >> >> >> > Please correct me if I misunderstand something, thanks
>>> >> >> >> >
>>> >> >> >> We need arm = lib/fdt.c in linux if we don't restructure. There
>>> >> >> >> is
>>> >> >> >> no
>>> >> >> >> reason to include lib/fdt.c in 2 different modules on arm64. Fdt
>>> >> >> >> in
>>> >> >> >> first
>>> >> >> >> part just mean arm and arm64 in this context
>>> >> >> >>
>>> >> >> > As an alternative: enable fdt module on all fdt platforms (enable
>>> >> >> > =
>>> >> >> > fdt)
>>> >> >> > and
>>> >> >> > put lib/fdt.c
>>> >> >> >
>>> >> >> >> > >>> This patch may become a patchset :-)
>>> >> >> >> > >>>
>>> >> >> >> > >>> >> diff --git a/grub-core/loader/arm64/fdt.c
>>> >> >> >> > >>> >> b/grub-core/loader/arm64/fdt.c
>>> >> >> >> > >>> >> index 5202c14..d160ca0 100644
>>> >> >> >> > >>> >> --- a/grub-core/loader/arm64/fdt.c
>>> >> >> >> > >>> >> +++ b/grub-core/loader/arm64/fdt.c
>>> >> >> >> > >>> >> @@ -25,6 +25,10 @@
>>> >> >> >> > >>> >>  #include <grub/file.h>
>>> >> >> >> > >>> >>  #include <grub/efi/efi.h>
>>> >> >> >> > >>> >>
>>> >> >> >> > >>> >> +GRUB_MOD_LICENSE ("GPLv3+");
>>> >> >> >> > >>> >> +
>>> >> >> >> > >>> >> +static grub_dl_t my_mod;
>>> >> >> >> > >>> >> +
>>> >> >> >> > >>> > What's the reason for my_mod?
>>> >> >> >> > >>>
>>> >> >> >> > >>> this is for grub_dl_unref and grub_dl_ref. but I forgot to
>>> >> >> >> > >>> check
>>> >> >> >> > >>> this
>>> >> >> >> > >>> again for this, sorry,
>>> >> >> >> > >>> will add this later
>>> >> >> >> > >>>
>>> >> >> >> > >> Forget dl_ref and dl_unref. Linux module having a function
>>> >> >> >> > >> reference
>>> >> >> >> > >> is
>>> >> >> >> > >> already good enough
>>> >> >> >> > >>> >>  static void *loaded_fdt;
>>> >> >> >> > >>> >>  static void *fdt;
>>> >> >> >> > >>> >>
>>> >> >> >> > >>> >> @@ -177,6 +181,7 @@ GRUB_MOD_INIT (fdt)
>>> >> >> >> > >>> >>    cmd_devicetree =
>>> >> >> >> > >>> >>      grub_register_command ("devicetree",
>>> >> >> >> > >>> >> grub_cmd_devicetree,
>>> >> >> >> > >>> >> 0,
>>> >> >> >> > >>> >>                            N_("Load DTB file."));
>>> >> >> >> > >>> >> +  my_mod = mod;
>>> >> >> >> > >>> >>  }
>>> >> >> >> > >>> >>
>>> >> >> >> > >>> >>  GRUB_MOD_FINI (fdt)
>>> >> >> >> > >>> >> --
>>> >> >> >> > >>> >> 2.4.3
>>> >> >> >> > >>> >>
>>> >> >> >> > >>>
>>> >> >> >> > >>>
>>> >> >> >> > >>>
>>> >> >> >> > >>> --
>>> >> >> >> > >>> Best regards,
>>> >> >> >> > >>>
>>> >> >> >> > >>> Fu Wei
>>> >> >> >> > >>> Software Engineer
>>> >> >> >> > >>> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>> >> >> >> > >>> Ph: +86 21 61221326(direct)
>>> >> >> >> > >>> Ph: +86 186 2020 4684 (mobile)
>>> >> >> >> > >>> Room 1512, Regus One Corporate Avenue,Level 15,
>>> >> >> >> > >>> One Corporate Avenue,222 Hubin Road,Huangpu District,
>>> >> >> >> > >>> Shanghai,China 200021
>>> >> >> >> > >
>>> >> >> >> > >
>>> >> >> >> > >
>>> >> >> >> > > --
>>> >> >> >> > > Best regards,
>>> >> >> >> > >
>>> >> >> >> > > Fu Wei
>>> >> >> >> > > Software Engineer
>>> >> >> >> > > Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>> >> >> >> > > Ph: +86 21 61221326(direct)
>>> >> >> >> > > Ph: +86 186 2020 4684 (mobile)
>>> >> >> >> > > Room 1512, Regus One Corporate Avenue,Level 15,
>>> >> >> >> > > One Corporate Avenue,222 Hubin Road,Huangpu District,
>>> >> >> >> > > Shanghai,China 200021
>>> >> >> >> >
>>> >> >> >> >
>>> >> >> >> >
>>> >> >> >> > --
>>> >> >> >> > Best regards,
>>> >> >> >> >
>>> >> >> >> > Fu Wei
>>> >> >> >> > Software Engineer
>>> >> >> >> > Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>> >> >> >> > Ph: +86 21 61221326(direct)
>>> >> >> >> > Ph: +86 186 2020 4684 (mobile)
>>> >> >> >> > Room 1512, Regus One Corporate Avenue,Level 15,
>>> >> >> >> > One Corporate Avenue,222 Hubin Road,Huangpu District,
>>> >> >> >> > Shanghai,China 200021
>>> >> >>
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >> Best regards,
>>> >> >>
>>> >> >> Fu Wei
>>> >> >> Software Engineer
>>> >> >> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>> >> >> Ph: +86 21 61221326(direct)
>>> >> >> Ph: +86 186 2020 4684 (mobile)
>>> >> >> Room 1512, Regus One Corporate Avenue,Level 15,
>>> >> >> One Corporate Avenue,222 Hubin Road,Huangpu District,
>>> >> >> Shanghai,China 200021
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Best regards,
>>> >>
>>> >> Fu Wei
>>> >> Software Engineer
>>> >> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>> >> Ph: +86 21 61221326(direct)
>>> >> Ph: +86 186 2020 4684 (mobile)
>>> >> Room 1512, Regus One Corporate Avenue,Level 15,
>>> >> One Corporate Avenue,222 Hubin Road,Huangpu District,
>>> >> Shanghai,China 200021
>>>
>>>
>>>
>>> --
>>> Best regards,
>>>
>>> Fu Wei
>>> Software Engineer
>>> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>> Ph: +86 21 61221326(direct)
>>> Ph: +86 186 2020 4684 (mobile)
>>> Room 1512, Regus One Corporate Avenue,Level 15,
>>> One Corporate Avenue,222 Hubin Road,Huangpu District,
>>> Shanghai,China 200021
>
>
>
> --
> Best regards,
>
> Fu Wei
> Software Engineer
> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
> Ph: +86 21 61221326(direct)
> Ph: +86 186 2020 4684 (mobile)
> Room 1512, Regus One Corporate Avenue,Level 15,
> One Corporate Avenue,222 Hubin Road,Huangpu District,
> Shanghai,China 200021
Fu Wei Fu Nov. 9, 2015, 3:12 p.m. UTC | #3
Hi Vladimir,

But I think maybe we still need to make a loader/arm/fdt.c, but
because if we don't , we will get "incompatible license" error.

On 9 November 2015 at 22:09, Fu Wei <fu.wei@linaro.org> wrote:
> Hi Vladimir,
> Since you have merged a patch for Makefile problem, we just need to
> fix the license problem.
> I have sent the new little patch for that
>
> Great thanks! :-) .
>
> On 5 November 2015 at 23:03, Fu Wei <fu.wei@linaro.org> wrote:
>> Hi Vladimir,
>>
>> Thanks for your help, I will test it on arm and arm64, then make a new patch
>>
>>
>> On 5 November 2015 at 22:53, Vladimir 'phcoder' Serbinenko
>> <phcoder@gmail.com> wrote:
>>>
>>> Le 5 nov. 2015 2:39 PM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>>>
>>>> Hi Vladimir,
>>>>
>>>>
>>>
>>>> On 5 November 2015 at 18:00, Vladimir 'phcoder' Serbinenko
>>>> <phcoder@gmail.com> wrote:
>>>> >
>>>> > Le 5 nov. 2015 10:48 AM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>>> >>
>>>> >> Hi Vladimir
>>>> >>
>>>> >> On 5 November 2015 at 17:45, Vladimir 'phcoder' Serbinenko
>>>> >> <phcoder@gmail.com> wrote:
>>>> >> >
>>>> >> > Le 5 nov. 2015 9:51 AM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>>> >> >>
>>>> >> >> Hi Vladimir
>>>> >> >>
>>>> >> >> Please correct me :-)
>>>> >> >> Can I do this :
>>>> >> >>
>>>> >> >> diff --git a/grub-core/Makefile.core.def
>>>> >> >> b/grub-core/Makefile.core.def
>>>> >> >> index 2ef10d1..ea5831f 100644
>>>> >> >> --- a/grub-core/Makefile.core.def
>>>> >> >> +++ b/grub-core/Makefile.core.def
>>>> >> >> @@ -1665,7 +1665,6 @@ module = {
>>>> >> >>    ia64_efi = loader/ia64/efi/linux.c;
>>>> >> >>    arm = loader/arm/linux.c;
>>>> >> >>    arm64 = loader/arm64/linux.c;
>>>> >> >> -  fdt = lib/fdt.c;
>>>> >> >>    common = loader/linux.c;
>>>> >> >>    common = lib/cmdline.c;
>>>> >> >>    enable = noemu;
>>>> >> >> @@ -1674,7 +1673,9 @@ module = {
>>>> >> >>  module = {
>>>> >> >>    name = fdt;
>>>> >> >>    arm64 = loader/arm64/fdt.c;
>>>> >> >> -  enable = arm64;
>>>> >> >> +  arm = loader/arm/fdt.c;
>>>> >> > Where does this file come from?
>>>> >> >
>>>> >>
>>>> >> that is the file I am working on
>>>> >>
>>>> >> i just tried to let you know my thought.
>>>> >>
>>>> >> Is this way Ok for you? Please correct me if I misunderstand you
>>>> >>
>>>> > What is the reason to reshuffle fdt code for 32-bit arm?
>>>>
>>>> reason:
>>>> we can delete fdt = lib/fdt.c; in linux module,
>>>> make this only in fdt module.
>>>>
>>> You don't need to actually shuffle any code. Just see the attached patch
>>>
>>>>
>>>> > Does it merge any code with arm64?
>>>>
>>>> No, because arm64 uses uefi runtime service, but arm doesn't
>>>>
>>>> > Will this code be used by anything besides linux module?
>>>>
>>>> For arm64, as you know, yes, by xen_boot,
>>>> but for arm, NO
>>>>
>>>> So maybe we can do this:
>>>>
>>>> diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
>>>> index 3ea4e49..db36a68 100644
>>>> --- a/grub-core/Makefile.core.def
>>>> +++ b/grub-core/Makefile.core.def
>>>> @@ -1664,8 +1664,8 @@ module = {
>>>>    sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
>>>>    ia64_efi = loader/ia64/efi/linux.c;
>>>>    arm = loader/arm/linux.c;
>>>> +  arm = lib/fdt.c;
>>>>    arm64 = loader/arm64/linux.c;
>>>> -  fdt = lib/fdt.c;
>>>>    common = loader/linux.c;
>>>>    common = lib/cmdline.c;
>>>>    enable = noemu;
>>>> @@ -1674,7 +1674,7 @@ module = {
>>>>  module = {
>>>>    name = fdt;
>>>>    arm64 = loader/arm64/fdt.c;
>>>> -  fdt = lib/fdt.c;
>>>> +  common = lib/fdt.c;
>>>>    enable = arm64;
>>>>  };
>>>>
>>>>
>>>> >
>>>> >>
>>>> >> >
>>>> >> >> +  common = lib/fdt.c;
>>>> >> >> +  enable = fdt;
>>>> >> >>  };
>>>> >> >>
>>>> >> >>  module = {
>>>> >> >>
>>>> >> >> On 4 November 2015 at 19:16, Vladimir 'phcoder' Serbinenko
>>>> >> >> <phcoder@gmail.com> wrote:
>>>> >> >> >
>>>> >> >> > Le 4 nov. 2015 12:12 PM, "Vladimir 'phcoder' Serbinenko"
>>>> >> >> > <phcoder@gmail.com>
>>>> >> >> > a écrit :
>>>> >> >> >>
>>>> >> >> >>
>>>> >> >> >> Le 4 nov. 2015 12:09 PM, "Fu Wei" <fu.wei@linaro.org> a écrit :
>>>> >> >> >> >
>>>> >> >> >> >  Hi Vladimir,
>>>> >> >> >> >
>>>> >> >> >> > On 4 November 2015 at 19:06, Fu Wei <fu.wei@linaro.org> wrote:
>>>> >> >> >> > > Hi Vladimir,
>>>> >> >> >> > >
>>>> >> >> >> > > On 4 November 2015 at 18:47, Vladimir 'phcoder' Serbinenko
>>>> >> >> >> > > <phcoder@gmail.com> wrote:
>>>> >> >> >> > >>
>>>> >> >> >> > >> Le 4 nov. 2015 10:48 AM, "Fu Wei" <fu.wei@linaro.org> a
>>>> >> >> >> > >> écrit :
>>>> >> >> >> > >>>
>>>> >> >> >> > >>> Hi Vladimir,
>>>> >> >> >> > >>>
>>>> >> >> >> > >>> Great thanks for your help :-)
>>>> >> >> >> > >>>
>>>> >> >> >> > >>>
>>>> >> >> >> > >>> On 4 November 2015 at 02:07, Vladimir 'phcoder' Serbinenko
>>>> >> >> >> > >>> <phcoder@gmail.com> wrote:
>>>> >> >> >> > >>> >
>>>> >> >> >> > >>> > Le 3 nov. 2015 9:56 AM, <fu.wei@linaro.org> a écrit :
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>> >> From: Fu Wei <fu.wei@linaro.org>
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>> >> This patch goes with commit:
>>>> >> >> >> > >>> >> 4d0cb755387d6f109b901386ed4d3d475df239fe
>>>> >> >> >> > >>> >>  arm64: Move FDT functions to separate module
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>> >> linux and xen_boot modules can't work without this
>>>> >> >> >> > >>> >> patch.
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>> >> Signed-off-by: Fu Wei <fu.wei@linaro.org>
>>>> >> >> >> > >>> >> ---
>>>> >> >> >> > >>> >>  grub-core/Makefile.core.def  | 1 +
>>>> >> >> >> > >>> >>  grub-core/loader/arm64/fdt.c | 5 +++++
>>>> >> >> >> > >>> >>  2 files changed, 6 insertions(+)
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>> >> diff --git a/grub-core/Makefile.core.def
>>>> >> >> >> > >>> >> b/grub-core/Makefile.core.def
>>>> >> >> >> > >>> >> index 2ef10d1..3ea4e49 100644
>>>> >> >> >> > >>> >> --- a/grub-core/Makefile.core.def
>>>> >> >> >> > >>> >> +++ b/grub-core/Makefile.core.def
>>>> >> >> >> > >>> >> @@ -1674,6 +1674,7 @@ module = {
>>>> >> >> >> > >>> >>  module = {
>>>> >> >> >> > >>> >>    name = fdt;
>>>> >> >> >> > >>> >>    arm64 = loader/arm64/fdt.c;
>>>> >> >> >> > >>> >> +  fdt = lib/fdt.c;
>>>> >> >> >> > >>> >>    enable = arm64;
>>>> >> >> >> > >>> >>  };
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>> > Please don't add same file to 2 different modules. Remove
>>>> >> >> >> > >>> > it
>>>> >> >> >> > >>> > from
>>>> >> >> >> > >>> > Linux
>>>> >> >> >> > >>> > module
>>>> >> >> >> > >>>
>>>> >> >> >> > >>> AFAIK, for now , only arm and arm64 are using lib/fdt.c
>>>> >> >> >> > >>> So please allow me to separate all the fdt code from
>>>> >> >> >> > >>> loader/arm/linux.c; just like arm64.
>>>> >> >> >> > >>>
>>>> >> >> >> > >> I don't think it's necessary at this point. Is xen_boot
>>>> >> >> >> > >> going
>>>> >> >> >> > >> to
>>>> >> >> >> > >> be
>>>> >> >> >> > >> available for 32-bit arm as well?
>>>> >> >> >> >
>>>> >> >> >> > And I would like to help to sort out the code for your new fdt
>>>> >> >> >> > module
>>>> >> >> >> > , If you don't mind.
>>>> >> >> >> >
>>>> >> >> >> > But according to my tests, I think we need "fdt = lib/fdt.c;"
>>>> >> >> >> > in
>>>> >> >> >> > module. If we don't separate fdt code from arm, we also need
>>>> >> >> >> > "fdt
>>>> >> >> >> > =
>>>> >> >> >> > lib/fdt.c;" in linux module.
>>>> >> >> >> >
>>>> >> >> >> > Please correct me if I misunderstand something, thanks
>>>> >> >> >> >
>>>> >> >> >> We need arm = lib/fdt.c in linux if we don't restructure. There
>>>> >> >> >> is
>>>> >> >> >> no
>>>> >> >> >> reason to include lib/fdt.c in 2 different modules on arm64. Fdt
>>>> >> >> >> in
>>>> >> >> >> first
>>>> >> >> >> part just mean arm and arm64 in this context
>>>> >> >> >>
>>>> >> >> > As an alternative: enable fdt module on all fdt platforms (enable
>>>> >> >> > =
>>>> >> >> > fdt)
>>>> >> >> > and
>>>> >> >> > put lib/fdt.c
>>>> >> >> >
>>>> >> >> >> > >>> This patch may become a patchset :-)
>>>> >> >> >> > >>>
>>>> >> >> >> > >>> >> diff --git a/grub-core/loader/arm64/fdt.c
>>>> >> >> >> > >>> >> b/grub-core/loader/arm64/fdt.c
>>>> >> >> >> > >>> >> index 5202c14..d160ca0 100644
>>>> >> >> >> > >>> >> --- a/grub-core/loader/arm64/fdt.c
>>>> >> >> >> > >>> >> +++ b/grub-core/loader/arm64/fdt.c
>>>> >> >> >> > >>> >> @@ -25,6 +25,10 @@
>>>> >> >> >> > >>> >>  #include <grub/file.h>
>>>> >> >> >> > >>> >>  #include <grub/efi/efi.h>
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>> >> +GRUB_MOD_LICENSE ("GPLv3+");
>>>> >> >> >> > >>> >> +
>>>> >> >> >> > >>> >> +static grub_dl_t my_mod;
>>>> >> >> >> > >>> >> +
>>>> >> >> >> > >>> > What's the reason for my_mod?
>>>> >> >> >> > >>>
>>>> >> >> >> > >>> this is for grub_dl_unref and grub_dl_ref. but I forgot to
>>>> >> >> >> > >>> check
>>>> >> >> >> > >>> this
>>>> >> >> >> > >>> again for this, sorry,
>>>> >> >> >> > >>> will add this later
>>>> >> >> >> > >>>
>>>> >> >> >> > >> Forget dl_ref and dl_unref. Linux module having a function
>>>> >> >> >> > >> reference
>>>> >> >> >> > >> is
>>>> >> >> >> > >> already good enough
>>>> >> >> >> > >>> >>  static void *loaded_fdt;
>>>> >> >> >> > >>> >>  static void *fdt;
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>> >> @@ -177,6 +181,7 @@ GRUB_MOD_INIT (fdt)
>>>> >> >> >> > >>> >>    cmd_devicetree =
>>>> >> >> >> > >>> >>      grub_register_command ("devicetree",
>>>> >> >> >> > >>> >> grub_cmd_devicetree,
>>>> >> >> >> > >>> >> 0,
>>>> >> >> >> > >>> >>                            N_("Load DTB file."));
>>>> >> >> >> > >>> >> +  my_mod = mod;
>>>> >> >> >> > >>> >>  }
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>> >>  GRUB_MOD_FINI (fdt)
>>>> >> >> >> > >>> >> --
>>>> >> >> >> > >>> >> 2.4.3
>>>> >> >> >> > >>> >>
>>>> >> >> >> > >>>
>>>> >> >> >> > >>>
>>>> >> >> >> > >>>
>>>> >> >> >> > >>> --
>>>> >> >> >> > >>> Best regards,
>>>> >> >> >> > >>>
>>>> >> >> >> > >>> Fu Wei
>>>> >> >> >> > >>> Software Engineer
>>>> >> >> >> > >>> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>>> >> >> >> > >>> Ph: +86 21 61221326(direct)
>>>> >> >> >> > >>> Ph: +86 186 2020 4684 (mobile)
>>>> >> >> >> > >>> Room 1512, Regus One Corporate Avenue,Level 15,
>>>> >> >> >> > >>> One Corporate Avenue,222 Hubin Road,Huangpu District,
>>>> >> >> >> > >>> Shanghai,China 200021
>>>> >> >> >> > >
>>>> >> >> >> > >
>>>> >> >> >> > >
>>>> >> >> >> > > --
>>>> >> >> >> > > Best regards,
>>>> >> >> >> > >
>>>> >> >> >> > > Fu Wei
>>>> >> >> >> > > Software Engineer
>>>> >> >> >> > > Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>>> >> >> >> > > Ph: +86 21 61221326(direct)
>>>> >> >> >> > > Ph: +86 186 2020 4684 (mobile)
>>>> >> >> >> > > Room 1512, Regus One Corporate Avenue,Level 15,
>>>> >> >> >> > > One Corporate Avenue,222 Hubin Road,Huangpu District,
>>>> >> >> >> > > Shanghai,China 200021
>>>> >> >> >> >
>>>> >> >> >> >
>>>> >> >> >> >
>>>> >> >> >> > --
>>>> >> >> >> > Best regards,
>>>> >> >> >> >
>>>> >> >> >> > Fu Wei
>>>> >> >> >> > Software Engineer
>>>> >> >> >> > Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>>> >> >> >> > Ph: +86 21 61221326(direct)
>>>> >> >> >> > Ph: +86 186 2020 4684 (mobile)
>>>> >> >> >> > Room 1512, Regus One Corporate Avenue,Level 15,
>>>> >> >> >> > One Corporate Avenue,222 Hubin Road,Huangpu District,
>>>> >> >> >> > Shanghai,China 200021
>>>> >> >>
>>>> >> >>
>>>> >> >>
>>>> >> >> --
>>>> >> >> Best regards,
>>>> >> >>
>>>> >> >> Fu Wei
>>>> >> >> Software Engineer
>>>> >> >> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>>> >> >> Ph: +86 21 61221326(direct)
>>>> >> >> Ph: +86 186 2020 4684 (mobile)
>>>> >> >> Room 1512, Regus One Corporate Avenue,Level 15,
>>>> >> >> One Corporate Avenue,222 Hubin Road,Huangpu District,
>>>> >> >> Shanghai,China 200021
>>>> >>
>>>> >>
>>>> >>
>>>> >> --
>>>> >> Best regards,
>>>> >>
>>>> >> Fu Wei
>>>> >> Software Engineer
>>>> >> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>>> >> Ph: +86 21 61221326(direct)
>>>> >> Ph: +86 186 2020 4684 (mobile)
>>>> >> Room 1512, Regus One Corporate Avenue,Level 15,
>>>> >> One Corporate Avenue,222 Hubin Road,Huangpu District,
>>>> >> Shanghai,China 200021
>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>>
>>>> Fu Wei
>>>> Software Engineer
>>>> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>>>> Ph: +86 21 61221326(direct)
>>>> Ph: +86 186 2020 4684 (mobile)
>>>> Room 1512, Regus One Corporate Avenue,Level 15,
>>>> One Corporate Avenue,222 Hubin Road,Huangpu District,
>>>> Shanghai,China 200021
>>
>>
>>
>> --
>> Best regards,
>>
>> Fu Wei
>> Software Engineer
>> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
>> Ph: +86 21 61221326(direct)
>> Ph: +86 186 2020 4684 (mobile)
>> Room 1512, Regus One Corporate Avenue,Level 15,
>> One Corporate Avenue,222 Hubin Road,Huangpu District,
>> Shanghai,China 200021
>
>
>
> --
> Best regards,
>
> Fu Wei
> Software Engineer
> Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
> Ph: +86 21 61221326(direct)
> Ph: +86 186 2020 4684 (mobile)
> Room 1512, Regus One Corporate Avenue,Level 15,
> One Corporate Avenue,222 Hubin Road,Huangpu District,
> Shanghai,China 200021
diff mbox

Patch

diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 3ea4e49..db36a68 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -1664,8 +1664,8 @@  module = {
   sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
   ia64_efi = loader/ia64/efi/linux.c;
   arm = loader/arm/linux.c;
+  arm = lib/fdt.c;
   arm64 = loader/arm64/linux.c;
-  fdt = lib/fdt.c;
   common = loader/linux.c;
   common = lib/cmdline.c;
   enable = noemu;
@@ -1674,7 +1674,7 @@  module = {
 module = {
   name = fdt;
   arm64 = loader/arm64/fdt.c;
-  fdt = lib/fdt.c;
+  common = lib/fdt.c;
   enable = arm64;
 };