Re: Compiling kernel-3.4.xxx with gcc-9.x. Need some help.

From: Fawad Lateef
Date: Tue Mar 30 2021 - 09:24:04 EST


Hi Arnd,


On Mon, 29 Mar 2021 at 22:06, Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
>
> On Mon, Mar 29, 2021 at 9:23 PM Fawad Lateef <fawadlateef@xxxxxxxxx> wrote:
> >
> > On Mon, 29 Mar 2021 at 06:57, Greg KH <greg@xxxxxxxxx> wrote:
> > >
> > > On Sun, Mar 28, 2021 at 10:20:50PM +0200, Fawad Lateef wrote:
> > > > Hi
> > > >
> > > > I am using an Olimex A20 SOM with NAND and due to some binary blob for
> > > > NAND driver, I am stuck with the sunxi kernel 3.4.xxx version. (Repo
> > > > here: https://github.com/linux-sunxi/linux-sunxi)
> > >
> > > Please work with the vendor that is forcing you to use this obsolete and
> > > insecure kernel version. You are paying for that support, and they are
> > > the only ones that can support you.
> > >
> >
> > The problem is vendor Olimex now have eMMC based SOM which is
> > supported by mainline kernel _but_ they still selling NAND SOM and
> > only supporting 3.4 kernel (as this is the only latest version from
> > sunxi with NAND support, after that sunxi is now moved away from NAND
> > too).
>
> From a very quick look at the git history, I can tell that A20 NAND driver
> support was added in linux-4.8. Have you actually tried a modern kernel?
>

I tried compiling and booting kernel v4.4 (from sunxi repo on github)
but unable to make it boot. Stuck at "Starting kernel". By the way I
am booting from RAM (using the sunxi usbboot/usb-otg option).

You mentioned that it's supported from linux-4.8 (from your quick look
at git history); can you tell me which driver/files? As I was able to
see some sort of sunxi NAND driver even in v4.4 kernel
(https://lxr.missinglinkelectronics.com/linux+v4.4/drivers/mtd/nand/sunxi_nand.c).

When I tried to compare with the sunxi-3.4 kernel code, I found that
the kernel has code for "nfc" but no reference to "nfd" (I don't know
what they are referring to).
The sunxi 3.4 kernel NAND driver at quick look seems quite different.
(https://github.com/linux-sunxi/linux-sunxi/tree/sunxi-3.4/drivers/block/sunxi_nand)

I will try the v4.8 or above kernel.


> There is also a howto document at
> https://linux-sunxi.org/Mainline_NAND_Howto
>

I somehow missed this earlier :( And the prerequisite says kernel
4.10 above and some extra patch set). Will look into it too. Thanks
for the link

> The olimex board specific dts files seem to be missing the entry for
> the nand controller. If you have trouble figuring out how to enable that
> from the howto above, Olimex should be able to prove a small patch
> for it.
>

Will see. As above link have some details regarding this which might be helpful.

> > > > I am currently using buildroot-2016 and gcc-5.5 for building the
> > > > kernel and every other package needed.
> > > >
> > > > Now the requirement is to move to the latest version of gcc-9.x, so
> > > > that we can have glibc++ provided by the gcc-9.1 toolchain.
> > > >
> > > > Main problem for moving to later versions of buildroot is the kernel
> > > > 3.4 which we couldn't to work with gcc-6 a few years ago _but_ now the
> > > > gcc-9.1 requirement is mandatory so now have to look into compiling
> > > > linux-3.4 with gcc-9.1 or above.
>
> There is no need to compile user space and kernel with the same compiler.
>

So can I still use kernel-3.4 compiled with gcc-5.5, and boot full
user-space with gcc-9.1?
I was expecting it to be possible but might not work due to
incompatibility? As I know that when I tried to compile buildroot-2019
(with latest version of openssl and others) it needs kernel headers
and then I likely can't use 3.4 kernel.

I will still give it a try. Thanks again

> Arnd