oci-runtime-tools: provide rootfs-arm64 for oci-runtime-tests
authorDaniel Golle <[email protected]>
Mon, 29 Mar 2021 21:06:13 +0000 (22:06 +0100)
committerDaniel Golle <[email protected]>
Mon, 29 Mar 2021 23:54:09 +0000 (00:54 +0100)
Download static busybox to provide rootfs-amd64.tar.gz for test-suite.

Signed-off-by: Daniel Golle <[email protected]>
utils/oci-runtime-tools/Makefile

index 844fafe8b97031777c3279e136396916c75af770..e0ae1126c94cecdec2124bb09516056ed41a1441 100644 (file)
@@ -22,9 +22,18 @@ PKG_USE_MIPS16:=0
 GO_PKG:=github.com/opencontainers/runtime-tools/
 GO_PKG_LDFLAGS_X:=main.gitCommit=$(PKG_SOURCE_VERSION) main.version=$(PKG_SOURCE_VERSION)
 
+BUSYBOX_STATIC_VERSION:=1.31.0
+
 include $(INCLUDE_DIR)/package.mk
 include ../../lang/golang/golang-package.mk
 
+define Download/busybox-static-armv8l
+  URL:=https://busybox.net/downloads/binaries/$$(BUSYBOX_STATIC_VERSION)-defconfig-multiarch-musl/
+  URL_FILE:=busybox-armv8l
+  FILE:=busybox-$(BUSYBOX_STATIC_VERSION)-static-armv8l
+  HASH:=141adb1b625a6f44c4b114f76b4387b4ea4f7ab802b88eb40e0d2f6adcccb1c3
+endef
+
 define Package/oci-runtime-tool
   SECTION:=utils
   CATEGORY:=Utilities
@@ -43,7 +52,7 @@ define Package/oci-runtime-tests
   CATEGORY:=Utilities
   TITLE:=OCI runtimetest tool
   URL:=https://github.com/opencontainers/runtime-tools
-  DEPENDS:=@(i386||i686||x86_64) oci-runtime-tool +tar
+  DEPENDS:=@(aarch64||i386||i686||x86_64) oci-runtime-tool +tar
 endef
 
 define Package/oci-runtime-tests/description
@@ -56,6 +65,21 @@ endef
 
 GO_PKG_BUILD_VARS += GO111MODULE=auto
 
+define Build/Prepare
+       $(call Build/Prepare/Default)
+ifdef CONFIG_aarch64
+       $(eval $(call Download,busybox-static-armv8l))
+       ( \
+               mkdir -p $(PKG_BUILD_DIR)/rootfs-armv8l ;\
+               cd $(PKG_BUILD_DIR)/rootfs-armv8l ;\
+               $(TAR) xzf ../rootfs-amd64.tar.gz ;\
+               $(CP) $(DL_DIR)/busybox-$(BUSYBOX_STATIC_VERSION)-static-armv8l bin/busybox ;\
+               chmod 0755 bin/busybox ;\
+               $(TAR) czf ../rootfs-arm64.tar.gz . ;\
+       )
+endif
+endef
+
 define Build/Compile
        $(call GoPackage/Build/Compile)
        $(call GoPackage/Package/Install/Bin,$(PKG_INSTALL_DIR))
@@ -74,10 +98,15 @@ define Package/oci-runtime-tests/install
                $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$$$${testbin} \
                        $(1)/usr/libexec/oci-runtime-test/$$$${testbin}.t ; \
        done )
+ifdef CONFIG_x86
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/rootfs-386.tar.gz $(1)/usr/libexec/oci-runtime-test
 ifdef CONFIG_x86_64
        $(INSTALL_DATA) $(PKG_BUILD_DIR)/rootfs-amd64.tar.gz $(1)/usr/libexec/oci-runtime-test
 endif
-       $(INSTALL_DATA) $(PKG_BUILD_DIR)/rootfs-386.tar.gz $(1)/usr/libexec/oci-runtime-test
+endif
+ifdef CONFIG_aarch64
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/rootfs-arm64.tar.gz $(1)/usr/libexec/oci-runtime-test
+endif
 endef
 
 $(eval $(call GoBinPackage,oci-runtime-tools))