1) two libfdt related headers had to be removed from usr/local/include (can probably be fixed in the makefile, much cleaner)
2) OSX specific definition has to be added in bch.c
你好,
更新案例,我尝试了芒果的建议,结果发现结果的工具链对于F1C100S是不正确的,因为MT7622是AA64,但F1C100S不是(ARM926EJ-S),但是,我记得秦凤玲为F1C100S做了一个openwrt端口,我尝试了一下。由于系统头文件与OSX不兼容,在进行了一些修复之后:
1)必须从usr/local/include中删除两个与libfdt相关的头文件(可能在makefile中修复,更干净)
2)必须在bch.c中添加OSX特定定义。
#ifdef __APPLE__
#include <libkern/OSByteOrder.h>
#define htobe16(x) OSSwapHostToBigInt16(x)
#define htole16(x) OSSwapHostToLittleInt16(x)
#define be16toh(x) OSSwapBigToHostInt16(x)
#define le16toh(x) OSSwapLittleToHostInt16(x)
#define htobe32(x) OSSwapHostToBigInt32(x)
#define htole32(x) OSSwapHostToLittleInt32(x)
#define be32toh(x) OSSwapBigToHostInt32(x)
#define le32toh(x) OSSwapLittleToHostInt32(x)
#define htobe64(x) OSSwapHostToBigInt64(x)
#define htole64(x) OSSwapHostToLittleInt64(x)
#define be64toh(x) OSSwapBigToHostInt64(x)
#define le64toh(x) OSSwapLittleToHostInt64(x)
#endif /* __APPLE__ */
The built was successful and now it compiles OpenWRT in about 4 minutes.
构建成功,现在它在大约4分钟内编译了openwrt。
hoel@iMac-de-Hoel-7 /Volumes/arm-linux-toolchain/openwrt (licheepi-nano *=) $ make -j9
time: target/linux/prereq#0.10#0.07#0.28
make[1] world
make[2] package/cleanup
make[2] target/compile
make[3] -C target/linux compile
make[2] diffconfig
make[2] package/compile
make[3] -C package/libs/libubox host-compile
make[3] -C package/system/fwtool host-compile
make[3] -C package/system/usign host-compile
make[3] -C package/utils/e2fsprogs host-compile
make[3] -C package/libs/ncurses host-compile
make[3] -C package/libs/toolchain compile
make[3] -C package/system/opkg host-compile
make[3] -C package/system/fwtool compile
make[3] -C package/libs/libnl-tiny compile
make[3] -C package/firmware/linux-firmware compile
make[3] -C package/libs/zlib compile
make[3] -C package/libs/libjson-c compile
make[3] -C package/firmware/prism54-firmware compile
make[3] -C package/utils/lua compile
make[3] -C package/system/openwrt-keyring compile
make[3] -C package/boot/uboot-sunxi compile
make[3] -C package/firmware/wireless-regdb compile
make[3] -C package/firmware/b43legacy-firmware compile
make[3] -C package/libs/mbedtls compile
make[3] -C package/network/services/dropbear compile
make[3] -C package/libs/libpcap compile
make[3] -C package/network/utils/linux-atm compile
make[3] -C package/network/utils/resolveip compile
make[3] -C package/utils/busybox compile
make[3] -C package/libs/libubox compile
make[3] -C package/libs/ncurses compile
make[3] -C package/network/utils/iw compile
make[3] -C package/system/usign compile
make[3] -C package/system/uci compile
make[3] -C package/system/ubus compile
make[3] -C package/utils/jsonfilter compile
make[3] -C package/libs/ustream-ssl compile
make[3] -C package/network/ipv6/odhcp6c compile
make[3] -C package/system/mtd compile
make[3] -C package/libs/uclient compile
make[3] -C package/network/config/swconfig compile
make[3] -C package/system/ubox compile
make[3] -C package/network/config/netifd compile
make[3] -C package/network/services/hostapd compile
make[3] -C package/network/services/dnsmasq compile
make[3] -C package/network/services/odhcpd compile
make[3] -C package/network/utils/iwinfo compile
make[3] -C package/system/opkg compile
make[3] -C package/system/procd compile
make[3] -C package/kernel/linux compile
make[3] -C package/kernel/mac80211 compile
make[3] -C package/network/utils/iptables compile
make[3] -C package/network/services/ppp compile
make[3] -C package/utils/util-linux compile
make[3] -C package/utils/f2fs-tools compile
make[3] -C package/utils/e2fsprogs compile
make[3] -C package/system/fstools compile
make[3] -C package/boot/uboot-envtools compile
make[3] -C package/base-files compile
make[3] -C package/network/config/firewall compile
make[2] package/install
make[2] target/install
make[3] -C target/linux install
make[2] package/index
make[2] checksum
hoel@iMac-de-Hoel-7 /Volumes/arm-linux-toolchain/openwrt (licheepi-nano *=) $
Of course i also end-up with a working toolchain for F1C100S on OSX !
So I made a template for Eclipse to test it, and as expected it works perfectly.
当然,我最后也得到了一个在OSX上用于F1C100的工作工具链!
所以我为Eclipse制作了一个模板来测试它,正如预期的那样,它工作得很好。
04:25:22 **** Incremental Build of configuration Debug for project F1C100S_TEMPLATE ****
make all
Building target: F1C100S_TEMPLATE
Invoking: Cross GCC Linker
arm-openwrt-linux-muslgnueabi-gcc -o "F1C100S_TEMPLATE" ./src/termios_cdc_acm/epoll2.o ./src/libs/gpio.o ./src/libs/gpiolib.o ./src/libs/spi.o ./src/libs/sqlite3.o ./src/gsm_serial.o
Finished building target: F1C100S_TEMPLATE
04:25:23 Build Finished (took 509ms)
Big thanks to @Quotation, @Mango and @晕哥 for the help with this, it very nice to have a working toolchain on OSX for this target.
非常感谢@Quotation, @Mango and @晕哥 的帮助,在OSX上为这个目标提供了一个工作的工具链。
Now there is still two issues to address : the first is that this OpenWRT has been modified to build an SD card image rather than a flash image and it is a problem with the Lichee Pi Nano because the only way to have netwrok connectivity (and so to debug conveniently from Eclipse / QT editor) is by using the Micro SD card wifi adapter, which of course cannot be plugged if we use SD card, i have opened a new subject for this matter : https://whycan.cn/t_2573.html#p20277
The other problem is that i did not manage to build the Lichee Pi Nano "official" linux (nano-4.14-exp) with this new toolchain. I tried to add the new toolchain to my PATH and .bash_profile, but when i add it to the bash profile :
现在仍然有两个问题需要解决:第一个问题是这个openwrt被修改为构建一个SD卡图像而不是一个flash图像,这是Lichee Pi Nano的一个问题,因为只有使用micro SD卡WiFi适配器才能实现网络连接(并从Eclipse/Qt编辑器方便地进行调试),而Micro SD卡WiFi适配器是如果我们使用SD卡,URSE就无法接通电源,我已经为此打开了一个新主题:https://whycan.cn/t_2573.html#p20277
另一个问题是,我没有用这个新的工具链构建Lichee Pi nano“官方”Linux(nano-4.14-exp)。我试图将新的工具链添加到我的路径和.bash_概要文件中,但当我将其添加到bash概要文件中时:
PATH="/Volumes/arm-linux-toolchain/openwrt/staging_dir/toolchain-arm_arm926ej-s_gcc-7.3.0_musl_eabi/bin"
the build fails directly, it doesnt even find make, so either i am doing something wrong with PATH or .bash_profile or something must be changed in the Linux makefile so that it uses this toolchain.
构建直接失败,甚至找不到make,所以要么我在路径或.bash_profile上做了一些错误的事情,要么必须在Linux makefile中更改一些内容,以便它使用这个工具链。
hoel@iMac-de-Hoel-7 /Volumes/arm-linux-toolchain/linux $ make menuconfig
-bash: make: command not found
hoel@iMac-de-Hoel-7 /Volumes/arm-linux-toolchain/linux $ make ARCH=arm menuconfig
-bash: make: command not found
When i remove this PATH from .bash_profile, then make menuconfig fail
当我从.bash_profile中删除此路径时,将使menuconfig失败
hoel@iMac-de-Hoel-7 /Volumes/arm-linux-toolchain/linux (nano-4.14-exp *=) $ make ARCH=arm menuconfig
getconf: no such configuration parameter `LFS_CFLAGS'
getconf: no such configuration parameter `LFS_LDFLAGS'
getconf: no such configuration parameter `LFS_LIBS'
HOSTLD scripts/kconfig/mconf
Undefined symbols for architecture x86_64:
"_acs_map", referenced from:
_dialog_checklist in checklist.o
_print_arrows in checklist.o
_dialog_clear in util.o
_draw_box in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
...
"_cbreak", referenced from:
_init_dialog in util.o
"_delwin", referenced from:
_dialog_checklist in checklist.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
"_doupdate", referenced from:
_dialog_checklist in checklist.o
"_endwin", referenced from:
_init_dialog in util.o
_end_dialog in util.o
"_flash", referenced from:
_dialog_inputbox in inputbox.o
"_getcurx", referenced from:
_init_dialog in util.o
_print_autowrap in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_print_arrows in menubox.o
"_getcury", referenced from:
_init_dialog in util.o
_print_autowrap in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_print_arrows in menubox.o
"_getmaxx", referenced from:
_conf in mconf.o
_dialog_checklist in checklist.o
_dialog_clear in util.o
_init_dialog in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
...
"_getmaxy", referenced from:
_dialog_checklist in checklist.o
_attr_clear in util.o
_dialog_clear in util.o
_init_dialog in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
...
"_has_colors", referenced from:
_init_dialog in util.o
_draw_shadow in util.o
"_init_pair", referenced from:
_init_dialog in util.o
"_initscr", referenced from:
_init_dialog in util.o
"_keypad", referenced from:
_dialog_checklist in checklist.o
_init_dialog in util.o
_on_key_esc in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
...
"_newwin", referenced from:
_dialog_checklist in checklist.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
"_nodelay", referenced from:
_on_key_esc in util.o
"_noecho", referenced from:
_init_dialog in util.o
"_scrollok", referenced from:
_dialog_checklist in checklist.o
_dialog_menu in menubox.o
"_start_color", referenced from:
_init_dialog in util.o
"_stdscr", referenced from:
_conf in mconf.o
_dialog_checklist in checklist.o
_dialog_clear in util.o
_init_dialog in util.o
_end_dialog in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
...
"_subwin", referenced from:
_dialog_checklist in checklist.o
_dialog_textbox in textbox.o
_dialog_menu in menubox.o
"_ungetch", referenced from:
_on_key_esc in util.o
"_waddch", referenced from:
_dialog_checklist in checklist.o
_print_item in checklist.o
_print_arrows in checklist.o
_attr_clear in util.o
_dialog_clear in util.o
_print_title in util.o
_print_button in util.o
...
"_waddnstr", referenced from:
_print_item in checklist.o
_print_arrows in checklist.o
_dialog_clear in util.o
_print_title in util.o
_print_autowrap in util.o
_print_button in util.o
_dialog_inputbox in inputbox.o
...
"_wattrset", referenced from:
_dialog_checklist in checklist.o
_print_item in checklist.o
_print_arrows in checklist.o
_attr_clear in util.o
_dialog_clear in util.o
_print_title in util.o
_print_button in util.o
...
"_wbkgdset", referenced from:
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
_dialog_menu in menubox.o
"_wclrtoeol", referenced from:
_refresh_text_box in textbox.o
_do_print_item in menubox.o
"_wgetch", referenced from:
_dialog_checklist in checklist.o
_on_key_esc in util.o
_dialog_inputbox in inputbox.o
_dialog_textbox in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
"_winch", referenced from:
_draw_shadow in util.o
"_wmove", referenced from:
_dialog_checklist in checklist.o
_print_item in checklist.o
_print_arrows in checklist.o
_attr_clear in util.o
_dialog_clear in util.o
_end_dialog in util.o
_print_title in util.o
...
"_wnoutrefresh", referenced from:
_dialog_checklist in checklist.o
_dialog_clear in util.o
_draw_shadow in util.o
_dialog_textbox in textbox.o
_refresh_text_box in textbox.o
_dialog_menu in menubox.o
"_wprintw", referenced from:
_print_item in checklist.o
_refresh_text_box in textbox.o
"_wrefresh", referenced from:
_dialog_checklist in checklist.o
_print_item in checklist.o
_end_dialog in util.o
_dialog_inputbox in inputbox.o
_refresh_text_box in textbox.o
_dialog_yesno in yesno.o
_dialog_menu in menubox.o
...
"_wscrl", referenced from:
_dialog_checklist in checklist.o
_dialog_menu in menubox.o
"_wtouchln", referenced from:
_attr_clear in util.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [scripts/kconfig/mconf] Error 1
make: *** [menuconfig] Error 2
The issue seems to point out to ncurse, but i know ncurse is not the actual culprit because make menuconfig works fine with OpenWRT, so I guess the problem is : linux doesnt look / use the correct toolchain, maybe a makefile problem or something like that?
If i use make nconfig or make ARCH=arm nconfig, i got the menuconfig interface but the build fail afterwards anyway:
这个问题似乎指向了ncurse,但我知道ncurse并不是真正的罪魁祸首,因为make menuconfig在openwrt中工作得很好,所以我猜问题是:linux看起来/使用的工具链不正确,可能是makefile问题或类似的问题?
如果我使用make nconfig或make arch=arm nconfig,我得到了menuconfig接口,但是构建之后还是失败了:
hoel@iMac-de-Hoel-7 /Volumes/arm-linux-toolchain/linux (nano-4.14-exp *=) $ make ARCH=arm CROSS_COMPILE=arm-openwrt-linux-muslgnueabi- -j9
getconf: no such configuration parameter `LFS_CFLAGS'
getconf: no such configuration parameter `LFS_LDFLAGS'
getconf: no such configuration parameter `LFS_LIBS'
getconf: no such configuration parameter `LFS_CFLAGS'
getconf: no such configuration parameter `LFS_LDFLAGS'
getconf: no such configuration parameter `LFS_LIBS'
scripts/kconfig/conf --silentoldconfig Kconfig
getconf: no such configuration parameter `LFS_CFLAGS'
getconf: no such configuration parameter `LFS_LDFLAGS'
getconf: no such configuration parameter `LFS_LIBS'
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
UPD include/generated/uapi/linux/version.h
WRAP arch/arm/include/generated/uapi/asm/errno.h
WRAP arch/arm/include/generated/uapi/asm/bitsperlong.h
WRAP arch/arm/include/generated/uapi/asm/ioctl.h
WRAP arch/arm/include/generated/uapi/asm/msgbuf.h
WRAP arch/arm/include/generated/uapi/asm/ipcbuf.h
WRAP arch/arm/include/generated/uapi/asm/param.h
WRAP arch/arm/include/generated/uapi/asm/poll.h
WRAP arch/arm/include/generated/uapi/asm/resource.h
WRAP arch/arm/include/generated/uapi/asm/sembuf.h
WRAP arch/arm/include/generated/uapi/asm/shmbuf.h
WRAP arch/arm/include/generated/uapi/asm/siginfo.h
WRAP arch/arm/include/generated/uapi/asm/socket.h
WRAP arch/arm/include/generated/uapi/asm/sockios.h
WRAP arch/arm/include/generated/uapi/asm/termbits.h
WRAP arch/arm/include/generated/uapi/asm/termios.h
WRAP arch/arm/include/generated/asm/clkdev.h
WRAP arch/arm/include/generated/asm/current.h
WRAP arch/arm/include/generated/asm/early_ioremap.h
WRAP arch/arm/include/generated/asm/emergency-restart.h
WRAP arch/arm/include/generated/asm/exec.h
WRAP arch/arm/include/generated/asm/extable.h
WRAP arch/arm/include/generated/asm/irq_regs.h
WRAP arch/arm/include/generated/asm/kdebug.h
WRAP arch/arm/include/generated/asm/local.h
WRAP arch/arm/include/generated/asm/local64.h
WRAP arch/arm/include/generated/asm/mm-arch-hooks.h
WRAP arch/arm/include/generated/asm/msi.h
WRAP arch/arm/include/generated/asm/parport.h
WRAP arch/arm/include/generated/asm/preempt.h
WRAP arch/arm/include/generated/asm/rwsem.h
WRAP arch/arm/include/generated/asm/seccomp.h
WRAP arch/arm/include/generated/asm/segment.h
WRAP arch/arm/include/generated/asm/serial.h
WRAP arch/arm/include/generated/asm/simd.h
WRAP arch/arm/include/generated/asm/sizes.h
WRAP arch/arm/include/generated/asm/timex.h
WRAP arch/arm/include/generated/asm/trace_clock.h
HOSTCC scripts/kallsyms
HOSTCC scripts/conmakehash
HOSTCC scripts/sortextable
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
CC scripts/mod/devicetable-offsets.s
HOSTCC scripts/dtc/dtc.o
HOSTCC scripts/dtc/flattree.o
scripts/sortextable.c:23:10: fatal error: 'elf.h' file not found
#include <elf.h>
^
scripts/mod/mk_elfconfig.c:5:10: fatal error: 'elf.h' file not found
#include <elf.h>
^
1 error generated.
make[2]: *** [scripts/mod/mk_elfconfig] Error 1
make[2]: *** Waiting for unfinished jobs....
HOSTCC scripts/dtc/fstree.o
1 error generated.
make[1]: *** [scripts/sortextable] Error 1
make[1]: *** Waiting for unfinished jobs....
HOSTCC scripts/dtc/data.o
HOSTCC scripts/dtc/livetree.o
HOSTCC scripts/dtc/treesource.o
HOSTCC scripts/dtc/srcpos.o
HOSTCC scripts/dtc/checks.o
HOSTCC scripts/dtc/util.o
SHIPPED scripts/dtc/dtc-lexer.lex.c
SHIPPED scripts/dtc/dtc-parser.tab.h
SHIPPED scripts/dtc/dtc-parser.tab.c
HOSTCC scripts/dtc/dtc-lexer.lex.o
HOSTCC scripts/dtc/dtc-parser.tab.o
HOSTLD scripts/dtc/dtc
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
UPD include/config/kernel.release
If anyone has some ideas about what i should do to adjust OpenWRT image generation for 16M flash or to build the official Lichee Pi Nano with the new toolchain, please let me know. Once everything is working fine i will make a new subject that give all the steps to :
-get working toolchain for F1C100S on OSX
-get working OpenWRT for F1C100S on OSX (with flash image)
-get working Lichee Pi Nano linux on OSX
-setup Eclipse or another IDE to build and debug applications on F1C100S for linux directly from OSX (debug via wifi)
Thank you.
如果有人对我应该做些什么来调整16M闪存的openwrt图像生成或者用新的工具链构建官方的lichee pi nano有什么想法,请告诉我。一旦一切正常,我将提出一个新的主题,给出所有步骤:
-在OSX上获取F1C100S的工作工具链
-在OSX上获取F1C100S的工作openwrt(带Flash图像)
-在OSX上运行Lichee Pi Nano Linux
-设置Eclipse或其他IDE,以便直接从OSX(通过WiFi进行调试)在F1C100S上为Linux构建和调试应用程序。
谢谢您。
我目前正在将GT911触摸屏移植到Xboot(Lichee Pi Nano),如果有人已经这样做了,请告诉我,因为我认为需要一些时间来纠正它。同时,我还在寻找一种在OSX上安装arm-none-linux-eabi工具链的方法,因为这个arm none eabi工具链只能在没有linux的情况下使用
]]>hoel@iMac-de-Hoel-7 /Volumes/EABI $ cd /Volumes/EABI/minimal_f1c100s/tools/mksunxi/
hoel@iMac-de-Hoel-7 /Volumes/EABI/minimal_f1c100s/tools/mksunxi $ make
gcc -Wall -Wextra -O2 mksunxi.c -o mksunxi
hoel@iMac-de-Hoel-7 /Volumes/EABI/minimal_f1c100s/tools/mksunxi $ cd ..
hoel@iMac-de-Hoel-7 /Volumes/EABI/minimal_f1c100s/tools $ cd ..
hoel@iMac-de-Hoel-7 /Volumes/EABI/minimal_f1c100s $ make
mkdir -p build
mkdir -p build/arch/arm32/lib
mkdir -p build/driver
mkdir -p build/lib
mkdir -p build/machine
CC main.c
(...)
arm-none-eabi-size build/firmware.elf
text data bss dec hex filename
30276 88 524424 554788 87724 build/firmware.elf
arm-none-eabi-objcopy -v -O binary build/firmware.elf build/firmware.bin
copy from `build/firmware.elf' [elf32-littlearm] to `build/firmware.bin' [binary]
Make header information for brom booting
bootloader size= 1800
The bootloader head has been fixed
hoel@iMac-de-Hoel-7 /Volumes/EABI/minimal_f1c100s $
@超级萌新 是的,100%同意,非常有用,从Quotation年起提出了全面的建议。
]]>1. Download the official gcc-arm-none-eabi from https://launchpad.net/gcc-arm-embedded/+download. I'm using an older version gcc-arm-none-eabi-5_2-2015q4. Extract and add `gcc-arm-none-eabi/bin` to PATH.
2. Extract minimal_f1c100s_framebuffer.zip. Edit `Makefile`, change `CROSS_COMPILE` to `arm-none-eabi-`.
3. `cd tools/mksunxi`, delete the Linux version `mksunxi` and make the OSX version.
3. Run `make` in `minimal_f1c100s`. The build succeeds if you see output "The bootloader head has been fixed".
4. `git clone https://github.com/Icenowy/sunxi-tools.git -b spi-rebase`, then build the OSX version of sunxi-tools.
5. Run `sunxi-fel -p spiflash-write 0 build/firmware.bin` to download the firmware to F1C100s.