sonic-buildimage/platform/mellanox/mft/Makefile
Stephen Sun 7e0cfcee2c [Mellanox] build mft/hw-management in buster stage
Currently we port SONiC to buster in a way that base image is on buster and
other dockers based on stretch. The benefit is that tasks can be carried out
simultaneously.

The build procedure can be treated as 2 stages.

The first stage is to build the stretch-based debs and dockers and the second
stage is to build the buster-based ones.

One thing we have to pay attention to is some debs depend on kernel should not
be built at stretch stage because the kernel isn't available at that time.
The idea is to move that kind of debs out of SONIC_STRETCH_DEBS. Meanwhile,
any dependency explicitly put on the stretch based dockers on kernel should be
removed.
2020-04-17 04:51:51 +00:00

33 lines
1.3 KiB
Makefile

.ONESHELL:
SHELL = /bin/bash
.SHELLFLAGS += -e
MFT_NAME = mft-$(MFT_VERSION)-$(MFT_REVISION)-x86_64-deb
MFT_TGZ = $(MFT_NAME).tgz
SRC_DEB = kernel-mft-dkms_$(MFT_VERSION)-$(MFT_REVISION)_all.deb
MAIN_TARGET = mft_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb
DERIVED_TARGETS = kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb mft-oem_$(MFT_VERSION)-$(MFT_REVISION)_amd64.deb
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
rm -rf $(MFT_NAME)
wget -O $(MFT_TGZ) http://www.mellanox.com/downloads/MFT/$(MFT_TGZ)
tar xzf $(MFT_TGZ)
pushd $(MFT_NAME)/SDEBS
# put a lock here because dpkg does not allow installing packages in parallel
while true; do
if mkdir $(DEST)/dpkg_lock &> /dev/null; then
{ sudo dpkg -i $(SRC_DEB) && rm -d $(DEST)/dpkg_lock && break; } || { rm -d $(DEST)/dpkg_lock && exit 1 ; }
fi
done
tar xvf `sudo dkms mkdriverdisk kernel-mft-dkms/$(MFT_VERSION) -a all -d ubuntu -k $(KVERSION) --media tar | grep "Disk image location" | cut -d':' -f2`
popd
# fix timestamp because we do not actually build tools, only kernel
touch $(MFT_NAME)/DEBS/*
mv $(MFT_NAME)/SDEBS/ubuntu-drivers/4.19.0/kernel-mft-dkms_$(MFT_VERSION)-$(KVERSION)_all.deb $(MFT_NAME)/DEBS/* $(DEST)
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)