一开始编译时没给root权限,直接make,执行到这里报错:
rootdir=/home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/target
table='/home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/build/_device_table.txt'
makedevs: line 23: can't create node /home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/target/dev/console: Operation not permitted
make[1]: ***
然后给root权限,结果 sudo make还是报错,
rootdir=/home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/target
table='/home/any/MPU/Nuvoton/nuc970bsp/20200318/NUC970_Buildroot/output/build/_device_table.txt'
makdev : line23: can't creat node /home/buidlroot/output/target/dev/console file exists.
离线
报错信息:
printf ' cd /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target && find . | cpio --quiet -o -H newc > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio\n' >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
chmod a+x /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
PATH="/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/sbin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/sbin:/opt/Qt/5.13.2/gcc_64/bin:/usr/local/arm_gcc/arm_linux_gcc_12/bin:/home/any/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/fakeroot -- /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
rootdir=/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
table='/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt'
makedevs: line 23: can't create node /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/dev/console: Operation not permitted
make[1]: *** [fs/cpio/cpio.mk:58:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio] 错误 1
make: *** [Makefile:76:_all] 错误 2
_fakeroot.fs内容:
!/bin/sh
set -e
chown -h -R 0:0 /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/makedevs -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
cd /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target && find . | cpio --quiet -o -H newc > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio
_device_table.txt内容:
# See package/makedevs/README for details
#
# This device table is used to assign proper ownership and permissions
# on various files. It doesn't create any device file, as it is used
# in both static device configurations (where /dev/ is static) and in
# dynamic configurations (where devtmpfs, mdev or udev are used).
#
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
/dev d 755 0 0 - - - - -
/tmp d 1777 0 0 - - - - -
/etc d 755 0 0 - - - - -
/root d 700 0 0 - - - - -
/var/www d 755 33 33 - - - - -
/etc/shadow f 600 0 0 - - - - -
/etc/passwd f 644 0 0 - - - - -
/etc/network/if-up.d d 755 0 0 - - - - -
/etc/network/if-pre-up.d d 755 0 0 - - - - -
/etc/network/if-down.d d 755 0 0 - - - - -
/etc/network/if-post-down.d d 755 0 0 - - - - -
# uncomment this to allow starting x as non-root
#/usr/X11R6/bin/Xfbdev f 4755 0 0 - - - - -
/bin/busybox f 4755 0 0 - - - - -
/dev/console c 622 0 0 5 1 - - -
离线
Desktop:~/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot$ make
>>> Finalizing target directory
mkdir -p /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc
echo "buildroot" > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/hostname
/usr/bin/sed -i -e '$a \127.0.1.1\tbuildroot' -e '/^127.0.1.1/d' /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/hosts
mkdir -p /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc
echo "Welcome to Buildroot" > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/issue
mkdir -p /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/network/
( echo "# interface file auto-generated by buildroot"; echo ; echo "auto lo"; echo "iface lo inet loopback"; ) > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/network/interfaces
/usr/bin/sed -i -e s,^root:[^:]*:,root:"*":, /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/shadow
ln -sf busybox /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/bin/sh
/usr/bin/sed -i -e '/^#.*-o remount,rw \/$/s~^#\+~~' /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/inittab
rm -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/locales.nopurge
for i in C en_US locale-archive; do echo $i >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/locales.nopurge; done
for dir in /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/locale; do for langdir in $dir/*; do if [ -e "${langdir}" ]; then grep -qx "${langdir##*/}" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/locales.nopurge || rm -rf $langdir; fi done; done
if [ -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/X11/locale ]; then for lang in C en_US; do if [ -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/X11/locale/$lang/XLC_LOCALE ]; then echo "$lang/XLC_LOCALE: $lang"; fi done > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/X11/locale/locale.dir; fi
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/include /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/aclocal \
/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/lib/pkgconfig /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/pkgconfig \
/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/lib/cmake /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/cmake
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/{lib,share}/ -name '*.cmake' -print0 | xargs -0 rm -f
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/lib/ /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/lib/ /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/libexec/ \
\( -name '*.a' -o -name '*.la' \) -print0 | xargs -0 rm -f
find: ‘/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/libexec/’: 没有那个文件或目录
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/gdb
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/bash-completion
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/zsh
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/man /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/man
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/info /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/info
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/doc /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/doc
rm -rf /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share/gtk-doc
rmdir /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/usr/share 2>/dev/null
make[1]: [Makefile:650:target-finalize] 错误 1 (已忽略)
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target -type f \( -perm /111 -o -name '*.so*' \) -not \( -name 'libpthread*.so*' -o -name 'ld-*.so*' -o -name '*.ko' \) -print0 | xargs -0 /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-strip --remove-section=.comment --remove-section=.note 2>/dev/null || true
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/lib/ -type f -name 'libpthread*.so*' | \
xargs -r /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-strip --remove-section=.comment --remove-section=.note --strip-debug
find /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/lib/ -type f -name 'ld-*.so*' | \
xargs -r /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/arm-nuvoton-linux-uclibcgnueabi-strip --remove-section=.comment --remove-section=.note --strip-debug
test -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/ld.so.conf && \
{ echo "ERROR: we shouldn't have a /etc/ld.so.conf file"; exit 1; } || true
test -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/ld.so.conf.d && \
{ echo "ERROR: we shouldn't have a /etc/ld.so.conf.d directory"; exit 1; } || true
mkdir -p /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc
( \
echo "NAME=Buildroot"; \
echo "VERSION=2016.11.1-gfaa664b"; \
echo "ID=buildroot"; \
echo "VERSION_ID=2016.11.1"; \
echo "PRETTY_NAME=\"Buildroot 2016.11.1\"" \
) > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/etc/os-release
>>> Generating root filesystem image rootfs.cpio
if [ ! -e /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/init ]; then /usr/bin/install -m 0755 fs/cpio/init /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/init; fi
rm -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
rm -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM
rm -f /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_users_table.txt
echo '#!/bin/sh' > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
echo "set -e" >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
echo "chown -h -R 0:0 /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target" >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
printf ' \n' >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_users_table.txt
PATH="/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/sbin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/sbin:/opt/Qt/5.13.2/gcc_64/bin:/usr/local/arm_gcc/arm_linux_gcc_12/bin:/home/any/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/support/scripts/mkusers /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_users_table.txt /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
cat system/device_table.txt > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt
printf ' /bin/busybox f 4755 0 0 - - - - -\n /dev/console c 622 0 0 5 1 - - -\n\n' >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt
echo "/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/makedevs -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target" >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
printf ' cd /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target && find . | cpio --quiet -o -H newc > /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio\n' >> /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
chmod a+x /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
PATH="/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/sbin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/sbin:/opt/Qt/5.13.2/gcc_64/bin:/usr/local/arm_gcc/arm_linux_gcc_12/bin:/home/any/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/fakeroot -- /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_fakeroot.fs
rootdir=/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
table='/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt'
makedevs: line 23: can't create node /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target/dev/console: Operation not permitted
make[1]: *** [fs/cpio/cpio.mk:58:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/images/rootfs.cpio] 错误 1
make: *** [Makefile:76:_all] 错误 2
完整的make记录,可以看到是make时创建了_fakeroot.fs和_device_table.txt文件,并往里输入了内容。
离线
手动输入报错前的命令,先是fakeroot,执行后,命令提示符由$变为#。
PATH="/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/sbin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin:/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/sbin:/opt/Qt/5.13.2/gcc_64/bin:/usr/local/arm_gcc/arm_linux_gcc_12/bin:/home/any/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin" /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/fakeroot
再执行_fakeroot.fs,结果报错,打开_fakeroot.fs,从后往前以此注释掉再运行,发现是这一行引起的报错:
/home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/host/usr/bin/makedevs -d /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/build/_device_table.txt /home/any/MPU/Nuvoton/nuc970bsp/NUC970_Buildroot/output/target
搜makedevs用法, makdevs -d 文件 -r 路径,那么就是在buildroot/output/target目录下,创建_device_table.txt文件里写好的目录。
创建节点需要root权限,可上一步执行的fakeroot,就是为了避免用ubuntu系统的root权限啊。那么这里为何又提示权限不够?
最近编辑记录 Gentlepig (2023-02-22 11:44:06)
离线
注释掉_device_table.txt里/dev/conslole那一行,再编译,遇到了LD_PRELOAD 里找不到libfakroot.so的报错,在output/target里搜了下,确实没有。
感觉fakeroot编译可能有问题。昨天编译fakeroot遇到个问题,有个宏定义没有,去git.buildroot.org找到fakeroot这个文件,看到002xxx.patch是解决这个问题的,就下载了这个,编译通过。
除了001,002.patch,还有003-005.patch,今天索性全下载下来,放到buidlroot/package/fakeroot目录下。再次编译,居然通过了。
总结一下,新塘提供的nuc972 bsp在ubuntu18.04下编译很顺利。
在ubunt22.04下编译,遇到了几个问题,基本大都是通过在git.buildroot.org下找对应的patch解决的。
那个c++17下bool变量不能用++运算符是手动改成类似 a = a+1 来解决的。
最近编辑记录 Gentlepig (2023-02-22 13:44:50)
离线
本人水平太菜,不敢轻易动,怕引起更多的错误出来。庆幸buildroot总算是编译完成了。
离线
执行install_nuc970_bsp.sh时,遇到了这么个报错,根据报错内容找到.sh里对应的一行,就是解压output/images/rootfs.tar文件。
解压到/dev/console报错,而且/dev/consle文件类型为“未知”.
离线
tar ./dev/console 无法mknod 无效的参数
手动解压rootfs.tar,解压出来的文件里,确实没有/dev/console。
离线
还有个报错:
fseterr.c:77:3: error: #error "Please port gnulib fseterr.c to your platform! Look at the definition
网上搜到的,这么输入后不报错了,进入output/build/host-bisonxxx:
sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h
离线