[Buildroot] Adding USB support to existing device on 2.6.39.3 kernel - possible?
Andreas Ziegler
br015 at umbiko.net
Tue Mar 29 15:13:40 UTC 2022
Hi Dan,
On 2022-03-29 12:48, Dan Jackson wrote:
>> -----Original Message-----
>> From: Andreas Ziegler <br015 at umbiko.net>
>> Sent: 29 March 2022 10:40
>> To: Dan Jackson <dan at thejacksons.uk>
>> Cc: Buildroot <buildroot at buildroot.org>
>> Subject: Re: Adding USB support to existing device on 2.6.39.3 kernel
>> -
>> possible?
>>
>> Hi Dan,
>>
>> On 2022-03-29 05:58, Dan Jackson <dan at thejacksons.uk> wrote:
>>
>> > Hello,
>> >
>> > Sorry once again if this is a silly/noob question.
>> >
>> > If I have an existing router device running a 2.6.39.3 kernel, which
>> > has a USB port and is capable of supporting USB devices, but the
>> > manufacturer has removed/not installed the necessary kernel modules,
>> > can I use Buildroot to recreate the missing modules and thus re-enable
>> > the missing USB support?
>>
>> It might work: the driver is contained in the USB module, so building
>> and
>> loading that module could do the trick.
>>
>> > If so, how would I do it?
>>
>> Supposing the Linux kernel source contained in [1] is the one that is
>> running
>> on your device, you need to configure Buildroot to build a Linux
>> kernel
>> (BR2_LINUX_KERNEL). The manual [2] has some information about how to
>> do this for a Kernel source tree (see chapter 8.14.6).
>
> It looks like I got that part to work. The buildroot build process
> definitely seems to be able to see the kernel source tree which is in
> /home/danj/DG3270_9.1.103FB/sourcecode/ti_linux/linux-2.6.39.3/src.
>
>>
>> You then need to enable USB support in the kernel (Device Drivers ->
>> USB
>> support), probably
>>
>> CONFIG_USB=m
>> CONFIG_USB_EHCI_HCD=y
>> CONFIG_USB_OHCI_HCD=y
>>
>> is enough, otherwise try some of the hardware specific (driver)
>> options.
>
> This is where I have fallen down. I did "make linux-menuconfig"
> expecting to be able to configure the kernel/modules (as I couldn't
> see any options for that in buildroot's own "make menuconfig").
>
> However, at this point it seems like it went off and tried to build
> the whole kernel from a default configuration.
'make linux-menuconfig' needs a working build system. If they are not
present, all dependencies of the Linux package get built. First step is
the installation of the kernel source; if Buildroot tries to install a
default kernel, something is amiss with your configuration.
> This eventually failed, so I tried "make linux-reconfigure" at that
> point but that did not work either.
>
> Here is the error it gave upon failure:
>
> /home/danj/buildroot-2022.02/output/host/lib/gcc/armeb-buildroot-linux-uclibcgnueabi/11.2.0/../../../../armeb-buildroot-linux-uclibcgnueabi/bin/ld:
> /home/danj/buildroot-2022.02/output/host/libexec/gcc/armeb-buildroot-linux-uclibcgnueabi/11.2.0/liblto_plugin.so:
> error loading plugin:
> /home/danj/buildroot-2022.02/output/host/libexec/gcc/armeb-buildroot-linux-uclibcgnueabi/11.2.0/liblto_plugin.so:
> undefined symbol: _onload
> collect2: error: ld returned 1 exit status
> Makefile.in:114: recipe for target '../utils/getconf' failed
> make[3]: *** [../utils/getconf] Error 1
> Makefile.in:455: recipe for target 'utils' failed
> make[2]: *** [utils] Error 2
> package/pkg-generic.mk:380: recipe for target
> '/home/danj/buildroot-2022.02/output/build/uclibc-1.0.40/.stamp_target_installed'
> failed
> make[1]: ***
> [/home/danj/buildroot-2022.02/output/build/uclibc-1.0.40/.stamp_target_installed]
> Error 2
> Makefile:84: recipe for target '_all' failed
> make: *** [_all] Error 2
This error is from the uClibc build - do you use an internal or external
toolchain? Maybe you have conflicting static /dynamic library options?
Again, probably a buildroot misconfiguration ...
Maybe you could post your buildroot configuration (the result of make
savedefconfig)?
> Looking at this error message, maybe I need to select an older version
> of gcc, in my buildroot configuration? Is it that the kernel can only
> be compiled by gcc versions that existed at the time?
Older kernels used to have a include/compiler.h which had predefined
includes for specific compiler versions. Use the oldest compiler
available in Buildroot and try to either get a compiler-gcc9.h from a
newer kernel or make your own. I believe this schema changed somewhere
between 3.x and 4.x For newer compilers, this file is comparatively
empty.
>>
>> Copy usbcore.ko from Buildroot target/lib/modules/{kernel-version}/ to
>> the
>> corresponding location on your device and load the driver with
>> modprobe.
>>
>> Depending on which functionality (e.g. USB_STORAGE) you want on your
>> USB port, additional configurations changes may be necessary.
>
> Yes, USB storage functionality is what I would like to add back in.
> Incidentally, this is a newer router than the one I was experimenting
> with before; this one has a Puma 6 CPU. Though, oddly I found it
> necessary to select an armv5 CPU type in buildroot in order to get
> binaries that work, despite /proc/cpuinfo on the device claiming it is
> armv6.
>
>>
>> Kind regards,
>> Andreas
>>
>> > This time I successfully managed to build other binaries (e.g.
>> > dropbear, busybox) which run OK on the device.
>> >
>> > Thanks,
>> > Dan Jackson.
>> > -------------- next part -------------- An HTML attachment was
>> > scrubbed...
>> > URL:
>> > <http://lists.buildroot.org/pipermail/buildroot/attachments/20220329/4
>> > 3c49a2d/attachment.html>
>>
>> [1]
>> https://sourceforge.net/projects/dg3270.arris/files/DG3270_9.1.103FB/
>> [2]
>> https://buildroot.org/downloads/manual/manual.html#_advanced_usage,
More information about the buildroot
mailing list