All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Ziegler <br015@umbiko.net>
To: Dan Jackson <dan@thejacksons.uk>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] Adding USB support to existing device on 2.6.39.3 kernel - possible?
Date: Tue, 29 Mar 2022 15:13:40 +0000	[thread overview]
Message-ID: <0b1ebd93c431e1c06678303eaffd8a79@umbiko.net> (raw)
In-Reply-To: <AM6PR02MB48848F8B3F5238DF24891A59DA1E9@AM6PR02MB4884.eurprd02.prod.outlook.com>

Hi Dan,

On 2022-03-29 12:48, Dan Jackson wrote:
>> -----Original Message-----
>> From: Andreas Ziegler <br015@umbiko.net>
>> Sent: 29 March 2022 10:40
>> To: Dan Jackson <dan@thejacksons.uk>
>> Cc: Buildroot <buildroot@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@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,
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-03-29 15:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.22068.1648533484.192135.buildroot@buildroot.org>
2022-03-29  9:40 ` [Buildroot] Adding USB support to existing device on 2.6.39.3 kernel - possible? Andreas Ziegler
2022-03-29 12:48   ` Dan Jackson
2022-03-29 15:13     ` Andreas Ziegler [this message]
2022-03-29 16:17       ` Dan Jackson
2022-03-29 17:52         ` Andreas Ziegler
2022-03-29 19:19           ` Dan Jackson
2022-03-30  7:13             ` Andreas Ziegler
2022-03-30 19:18               ` Dan Jackson
2022-03-31  5:57                 ` Andreas Ziegler
2022-03-31  6:19                   ` Dan Jackson
2022-03-31  6:50                     ` Andreas Ziegler
2022-03-29  5:57 Dan Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b1ebd93c431e1c06678303eaffd8a79@umbiko.net \
    --to=br015@umbiko.net \
    --cc=buildroot@buildroot.org \
    --cc=dan@thejacksons.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.