The Kernel source requires a case-sensitive filesystem. If you do not have a HFS+ Case-sensitive partition that can be used, create a disk image with the appropriate format. Ensure latest Xcode and command line tools are installed from Apple Developer Connection Install macports
port install arm-none-eabi-gcc port install arm-none-eabi-binutils
If you get an error message that elf.h is missing
sudo port install libelf && sudo ln -s /opt/local/include/libelf /usr/include/libelf
From opensource.apple.com, download and copy elf.h and elftypes.h to /usr/include
Edit elf.h and add
#define R_386_NONE 0 #define R_386_32 1 #define R_386_PC32 2 #define R_ARM_NONE 0 #define R_ARM_PC24 1 #define R_ARM_ABS32 2 #define R_MIPS_NONE 0 #define R_MIPS_16 1 #define R_MIPS_32 2 #define R_MIPS_REL32 3 #define R_MIPS_26 4 #define R_MIPS_HI16 5 #define R_MIPS_LO16 6
If you get a "SEGMENT_SIZE is undeclared" error open the Makefile and change the line:
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include)
to
NOSTDINC_FLAGS += -nostdinc -isystem $(shell $(CC) -print-file-name=include) -Dlinux
Complete script requires raspberrypi.config to be in the same folder that you execute from
sudo port install arm-none-eabi-gcc sudo port install arm-none-eabi-binutils sudo port install libelf && sudo ln -s /opt/local/include/libelf /usr/include/libelf sudo curl http://opensource.apple.com/source/dtrace/dtrace-48/sys/elftypes.h?txt -o /usr/include/elftypes.h sudo curl http://opensource.apple.com/source/dtrace/dtrace-48/sys/elf.h?txt -o /usr/include/elf.h #code to append to elf.h echo " #define R_386_NONE 0 #define R_386_32 1 #define R_386_PC32 2 #define R_ARM_NONE 0 #define R_ARM_PC24 1 #define R_ARM_ABS32 2 #define R_MIPS_NONE 0 #define R_MIPS_16 1 #define R_MIPS_32 2 #define R_MIPS_REL32 3 #define R_MIPS_26 4 #define R_MIPS_HI16 5 #define R_MIPS_LO16 6" > elf-append.h sudo -s 'cat elf-append.h >> /usr/include/elf.h'
因为mac没有elf.h这个头文件,在编译内核的时候需要。
做完这些后编译
:make ARCH=arm CROSS_COMPILE=arm-none-eabi- menuconfig
会出现下面的错误:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
于是网上找到下面的解决方法
本文目的:
一, 解决在mac 系统里make menuconfig 报错: lcd: symbol(s) not found for architecture x86_64 的bug
二, 使用mconf, 自定义实现一个make menuconfig的界面
一, 在MAC 系统下使用make menuconfig 调用图形界面做config时, 可能会有如下报错:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
一般地, 编译busybox或者uboot或者linux内核等软件包之前, 还是使用图形界面来做配置最为最直观. 实现这一目的自然是执行make menuconfig.
make menuconfig 实际上就是拿 mconf 这个工具去解析config文件里的描述信息, 进而转换为图形界面, 当然, config 文件有自动定义的语法格式, 详细见本文最下放.
第一次执行make menuconfig时, 需要先生成 mconf 这个工具, 在预编译 scripts/kconfig/mconf.c 生成scripts/kconfig/mconf.o 之后的连接阶段,
需要ldconfig参数给出所需要连接的库的位置, 所说的库为后缀为.a 或.so 或 .dylib 的ncursesw ncurses curses库,
生成ldflags的的脚本为: scripts/kconfig/lxdialog/check-lxdialog.sh
上面报错的原因就是, MAC 系统下 ncursesw ncurses curses 这些库文件的位置不能通过 check-lxdialog.sh 里给出命令来找到, 所以生成的 ldflags 不对, 进而无法生成mconf.
该bug的解决办法如下:
以编译 busybox 为例子:
打开 scripts/kconfig/lxdialog/check-lxdialog.sh 文件.
vi scripts/kconfig/lxdialog/check-lxdialog.sh
将红色部分添加进去即可.
ldflags()
{
for extin so a dylib;do
for libi n ncursesw ncurses curses ;do
$cc-print-file-name=lib${lib}.${ext} | grep-q /
if [$?-eq0];then
echo"-l${lib}"
exit
fi
done
for lib in ncursesw ncurses curses ; do
if [ -f /usr/lib/lib${lib}.${ext} ];then
echo "-l${lib}"
exit
fi
done
done
exit1
}
之后回到 busybox的目录下:
make menuconfig :
在进行uboot , 或者linux 的编译时, 如果make menuconfig 也出现该问题:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
同样的解决办法即可生效.
二, 在生成了mconf之后, 我们可以按特定的语法写出config 文件, 进而自定义make menuconfig界面:
以下是我的config 文件, 语法是简单而且通用的, 您可以仿照如下代码自定义出自己的界面:
生成的界面如下:
如果在退出时选择了yse,会将配置保存到.config 里.
之后就可以make了.