From 15a8ffeee0096f2c975a28a0d9089e71466f38d5 Mon Sep 17 00:00:00 2001 From: Jackie Huang Date: Wed, 8 Feb 2023 23:45:31 -0500 Subject: [PATCH] sm: fix the hardcoded includes for arm64 The includes path in Makefile is hardcoded with x86_64, use dpkg-architecture to check the host arch and replace the hardcoded name. Test Plan: PASS: build-pkgs on x86-64 host PASS: build-image on x86-64 host PASS: build-pkgs on arm64 host PASS: build-image on arm64 host PASS: Deploy AIO-SX on x86-64 targets and check sm service PASS: Deploy AIO-SX on arm64 targets and check sm service PASS: Deploy AIO-DX on arm64 targets and check sm service PASS: Deploy std (2+2+2) on arm64 targets and check sm service Story: 2010739 Task: 48017 Change-Id: Ie22477b7ec7df63377f666186d95201cd16f5809 Signed-off-by: Jackie Huang --- service-mgmt/sm-common/debian/deb_folder/rules | 7 +++++++ service-mgmt/sm-db/debian/deb_folder/rules | 5 +++++ service-mgmt/sm/debian/deb_folder/rules | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/service-mgmt/sm-common/debian/deb_folder/rules b/service-mgmt/sm-common/debian/deb_folder/rules index d7162e81..c25d23cf 100755 --- a/service-mgmt/sm-common/debian/deb_folder/rules +++ b/service-mgmt/sm-common/debian/deb_folder/rules @@ -6,10 +6,17 @@ export PMONDIR = /usr/share/starlingx/pmon.d export VER = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') export VER_MJR = $(shell echo $(VER) | cut -d. -f1) +export DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null) %: dh $@ +override_dh_auto_build: +ifeq ($(DEB_HOST_ARCH),arm64) + sed -i "s/x86_64/aarch64/" $(CURDIR)/src/Makefile +endif + dh_auto_build + override_dh_auto_install: $(MAKE) DEST_DIR=${ROOT} \ BIN_DIR=usr/bin \ diff --git a/service-mgmt/sm-db/debian/deb_folder/rules b/service-mgmt/sm-db/debian/deb_folder/rules index a044d874..eebbbb1d 100755 --- a/service-mgmt/sm-db/debian/deb_folder/rules +++ b/service-mgmt/sm-db/debian/deb_folder/rules @@ -4,10 +4,15 @@ export ROOT = $(CURDIR)/debian/tmp export VER = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') export VER_MJR = $(shell echo $(VER) | cut -d. -f1) +export DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null) + %: dh $@ override_dh_auto_build: +ifeq ($(DEB_HOST_ARCH),arm64) + sed -i "s/x86_64/aarch64/" $(CURDIR)/src/Makefile +endif sqlite3 database/sm.db < database/create_sm_db.sql sqlite3 database/sm.hb.db < database/create_sm_hb_db.sql dh_auto_build diff --git a/service-mgmt/sm/debian/deb_folder/rules b/service-mgmt/sm/debian/deb_folder/rules index 55ea5af9..50faa77a 100755 --- a/service-mgmt/sm/debian/deb_folder/rules +++ b/service-mgmt/sm/debian/deb_folder/rules @@ -4,6 +4,8 @@ ROOT := $(CURDIR)/debian/tmp PMONDIR := /usr/share/starlingx/pmon.d UNIT_DIR := /lib/systemd/system +export DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH 2>/dev/null) + %: dh $@ @@ -11,6 +13,12 @@ override_dh_usrlocal: # dh_usrlocal complains about files being put in /usr/local # this empty override causes dh_usrlocal to be skipped. +override_dh_auto_build: +ifeq ($(DEB_HOST_ARCH),arm64) + sed -i "s/x86_64/aarch64/" $(CURDIR)/src/Makefile +endif + dh_auto_build + override_dh_auto_install: $(MAKE) DEST_DIR=${ROOT} \ PMONDIR=${PMONDIR} \