Is Teensy Loader CLI support on MT7621 possible? [SOLVED]

I am not sure if I'm doing something wrong here or not..
I've been stuck on this for about 2 days now with no real progress.

I am trying to get the Teensy_Loader_CLI ( to compile on the MT7621 CPU (specifically the UniElec U7621-06).
I couldn't get libusb from the stock opkg repositories to work, so I tried using the SDK to cross compile without any difference from trying to compile on the actual router.

I will post the output below:

Unedited teensy_loader_cli.c:

# CC=gcc make
gcc -O2 -Wall  -s -DUSE_LIBUSB -o teensy_loader_cli teensy_loader_cli.c -lusb
teensy_loader_cli.c:230:17: fatal error: usb.h: No such file or directory
compilation terminated.
make: *** [Makefile:15: teensy_loader_cli] Error 1

Edited teensy_loader_cli.c (changed '#include <usb.h>' to '#include "usb.h"' with manually transferred usb.h file from another system):

# CC=gcc make
gcc -O2 -Wall  -s -DUSE_LIBUSB -o teensy_loader_cli teensy_loader_cli.c -lusb
/usr/bin/ld: cannot find -lusb
collect2: error: ld returned 1 exit status
make: *** [Makefile:15: teensy_loader_cli] Error 1

UPDATE (same source file as previous output, but using something I found from another forum post):

# gcc -O2 -Wall  -s -DUSE_LIBUSB -o teensy_loader_cli teensy_loader_cli.c -lusb-1.0
/tmp/ccdjKohf.o: In function `teensy_write':
teensy_loader_cli.c:(.text+0x22c): undefined reference to `usb_control_msg'
teensy_loader_cli.c:(.text+0x248): undefined reference to `usb_control_msg'
/tmp/ccdjKohf.o: In function `teensy_close':
teensy_loader_cli.c:(.text+0x2c0): undefined reference to `usb_release_interface'
teensy_loader_cli.c:(.text+0x2c8): undefined reference to `usb_release_interface'
teensy_loader_cli.c:(.text+0x2d8): undefined reference to `usb_close'
teensy_loader_cli.c:(.text+0x2e0): undefined reference to `usb_close'
/tmp/ccdjKohf.o: In function `open_usb_device':
teensy_loader_cli.c:(.text+0x9a0): undefined reference to `usb_init'
teensy_loader_cli.c:(.text+0x9d4): undefined reference to `usb_init'
teensy_loader_cli.c:(.text+0x9e4): undefined reference to `usb_find_busses'
teensy_loader_cli.c:(.text+0x9ec): undefined reference to `usb_find_busses'
teensy_loader_cli.c:(.text+0x9fc): undefined reference to `usb_find_devices'
teensy_loader_cli.c:(.text+0xa04): undefined reference to `usb_find_devices'
teensy_loader_cli.c:(.text+0xa14): undefined reference to `usb_get_busses'
teensy_loader_cli.c:(.text+0xa1c): undefined reference to `usb_get_busses'
teensy_loader_cli.c:(.text+0xa8c): undefined reference to `usb_open'
teensy_loader_cli.c:(.text+0xa94): undefined reference to `usb_open'
teensy_loader_cli.c:(.text+0xab4): undefined reference to `usb_get_driver_np'
teensy_loader_cli.c:(.text+0xac0): undefined reference to `usb_get_driver_np'
teensy_loader_cli.c:(.text+0xad0): undefined reference to `usb_detach_kernel_driver_np'
teensy_loader_cli.c:(.text+0xadc): undefined reference to `usb_detach_kernel_driver_np'
teensy_loader_cli.c:(.text+0xaf0): undefined reference to `usb_claim_interface'
teensy_loader_cli.c:(.text+0xaf8): undefined reference to `usb_claim_interface'
teensy_loader_cli.c:(.text+0xb68): undefined reference to `usb_close'
teensy_loader_cli.c:(.text+0xb70): undefined reference to `usb_close'
teensy_loader_cli.c:(.text+0xb8c): undefined reference to `usb_close'
teensy_loader_cli.c:(.text+0xb94): undefined reference to `usb_close'
/tmp/ccdjKohf.o: In function `hard_reboot':
teensy_loader_cli.c:(.text+0xc34): undefined reference to `usb_control_msg'
teensy_loader_cli.c:(.text+0xc4c): undefined reference to `usb_control_msg'
teensy_loader_cli.c:(.text+0xc5c): undefined reference to `usb_release_interface'
teensy_loader_cli.c:(.text+0xc64): undefined reference to `usb_release_interface'
teensy_loader_cli.c:(.text+0xc74): undefined reference to `usb_close'
teensy_loader_cli.c:(.text+0xc7c): undefined reference to `usb_close'
/tmp/ccdjKohf.o: In function `soft_reboot':
teensy_loader_cli.c:(.text+0xd04): undefined reference to `usb_control_msg'
teensy_loader_cli.c:(.text+0xd20): undefined reference to `usb_control_msg'
teensy_loader_cli.c:(.text+0xd30): undefined reference to `usb_release_interface'
teensy_loader_cli.c:(.text+0xd38): undefined reference to `usb_release_interface'
teensy_loader_cli.c:(.text+0xd48): undefined reference to `usb_close'
teensy_loader_cli.c:(.text+0xd50): undefined reference to `usb_close'
teensy_loader_cli.c:(.text+0xd78): undefined reference to `usb_strerror'
teensy_loader_cli.c:(.text+0xd80): undefined reference to `usb_strerror'
teensy_loader_cli.c:(.text+0xdb8): undefined reference to `usb_strerror'
teensy_loader_cli.c:(.text+0xdc0): undefined reference to `usb_strerror'
collect2: error: ld returned 1 exit status

I have libusb-1.0 and libusb-compat installed on the router, so this shouldn't be happening as far as I understand..
Is this something that I am doing, or is this possibly a bug with the libraries (or something alike)?

Kind regards.

You should use the toolchain instead, it'll make your life much easier...

Install the full source tree

Install packages

Create a new dir mkdir feeds/packages/utils/teensy_loader_cli

Save this as Makefile in that dir

# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.

include $(TOPDIR)/



include $(INCLUDE_DIR)/

define Package/teensy_loader_cli
  TITLE:=Teensy Loader - Command Line Version

define Package/teensy_loader_cli/description

define Package/teensy_loader_cli/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/teensy_loader_cli $(1)/usr/bin/
	$(INSTALL_DIR) $(1)/usr/somewhere
	$(CP) $(PKG_BUILD_DIR)/hexfiles.hex $(1)/usr/somewhere/

$(eval $(call BuildPackage,teensy_loader_cli))
./scripts/feeds update -i
./scripts/feeds install -a

Select package via Menuconfig (utils)

make package/teensy_loader_cli/compile V=s

Remove the last two lines in the install section if you don't need the hex files otherwise you needs to adjust to proper paths and filenames.
The rest should be covered in

It compiles, not run-tested at all.

After following your instructions and having to change the feed commands among other things I was able to get this working.

I had to change ./feeds/update -i and ./feeds/update -a to:
./scripts/feeds update -i && ./scripts/feeds update -a && echo "Success"

Unfortunately I struggled trying to get the custom package to show up in the make menuconfig utilities section on the first run.
Perhaps I the second time I re-ran through the steps it worked?

Since I can't say for certain I can't put the exact steps I went through to get this working on my toolchain workspace for others to repeat..

You're correct, it should say ./scripts/feeds update -i and ./scripts/feeds install -a sorry for the typo.
It'll show up after you've added the package (directory and Makefile) and updated the package index/repo (the commands mentioned above).

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.