首页 文章

使用NetBeans 7.3.1的OpenWRT

提问于
浏览
2

我是一名热心的C / C程序员,他是这个固件定制领域的新成员 . 对于我的最后一年项目,我正在开发一种解决方案来增强路由器的分组交换,并选择OpenWRT作为我的开源固件 . 我一直在努力设置环境,并希望得到你的专家意见,如果我在正确的道路上 .

我按照以下步骤将openWRT发送到我的本地PC . (http://wiki.openwrt.org/doc/howto/buildroot.exigence) .

在make menuconfig中,我选择了, - 高级配置选项 - 自动重建包--ToolChain选项 - 构建gdb - 构建OpenWRT图像生成器 - 构建OpenWRT SDK - 构建基于OpenWRT的ToolChain

并保存配置并运行命令, - make tools / install - make toolchain / install

然后在Netbeans中,我添加了一个工具 - >选项 - > C / C的新工具集

并将基目录作为'/ openwrt / openwrt / toolchain'

和C Complier为'/ usr / bin / gcc'

请问专家,如果我做错了什么,请告诉我?这是否足以开发和编译一个新的C类到openWRT固件,以便我可以重建一个图像闪存到路由器?

尊敬的专家非常感谢您的建议 . 很长一段时间我一直在努力解决这个问题:)

再次感谢 :)

EDIT

问题是,当我设置文件夹

/openwrt/openwrt/staging_dir/toolchain-i386_gcc-4.5-linaro_uClibc-0.9.32/i486-openwrt-linux

在教程http://downloads.openwrt.org/docs/eclipse.pdf中指的是设置为IDE中的交叉编译器,它给出了一个错误,表明在eclipse和Netbeans中都没有找到编译器 .

但是当我指向 /openwrt/openwrt/toolchain 目录时,它可以正常工作 .

我的问题是,是否可以按下开发并使用工具链文件夹中的编译器来编译项目?

EDIT 2

我运行命令时得到的输出

find ./staging_dir -path "./staging_dir/toolchain*" -name *openwrt-linux

TheCodeArtist 建议的openwrt文件夹中

./staging_dir/toolchain-mips_34kc_gcc-4.6-linaro_uClibc-0.9.33.2/mips-openwrt-linux

EDIT 3

Specifying the C compiler

EDIT 4

refined path

1 回答

  • 1

    根据要运行生成的可执行文件的设备 Base Directory ,为目标体系结构(x86,arm,mips等)提供 appropriate toolchain directory .

    接下来为 C compilerC++ compiler 等提供 relative path/filenames of the individual commands . 这些将是相对路径(包括文件名)到上面指定的工具链目录中的相应二进制文件 .


    如何验证工具链设置?

    使用IDE编译一个简单的 hello-world.c 程序 . 就像是

    /* hello-world.c */
    int main()
    {
        return (42);
    }
    

    使用IDE提供 Build 并检查编译输出窗口 . 了解错误(如果有)并相应地修改配置选项 .

    一旦构建成功,它将在项目目录中生成二进制 hello-world . 打开一个新终端并在新生成的二进制文件上运行 file 命令,以验证它是否确实是为目标体系结构构建的 . 例如,为x86-64构建的二进制文件将显示 .

    $ file hello-world
    hello-world: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, not stripped
    

    在您的情况下,如果在IDE设置中正确配置了mips工具链和编译器,我认为它将是 MIPS 可执行文件 .

相关问题