From e1427c7bbbc2e0a28660de30a2c76eea4fc24a49 Mon Sep 17 00:00:00 2001 From: Dominic Ayre Date: Thu, 24 Jul 2025 08:21:33 +0000 Subject: [PATCH] Makefile: Add flag to build for usr-merged root filesystems Without this UVM built with this Makefile doesn't boot when using Azure Linux rootfs. This is a new version of https://github.com/microsoft/hcsshim/pull/2485 Signed-off-by: Dominic Ayre Co-authored-by: Tingmao Wang Assisted-by: GitHub-Copilot Signed-off-by: Tingmao Wang --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0c46422266..9a7a47fcc1 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,11 @@ include Makefile.bootfiles # enable loading kernel modules in init KMOD:=0 +# whether the base rootfs uses a usr-merged layout (i.e. /bin is a symlink to +# /usr/bin). This defaults to disabled; set USR_MERGED_ROOTFS=1 for a +# usr-merged base rootfs such as Azure Linux. +USR_MERGED_ROOTFS:=0 + CFLAGS:=-O2 -Wall LDFLAGS:=-static -s #strip C binaries LDLIBS:= @@ -89,7 +94,12 @@ out/delta-snp.tar.gz: out/delta.tar.gz bin/internal/tools/snp-report boot/startu out/delta.tar.gz: bin/init bin/vsockexec bin/cmd/gcs bin/cmd/gcstools bin/cmd/hooks/wait-paths Makefile @mkdir -p out rm -rf rootfs - mkdir -p rootfs/bin/ +ifeq "$(USR_MERGED_ROOTFS)" "1" + mkdir -p rootfs/usr/bin + ln -s usr/bin rootfs/bin +else + mkdir -p rootfs/bin +endif mkdir -p rootfs/info/ cp bin/init rootfs/ cp bin/vsockexec rootfs/bin/