为 live CD 交叉编译 "grub2"。如何使用“--prefix”选项?
Cross compiling "grub2" for live CD. How to use the "--prefix" option?
我制作了一张带有自定义 linux 和 "grub2" 的现场 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
因此,在每个脚本和一些二进制文件中都存在 "prefix" 变量。这使得 "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}”,但保持它的工作?
解决方案:使用环境变量"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}"
相关post:
我制作了一张带有自定义 linux 和 "grub2" 的现场 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
因此,在每个脚本和一些二进制文件中都存在 "prefix" 变量。这使得 "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}”,但保持它的工作?
解决方案:使用环境变量"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}"
相关post: