环境介绍
Linux MartinUbuntu 6.5.0-26-generic #26~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 12 10:22:43 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
因为尝鲜所以用的是ubuntu22.04的版本
因为ubuntu太新了遇到了一些奇怪的报错的问题
下载代码
1. mkdir BSP
2. git clone https://e.coding.net/codebug8/repo.git
3. repo/repo init -u https://gitee.com/weidongshan/manifests.git -b linux-sdk -m imx6ull/100ask_imx6ull_linux4.9.88_release.xml --no-repo-verify
4. repo/repo sync -j4
1.bootloader 编译
指令
cd Uboot-2018.03
1. make distclean
2. make mx6ull_14x14_evk_defconfig
3. make
报错
cmd : make
error
HOSTLD scripts/dtc/dtc
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:108: scripts/dtc/dtc] Error 1
make[1]: *** [scripts/Makefile.build:425: scripts/dtc] Error 2
make: *** [Makefile:491: scripts] Error 2
fix
vim scripts/dtc/dtc-lexer.lex.c
在YYLTYPE yylloc; 前面增加extern
633
634 extern YYLTYPE yylloc;
635 extern bool treesource_error;
2.内核 编译
指令
cd Linux-4.9.88
1. make mrproper
2. make 100ask_imx6ull_defconfig
3. make zImage -j8
4. make dtbs
5. make ARCH=arm INSTALL_MOD_PATH=/home/martin/martinworkspace/nfs_rootfs modules_install
cp arch/arm/boot/zImage /home/martin/martinworkspace/nfs_rootfs/
cp arch/arm/boot/dts/100ask_imx6ull-14x14.dtb /home/martin/martinworkspace/nfs_rootfs/
报错
cmd : make zImage -j8
error
HOSTLD scripts/dtc/dtc
/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:116: scripts/dtc/dtc] Error 1
make[1]: *** [scripts/Makefile.build:544: scripts/dtc] Error 2
make[1]: *** Waiting for unfinished jobs....
HOSTLD scripts/genksyms/genksyms
HOSTLD scripts/mod/modpost
fix
vim scripts/dtc/dtc-lexer.lex.c
在YYLTYPE yylloc; 前面增加extern
633
634 extern YYLTYPE yylloc;
635 extern bool treesource_error;
3. Buildroot
指令
1. make clean
2. make 100ask_imx6ull_pro_ddr512m_systemV_qt5_defconfig
3. make all -j8
cmd :make all -j8
error
In file included from /usr/include/signal.h:328,
from ./signal.h:52,
from c-stack.c:49:
c-stack.c:55:26: error: missing binary operator before token "("
55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
| ^~~~~~~~
CC close-stream.o
CC closein.o
CC closeout.o
make[5]: *** [Makefile:1915: c-stack.o] Error 1
make[5]: *** Waiting for unfinished jobs....
make[4]: *** [Makefile:1674: all] Error 2
make[3]: *** [Makefile:1572: all-recursive] Error 1
make[2]: *** [Makefile:1528: all] Error 2
make[1]: *** [package/pkg-generic.mk:269: /home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/build/host-m4-1.4.18/.stamp_built] Error 2
make: *** [Makefile:84: _all] Error 2
fix vim output/build/host-m4-1.4.18/lib/c-stack.c
#ifndef SIGSTKSZ
## define SIGSTKSZ 16384
##elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
/* libsigsegv 2.6 through 2.8 have a bug where some architectures use
more than the Linux default of an 8k alternate stack when deciding
if a fault was caused by stack overflow. */
## undef SIGSTKSZ
# define SIGSTKSZ 16384
#endif
error:
libfakeroot.c:99:40: error: ‘_STAT_VER’ undeclared (first use in this function)
99 | #define INT_NEXT_STAT(a,b) NEXT_STAT64(_STAT_VER,a,b)
| ^~~~~~~~~
fakerootconfig.h:9:43: note: in definition of macro ‘NEXT_STAT64’
9 | #define NEXT_STAT64(a,b,c) next___xstat64(a,b,c)
| ^
libfakeroot.c:810:5: note: in expansion of macro ‘INT_NEXT_STAT’
810 | r=INT_NEXT_STAT(path, &st);
| ^~~~~~~~~~~~~
libfakeroot.c:99:40: note: each undeclared identifier is reported only once for each function it appears in
fix
vim output/build/host-fakeroot-1.20.2/libfakeroot.c
#ifndef _STAT_VER
#if defined (__aarch64__)
#define _STAT_VER 0
#elif defined (__x86_64__)
#define _STAT_VER 1
#else
#define _STAT_VER 3
#endif
#endif
error:
一系列的not a member of ‘std’
error: ‘numeric_limits’ is not a member of ‘std’
: error: ‘::max’ has not been declared; did you mean ‘std::max’?
fix:
找到对应的文件增加
#include <limits>
error:
nrun.o libsim.a ../../bfd/libbfd.a ../../opcodes/libopcodes.a ../../libiberty/libiberty.a -lnsl -L../../zlib -lz -lm
/usr/bin/ld: libsim.a(maverick.o):(.bss+0x60): multiple definition of `DSPregs'; libsim.a(wrapper.o):(.bss+0x60): first defined here
/usr/bin/ld: libsim.a(maverick.o):(.bss+0x0): multiple definition of `DSPsc'; libsim.a(wrapper.o):(.bss+0x0): first defined here
/usr/bin/ld: libsim.a(maverick.o):(.bss+0x20): multiple definition of `DSPacc'; libsim.a(wrapper.o):(.bss+0x20): first defined here
/usr/bin/ld: libsim.a(armemu32.o):(.bss+0x0): multiple definition of `isize'; libsim.a(armemu26.o):(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
fix: 参照这个修改改一下
[ARM, sim] Fix build error and warnings (I21db699d) · Gerrit Code Review (osci.io)
error :
--2024-03-30 10:44:59-- https://github.com/nghttp2/nghttp2/releases/download/v1.41.0/nghttp2-1.41.0.tar.gz
Resolving github.com (github.com)... 20.205.243.166
Connecting to github.com (github.com)|20.205.243.166|:443... connected.
HTTP request sent, awaiting response... No data received.
Retrying.--2024-03-30 10:45:11-- (try: 2) https://github.com/nghttp2/nghttp2/releases/download/v1.41.0/nghttp2-1.41.0.tar.gz
Connecting to github.com (github.com)|20.205.243.166|:443... connected.
HTTP request sent, awaiting response... No data received.
Retrying.--2024-03-30 10:46:26-- (try: 3) https://github.com/nghttp2/nghttp2/releases/download/v1.41.0/nghttp2-1.41.0.tar.gz
Connecting to github.com (github.com)|20.205.243.166|:443...
被墙了没辙。科学上网一下
error:
Makefile.config:360: No sys/sdt.h found, no SDT events are defined, please install systemtap-sdt-devel or systemtap-sdt-dev
Makefile.config:433: Disabling post unwind, no support found.
Makefile.config:505: slang not found, disables TUI support. Please install slang-devel, libslang-dev or libslang2-dev
Makefile.config:569: Python support disabled by user
SUBDIR Documentation
/home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/build/linux-origin_master/tools/perf/pmu-events/.jevents.o.cmd:1: *** missing separator. Stop.
make[3]: *** [Makefile.perf:461: /home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/build/linux-origin_master/tools/perf/pmu-events/jevents-in.o] Error 2
make[3]: *** Waiting for unfinished jobs....
fix:
vim config/100ask_imx6ull_pro_ddr512m_systemV_qt5_defconfig
麻蛋搞半天搞不定不编了
编译第二步会做make 100ask_imx6ull_pro_ddr512m_systemV_qt5_defconfig
找到PERF字样的 不要去编了都注释掉
like BR2_PACKAGE_LINUX_TOOLS_PERF=y‘’
error
in/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/images/rootfs.cpio\n' >> /home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/build/buildroot-fs/cpio/fakeroot
chmod a+x /home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/build/buildroot-fs/cpio/fakeroot
PATH="/home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/host/bin:/home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/host/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/martin/martinworkspace/nxp66/BSP/ToolChain/arm-buildroot-linux-gnueabihf_sdk-buildroot/bin" FAKEROOTDONTTRYCHOWN=1 /home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/host/bin/fakeroot -- /home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/build/buildroot-fs/cpio/fakeroot
rootdir=/home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/build/buildroot-fs/cpio/target
table='/home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/build/buildroot-fs/full_devices_table.txt'
mknod: /home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/build/buildroot-fs/cpio/target/dev/console: Operation not permitted
make[1]: *** [fs/cpio/cpio.mk:72: /home/martin/martinworkspace/nxp66/BSP/Buildroot_2020.02.x/output/images/rootfs.cpio] Error 1
make: *** [Makefile:84: _all] Error 2
fix: 权限不够
sudo make all -j8
4. 编译完成