From 7adccbbc6b0f02fa2ce65e44fb6b5827ea8e3ca1 Mon Sep 17 00:00:00 2001 From: Hamza El-Saawy <84944216+helsaawy@users.noreply.github.com> Date: Tue, 22 Mar 2022 11:34:58 -0400 Subject: [PATCH] rootfs make target (#1333) New makefile target to create rootfs.vhd from rootfs.tar using tar2ext4. Requires building cmd/tar2ext4 locally. Signed-off-by: Hamza El-Saawy --- .gitignore | 7 +++---- Makefile | 9 +++++++++ test/vendor/github.com/Microsoft/hcsshim/.gitignore | 7 +++---- test/vendor/github.com/Microsoft/hcsshim/Makefile | 9 +++++++++ 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 54ed6f06c9..c91812a4b4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ # Ignore vscode setting files .vscode/ +.idea/ # Test binary, build with `go test -c` *.test @@ -28,11 +29,9 @@ service/pkg/ .rootfs-done bin/* rootfs/* +rootfs-conv/* *.o /build/ deps/* -out/* - -.idea/ -.vscode/ \ No newline at end of file +out/* \ No newline at end of file diff --git a/Makefile b/Makefile index c09b1e192a..362ddea7c6 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,8 @@ GCS_TOOLS=\ .PHONY: all always rootfs test +.DEFAULT_GOAL := all + all: out/initrd.img out/rootfs.tar.gz clean: @@ -32,6 +34,12 @@ clean: test: cd $(SRCROOT) && go test -v ./internal/guest/... +rootfs: out/rootfs.vhd + +out/rootfs.vhd: out/rootfs.tar.gz bin/cmd/tar2ext4 + gzip -f -d ./out/rootfs.tar.gz + bin/cmd/tar2ext4 -vhd -i ./out/rootfs.tar -o $@ + 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 @@ -62,6 +70,7 @@ out/initrd.img: $(BASE) out/delta.tar.gz $(SRCROOT)/hack/catcpio.sh -include deps/cmd/gcs.gomake -include deps/cmd/gcstools.gomake -include deps/cmd/hooks/wait-paths.gomake +-include deps/cmd/tar2ext4.gomake # Implicit rule for includes that define Go targets. %.gomake: $(SRCROOT)/Makefile diff --git a/test/vendor/github.com/Microsoft/hcsshim/.gitignore b/test/vendor/github.com/Microsoft/hcsshim/.gitignore index 54ed6f06c9..c91812a4b4 100644 --- a/test/vendor/github.com/Microsoft/hcsshim/.gitignore +++ b/test/vendor/github.com/Microsoft/hcsshim/.gitignore @@ -6,6 +6,7 @@ # Ignore vscode setting files .vscode/ +.idea/ # Test binary, build with `go test -c` *.test @@ -28,11 +29,9 @@ service/pkg/ .rootfs-done bin/* rootfs/* +rootfs-conv/* *.o /build/ deps/* -out/* - -.idea/ -.vscode/ \ No newline at end of file +out/* \ No newline at end of file diff --git a/test/vendor/github.com/Microsoft/hcsshim/Makefile b/test/vendor/github.com/Microsoft/hcsshim/Makefile index c09b1e192a..362ddea7c6 100644 --- a/test/vendor/github.com/Microsoft/hcsshim/Makefile +++ b/test/vendor/github.com/Microsoft/hcsshim/Makefile @@ -23,6 +23,8 @@ GCS_TOOLS=\ .PHONY: all always rootfs test +.DEFAULT_GOAL := all + all: out/initrd.img out/rootfs.tar.gz clean: @@ -32,6 +34,12 @@ clean: test: cd $(SRCROOT) && go test -v ./internal/guest/... +rootfs: out/rootfs.vhd + +out/rootfs.vhd: out/rootfs.tar.gz bin/cmd/tar2ext4 + gzip -f -d ./out/rootfs.tar.gz + bin/cmd/tar2ext4 -vhd -i ./out/rootfs.tar -o $@ + 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 @@ -62,6 +70,7 @@ out/initrd.img: $(BASE) out/delta.tar.gz $(SRCROOT)/hack/catcpio.sh -include deps/cmd/gcs.gomake -include deps/cmd/gcstools.gomake -include deps/cmd/hooks/wait-paths.gomake +-include deps/cmd/tar2ext4.gomake # Implicit rule for includes that define Go targets. %.gomake: $(SRCROOT)/Makefile