0

我制作了一张带有自定义 linux 和板载“grub2”的 live CD。

我从源代码编译“grub2”:

HOST=x86_64-linux-gnu
TARGET=x86_64-unknown-linux-uclibc

CPPFLAGS="-I${INST_CROSS_TOOLS}/usr/include" LDFLAGS="-L${PREFIX_PATH}/usr/lib" \
./configure \
--prefix="${PREFIX_PATH}" \
--host="${HOST}" \
--target="${TARGET}"

make
make install

结果,在每个脚本中,一些二进制文件都有“前缀”变量存在。这使得“grub2”无法正常工作。

$ grep -n abradox rootfs/sbin/*
rootfs/sbin/x86_64-unknown-linux-uclibc-grub-install:22:prefix="/home/abradox/data/work/x86_64_installer/x86_64_installer/rootfs"
rootfs/sbin/x86_64-unknown-linux-uclibc-grub-mkconfig:21:prefix="/home/abradox/data/work/x86_64_installer/x86_64_installer/rootfs"
rootfs/sbin/x86_64-unknown-linux-uclibc-grub-mkconfig:25:prefix="/home/abradox/data/work/x86_64_installer/x86_64_installer/rootfs"
rootfs/sbin/x86_64-unknown-linux-uclibc-grub-mknetdir:22:prefix="/home/abradox/data/work/x86_64_installer/x86_64_installer/rootfs"
rootfs/sbin/x86_64-unknown-linux-uclibc-grub-reboot:22:prefix=/home/abradox/data/work/x86_64_installer/x86_64_installer/rootfs
rootfs/sbin/x86_64-unknown-linux-uclibc-grub-set-default:22:prefix=/home/abradox/data/work/x86_64_installer/x86_64_installer/rootfs

请说我。如何将“grub2”安装到“${PREFIX_PATH}”,但保持工作?

4

1 回答 1

1

解决方案:使用环境变量“DESTDIR”而不是“--prefix”。

HOST=x86_64-linux-gnu
TARGET=x86_64-unknown-linux-uclibc

CPPFLAGS="-I${INST_CROSS_TOOLS}/usr/include" LDFLAGS="L${PREFIX_PATH}/usr/lib" \
./configure \
--host="${HOST}" \
--target="${TARGET}"

make
make install DESTDIR="${PREFIX_PATH}"

相关文章:为交叉编译配置“--prefix”选项

于 2016-03-16T11:09:04.467 回答