linuxlibusbavrdudelinux-from-scratch

Beyond Linux From Scratch: avrdude was compiled without usb support


Out of interest and learning purposes I have built Linux from scratch (LFS+BLFS, both version 10.0) according to the descriptions on www.linuxfromscratch.org.

In general the OS can boot and I can basically work with it. There are a few things which are not smooth, therefore I would like to address the experts here.

I would like to get going the AVRDragon, a programmer for Atmel microcontrollers. To use it on Linux, I work with the program "avrdude". My goal is to learn how avrdude works and interacts with the OS. Therefore I would like to build it from source with debug information.

For building avrdude from source, libusb/libusb_1_0 and libelf are required. I understand that libusb_1_0 was installed with BLFS. avrdude asks for either libusb and/or libusb_1_0. I cannot say if there is a problem with having only libusb_1_0. (libusb_1_0 is newer than libusb, isn't it?) Additionally I have installed libelf (since libelf is installed, I cannot build the kernel anymore, but this should not be a problem for now). In the kernel, USB support is enabled (Device Drivers -> USB Support -> Support for Host-side USB).

I have created a udev rule:

# Dragon
ATTR{idVendor}=="03eb", ATTR{idProduct}=="2107", GROUP="plugdev", MODE="0666"

...and lsusb says this:

# lsusb
...
Bus 003 Device 006: ID 03eb:2107 Atmel Corp. AVR Dragon
...

Also, I use a script to program a sample application onto the microcontroller, which works on my reference system.

However, running avrdude on my BLFS, I get an error message, that avrdude was not built with USB support:

# avrdude -p m328p -c dragon_isp -B5 -F -P usb -V -U flash:w:Debug/hello_world.elf
avrdude was compiled without usb support.

avrdude done.  Thank you.

Researching the internet, indicated installing the prerequisites stated above and setting up the udev rule.

I have a good understanding of the Linux command line, the GCC tool chain and the usual Linux tools. But I am completely lost with how to correctly configure my BLFS with USB support. Is there somebody who can give me a hint on how to solve this problem? Many thanks!


Solution

  • Apparently, for full functionality you need both libusb-1.0 and libusb-0.1. The configure.ac script defines HAVE_LIBUSB_1_0 only for the former and HAVE_LIBUSB for the latter, while the *.c files containing your error message only check for HAVE_LIBUSB.

    While current BLFS doesn't have instructions to build libusb-0.1, you can see them for libusb-0.1.12 in BLFS 6.3.