简体   繁体   中英

Cross compiling “grub2” for live CD. How to use the “--prefix” option?

I make a live CD with custom linux and "grub2" on board.

I compile the "grub2" from source code:

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

As a result, in every script, and some binary files has the "prefix" variable is present. This makes the "grub2" not working.

$ 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

Please, say Me. How to install "grub2" to the "${PREFIX_PATH}", but keep it working?

Solution: use environment variable "DESTDIR" instead of "--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}"

Related post: configure “--prefix” option for cross compiling

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM