Telecnatron Forum

Discuss and comment on telecnatron.com articles and related topics.

Welcome! [Log In] [Register]
Praneet
Re: Cross Compiling For OpenWRT On Linux
December 12, 2018 02:37PM
Hi, Thanks for really helpful and insightful information. I have been trying to cross compile Bluez 5.37 on OpenWRT platform using toolchain-arm_cortex-a7_gcc-5.2.0_uClibc-1.0.14_eabi. I have successfully compiled and executed bluetoothctl, hcitool, hcidump, rfcomm and various other programs using Makefile configurations. However, I am facing issue while compiling the agent program present in client directory(https://github.com/Vudentz/BlueZ/tree/master/client). The agent functionality is useful for auto pairing and connecting without any interruption from OpenWRT system. Can you please help me with the options in bluez makefile (https://github.com/openwrt/packages/blob/8d07e5b8252fb5b9b4c954a4cad169ab10c9e82c/utils/bluez/Makefile) for generating the agent executable. Thanks in advance for the information.
Bill Park
Re: Cross Compiling For OpenWRT On Linux
December 12, 2018 02:38PM
I think I've followed your instructions. I have no problem creating a helloworld for a router and having it run on the router. When I try to run a Makefile, objects get created but the linker returns: error adding symbols: File in wrong format for each object. What should I look at?

Thank you.
polibtesi
Re: Cross Compiling For OpenWRT On Linux
December 12, 2018 02:39PM
Thanks! I found it helpful. Zdenek
Chris
Re: Cross Compiling For OpenWRT On Linux
December 12, 2018 02:39PM
I am wondering why I always get a 'Segmentation Fault' when I run the compiled file on the router?
Andres
Re: Cross Compiling For OpenWRT On Linux
December 12, 2018 02:39PM
Hello, I am having a little problem cross-compiling a library called dns_sd which is part of avahi, can I reach you by email? I could pay you a little bit if you are able winking smiley
Re: Cross Compiling For OpenWRT On Linux
June 17, 2024 07:52PM
Cross-compiling for OpenWRT on Linux allows you to build software that runs on OpenWRT routers using a development environment on your Linux machine. Here’s a straightforward guide to get you started:

Setting Up Your Environment
Install Required Tools:

First, ensure you have a Linux development environment set up. Common distributions like Ubuntu, Debian, or CentOS work well.
Install essential development tools:
sudo apt update
sudo apt install build-essential git
Install the cross-compilation toolchain for OpenWRT. This can vary depending on your router architecture. For example, for MIPS architecture:
sudo apt install gcc-mips-linux-gnu binutils-mips-linux-gnu
Adjust the package names based on your router's architecture (e.g., ARM, MIPS).
Download OpenWRT SDK:

Go to the OpenWRT downloads page and find the SDK for your router’s version and architecture. Download and extract it to your preferred directory:
wget [downloads.openwrt.org]
tar -xvf openwrt-sdk-xx.xx.xx-your_arch_gcc-xx.x.x_xxx.tar.xz
Building Your Application
Prepare Your Application:

Navigate to the SDK directory and clone your application’s source code or create a new project directory.
Place your application code inside the package directory within the SDK or create a Makefile if it’s not already provided.
Configure Your Build:

Enter the SDK directory and configure your build environment:
cd openwrt-sdk-xx.xx.xx-your_arch_gcc-xx.x.x_xxx
./scripts/feeds update -a
./scripts/feeds install your_package_name
Build Your Package:

Configure your package:

make menuconfig
Select your package under Utilities or Network category, depending on its purpose.

Build the package:

make package/your_package_name/compile V=s
Replace your_package_name with the actual name of your package.

Installing Your Package
Deploy to Your Router:
After a successful build, the compiled .ipk package file will be located in bin/packages/your_arch/packages/.
Transfer the .ipk file to your OpenWRT router (via SCP, USB, etc.).
Install the package on the router:
opkg install your_package_name.ipk
Notes
Dependencies: Ensure any dependencies required by your application are also available in the OpenWRT environment or included in your package build.
Testing: Test your application thoroughly on the target OpenWRT device to ensure compatibility and functionality.
By following these steps, you can effectively cross-compile applications for OpenWRT on your Linux machine, leveraging the flexibility and power of a development environment familiar to you.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: