ä 2020å4æ6æ GMT+08:00 äå6:57:18, YunQiang Su <wzssyqa@xxxxxxxxx> åå:
Maciej W. Rozycki <macro@xxxxxxxxxxxxxx> ä2020å4æ6æåä äå1:23åéï
and
On Mon, 6 Apr 2020, Jiaxun Yang wrote:
> > Given the description above I think it should be done uniformly
> >automatically across all platforms by trimming the addresssupplied
> >withwhere
> >$(load-y) to low 8 digits in a single place, that is at the place
> >Makefile
> >the variable is consumed. This will reduce clutter across
> >fragments, avoid inconsistencies and extra work to handleindividual
> >platforms as the problem is triggered over and over again, andlimit
> >thevariable.
> >risk of mistakes.
>
> I was intended to do like this but failed to find a proper way.
>
> Makefile isn't designed for any kind of calculation.
> And shell variables are 64-bit signed so it can't hold such a huge
>use in
> Just wish somebody can give me a way to do like:
>
> ifndef CONFIG_64BIT
> load-y = $(load-y) & 0xffffffff
> endif
Use the usual shell tools like `sed', `cut', `awk', or whatever we
perl may be the easiest to use tool here.
ifndef CONFIG_64BIT
load-y := $(shell $(PERL) -e 'print $(load-y) & 0xffffffff')
endif
Note that it is `:=' instead of '='.
It seems like perl is not one of kernel's build dependencies.[1]
I'm comsidering a alternative solution,
write a small hostprog in C to deal with that.
Thanks.
[1]: https://www.kernel.org/doc/html/v5.6/process/changes.html
the kernel build already for other purposes. There's no need to doany
actual calculation here to extract the last 8 characters (and theleading
`0x' prefix). At worst you can write a small C program, compile itwith
the build system compiler and run, as we already do for some stuff.
Maciej
--
Jiaxun Yang