Abradox
Abradox

Reputation: 117

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?

Upvotes: 0

Views: 1114

Answers (1)

Abradox
Abradox

Reputation: 117

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

Upvotes: 1

Related Questions