Flashrom refactoring for broadcom platforms (#7693)
#### Why I did it - To build flashrom properly with dependency tracking. #### How I did it - Moved flashrom code from platform/broadcom/sonic-platform-modules-dell/tools directory to src/flashrom directory. - At the end, flashrom_0.9.7_amd64.deb package is build which will be installed in the devices. - Currently flashrom builds only for Dell S6100 platforms.
This commit is contained in:
parent
3ad830eb49
commit
f8eb5b0958
@ -325,7 +325,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
|
|||||||
if [[ $CONFIGURED_ARCH == amd64 ]]; then
|
if [[ $CONFIGURED_ARCH == amd64 ]]; then
|
||||||
## Pre-install the fundamental packages for amd64 (x86)
|
## Pre-install the fundamental packages for amd64 (x86)
|
||||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
|
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install \
|
||||||
flashrom \
|
|
||||||
rasdaemon
|
rasdaemon
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -350,6 +350,11 @@ sudo chmod 755 $FILESYSTEM_ROOT/usr/bin/restart_service
|
|||||||
# Install custom-built openssh sshd
|
# Install custom-built openssh sshd
|
||||||
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_*.deb
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/openssh-server_*.deb
|
||||||
|
|
||||||
|
{% if sonic_asic_platform == 'broadcom' %}
|
||||||
|
# Install custom-built flashrom
|
||||||
|
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/flashrom_*.deb
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
# Copy crontabs
|
# Copy crontabs
|
||||||
sudo cp -f $IMAGE_CONFIGS/cron.d/* $FILESYSTEM_ROOT/etc/cron.d/
|
sudo cp -f $IMAGE_CONFIGS/cron.d/* $FILESYSTEM_ROOT/etc/cron.d/
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ $(SONIC_ONE_ABOOT_IMAGE)_DEPENDENT_MACHINE = broadcom-dnx
|
|||||||
$(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot
|
$(SONIC_ONE_ABOOT_IMAGE)_IMAGE_TYPE = aboot
|
||||||
$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_DRIVERS) $(ARISTA_PLATFORM_MODULE_PYTHON2) $(ARISTA_PLATFORM_MODULE_PYTHON3) $(ARISTA_PLATFORM_MODULE)
|
$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(ARISTA_PLATFORM_MODULE_DRIVERS) $(ARISTA_PLATFORM_MODULE_PYTHON2) $(ARISTA_PLATFORM_MODULE_PYTHON3) $(ARISTA_PLATFORM_MODULE)
|
||||||
$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(PHY_CREDO)
|
$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(PHY_CREDO)
|
||||||
|
$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(FLASHROM)
|
||||||
$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
$(SONIC_ONE_ABOOT_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
||||||
$(SONIC_ONE_ABOOT_IMAGE)_LAZY_BUILD_INSTALLS = $(BRCM_OPENNSL_KERNEL) $(BRCM_DNX_OPENNSL_KERNEL)
|
$(SONIC_ONE_ABOOT_IMAGE)_LAZY_BUILD_INSTALLS = $(BRCM_OPENNSL_KERNEL) $(BRCM_DNX_OPENNSL_KERNEL)
|
||||||
ifeq ($(INSTALL_DEBUG_TOOLS),y)
|
ifeq ($(INSTALL_DEBUG_TOOLS),y)
|
||||||
|
@ -6,6 +6,7 @@ $(SONIC_ONE_IMAGE)_DEPENDENT_MACHINE = broadcom-dnx
|
|||||||
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
|
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
|
||||||
$(SONIC_ONE_IMAGE)_INSTALLS += $(PDDF_PLATFORM_MODULE)
|
$(SONIC_ONE_IMAGE)_INSTALLS += $(PDDF_PLATFORM_MODULE)
|
||||||
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
||||||
|
$(SONIC_ONE_IMAGE)_INSTALLS += $(FLASHROM)
|
||||||
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \
|
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \
|
||||||
$(DELL_Z9264F_PLATFORM_MODULE) \
|
$(DELL_Z9264F_PLATFORM_MODULE) \
|
||||||
$(DELL_S5232F_PLATFORM_MODULE) \
|
$(DELL_S5232F_PLATFORM_MODULE) \
|
||||||
|
@ -52,6 +52,3 @@ $(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S5248F_PLAT
|
|||||||
DELL_S5296F_PLATFORM_MODULE = platform-modules-s5296f_$(DELL_S5296F_PLATFORM_MODULE_VERSION)_amd64.deb
|
DELL_S5296F_PLATFORM_MODULE = platform-modules-s5296f_$(DELL_S5296F_PLATFORM_MODULE_VERSION)_amd64.deb
|
||||||
$(DELL_S5296F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_s5296f_c3538-r0
|
$(DELL_S5296F_PLATFORM_MODULE)_PLATFORM = x86_64-dellemc_s5296f_c3538-r0
|
||||||
$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S5296F_PLATFORM_MODULE)))
|
$(eval $(call add_extra_package,$(DELL_Z9100_PLATFORM_MODULE),$(DELL_S5296F_PLATFORM_MODULE)))
|
||||||
|
|
||||||
#flashrom tool
|
|
||||||
$(shell ./$(PLATFORM_PATH)/sonic-platform-modules-dell/tools/flashrom.sh > /dev/null 2>&1)
|
|
||||||
|
@ -5,6 +5,7 @@ $(SONIC_RAW_IMAGE)_MACHINE = broadcom
|
|||||||
$(SONIC_RAW_IMAGE)_IMAGE_TYPE = raw
|
$(SONIC_RAW_IMAGE)_IMAGE_TYPE = raw
|
||||||
$(SONIC_RAW_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL)
|
$(SONIC_RAW_IMAGE)_INSTALLS += $(BRCM_OPENNSL_KERNEL)
|
||||||
$(SONIC_RAW_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
$(SONIC_RAW_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
||||||
|
$(SONIC_RAW_IMAGE)_INSTALLS += $(FLASHROM)
|
||||||
$(SONIC_RAW_IMAGE)_LAZY_INSTALLS += $($(SONIC_ONE_IMAGE)_LAZY_INSTALLS)
|
$(SONIC_RAW_IMAGE)_LAZY_INSTALLS += $($(SONIC_ONE_IMAGE)_LAZY_INSTALLS)
|
||||||
$(SONIC_RAW_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
|
$(SONIC_RAW_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_IMAGES)
|
||||||
SONIC_INSTALLERS += $(SONIC_RAW_IMAGE)
|
SONIC_INSTALLERS += $(SONIC_RAW_IMAGE)
|
||||||
|
@ -25,6 +25,5 @@ s6100/systemd/platform-modules-s6100.service etc/systemd/system
|
|||||||
s6100/systemd/s6100-lpc-monitor.service etc/systemd/system
|
s6100/systemd/s6100-lpc-monitor.service etc/systemd/system
|
||||||
s6100/systemd/s6100-reboot-cause.service etc/systemd/system
|
s6100/systemd/s6100-reboot-cause.service etc/systemd/system
|
||||||
s6100/systemd/s6100-i2c-enumerate.service etc/systemd/system
|
s6100/systemd/s6100-i2c-enumerate.service etc/systemd/system
|
||||||
tools/flashrom/flashrom usr/local/bin/
|
|
||||||
common/fw-updater usr/local/bin
|
common/fw-updater usr/local/bin
|
||||||
common/onie_mode_set usr/local/bin
|
common/onie_mode_set usr/local/bin
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
export DELL_TOOLS_DIR="platform/broadcom/sonic-platform-modules-dell/tools"
|
|
||||||
|
|
||||||
cd $DELL_TOOLS_DIR
|
|
||||||
rm -rf $DELL_TOOLS_DIR/flashrom
|
|
||||||
git clone https://github.com/flashrom/flashrom.git
|
|
||||||
cd flashrom
|
|
||||||
git checkout tags/0.9.7
|
|
||||||
git apply ../0002-Flashrom-support-for-Intel-Rangeley-and-Denverton-CP.patch
|
|
||||||
make
|
|
8
rules/flashrom.dep
Normal file
8
rules/flashrom.dep
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
SPATH := $($(FLASHROM)_SRC_PATH)
|
||||||
|
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/flashrom.mk rules/flashrom.dep
|
||||||
|
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
|
||||||
|
DEP_FILES += $(shell git ls-files $(SPATH))
|
||||||
|
|
||||||
|
$(FLASHROM)_CACHE_MODE := GIT_CONTENT_SHA
|
||||||
|
$(FLASHROM)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
|
||||||
|
$(FLASHROM)_DEP_FILES := $(DEP_FILES)
|
13
rules/flashrom.mk
Normal file
13
rules/flashrom.mk
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# flashrom package
|
||||||
|
#
|
||||||
|
|
||||||
|
FLASHROM_VERSION_FULL = 0.9.7
|
||||||
|
|
||||||
|
export FLASHROM_VERSION_FULL
|
||||||
|
|
||||||
|
FLASHROM = flashrom_$(FLASHROM_VERSION_FULL)_amd64.deb
|
||||||
|
$(FLASHROM)_SRC_PATH = $(SRC_PATH)/flashrom
|
||||||
|
|
||||||
|
SONIC_MAKE_DEBS += $(FLASHROM)
|
||||||
|
|
||||||
|
export FLASHROM
|
25
src/flashrom/Makefile
Normal file
25
src/flashrom/Makefile
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
SHELL = /bin/bash
|
||||||
|
.ONESHELL:
|
||||||
|
.SHELLFLAGS += -e
|
||||||
|
|
||||||
|
|
||||||
|
MAIN_TARGET = $(FLASHROM)
|
||||||
|
|
||||||
|
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||||
|
rm -rf ./flashrom-$(FLASHROM_VERSION_FULL)
|
||||||
|
# Obtain flashrom
|
||||||
|
git clone https://github.com/flashrom/flashrom.git flashrom-$(FLASHROM_VERSION_FULL)
|
||||||
|
pushd ./flashrom-$(FLASHROM_VERSION_FULL)
|
||||||
|
|
||||||
|
# Check out tag: tags/0.9.7
|
||||||
|
git checkout -b flashrom-src tags/$(FLASHROM_VERSION_FULL)
|
||||||
|
|
||||||
|
# Apply patch series
|
||||||
|
stg init
|
||||||
|
stg import -s ../patch/series
|
||||||
|
|
||||||
|
# Build package
|
||||||
|
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)
|
||||||
|
popd
|
||||||
|
|
||||||
|
mv $* $(DEST)/
|
45
src/flashrom/patch/0003-Debian-package-base.patch
Normal file
45
src/flashrom/patch/0003-Debian-package-base.patch
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
diff --git a/debian/changelog b/debian/changelog
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..a7acb04
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/debian/changelog
|
||||||
|
@@ -0,0 +1,5 @@
|
||||||
|
+flashrom (0.9.7) unstable; urgency=low
|
||||||
|
+
|
||||||
|
+ * Initial release
|
||||||
|
+
|
||||||
|
+ -- Dell Team <support@dell.com> Mon, 14 Dec 2020 10:10:10 -0800
|
||||||
|
diff --git a/debian/compat b/debian/compat
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..ec63514
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/debian/compat
|
||||||
|
@@ -0,0 +1 @@
|
||||||
|
+9
|
||||||
|
diff --git a/debian/control b/debian/control
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..8aafc90
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/debian/control
|
||||||
|
@@ -0,0 +1,8 @@
|
||||||
|
+Source: flashrom
|
||||||
|
+Section: main
|
||||||
|
+Priority: optional
|
||||||
|
+Maintainer: Dell Team <support@dell.com>
|
||||||
|
+
|
||||||
|
+Package: flashrom
|
||||||
|
+Architecture: amd64
|
||||||
|
+Description: Flashrom Utility
|
||||||
|
diff --git a/debian/rules b/debian/rules
|
||||||
|
new file mode 100755
|
||||||
|
index 0000000..492b21d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/debian/rules
|
||||||
|
@@ -0,0 +1,7 @@
|
||||||
|
+#!/usr/bin/make -f
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+%:
|
||||||
|
+ dh $@
|
||||||
|
+
|
||||||
|
+override_dh_usrlocal:
|
37
src/flashrom/patch/0004-Flashrom-remove-tmpl.patch
Normal file
37
src/flashrom/patch/0004-Flashrom-remove-tmpl.patch
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 0e976e5..d4413df 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -686,7 +686,7 @@ FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%
|
||||||
|
LIBFLASHROM_OBJS = $(CHIP_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS)
|
||||||
|
OBJS = $(CLI_OBJS) $(LIBFLASHROM_OBJS)
|
||||||
|
|
||||||
|
-all: hwlibs features $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8
|
||||||
|
+all: hwlibs features $(PROGRAM)$(EXEC_SUFFIX)
|
||||||
|
ifeq ($(ARCH), x86)
|
||||||
|
@+$(MAKE) -C util/ich_descriptors_tool/ TARGET_OS=$(TARGET_OS) EXEC_SUFFIX=$(EXEC_SUFFIX)
|
||||||
|
endif
|
||||||
|
@@ -914,22 +914,9 @@ endif
|
||||||
|
@$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features
|
||||||
|
@rm -f .featuretest.c .featuretest$(EXEC_SUFFIX)
|
||||||
|
|
||||||
|
-$(PROGRAM).8: $(PROGRAM).8.tmpl
|
||||||
|
- @sed -e '1 s#".*".*#"$(shell ./util/getrevision.sh -d $(PROGRAM).8.tmpl)" "$(VERSION)"#' <$< >$@
|
||||||
|
-
|
||||||
|
-install: $(PROGRAM)$(EXEC_SUFFIX) $(PROGRAM).8
|
||||||
|
+install: $(PROGRAM)$(EXEC_SUFFIX)
|
||||||
|
mkdir -p $(DESTDIR)$(PREFIX)/sbin
|
||||||
|
- mkdir -p $(DESTDIR)$(MANDIR)/man8
|
||||||
|
$(INSTALL) -m 0755 $(PROGRAM)$(EXEC_SUFFIX) $(DESTDIR)$(PREFIX)/sbin
|
||||||
|
- $(INSTALL) -m 0644 $(PROGRAM).8 $(DESTDIR)$(MANDIR)/man8
|
||||||
|
-
|
||||||
|
-export: $(PROGRAM).8
|
||||||
|
- @rm -rf $(EXPORTDIR)/flashrom-$(RELEASENAME)
|
||||||
|
- @svn export -r BASE . $(EXPORTDIR)/flashrom-$(RELEASENAME)
|
||||||
|
- @sed "s/^SVNVERSION.*/SVNVERSION := $(SVNVERSION)/" Makefile >$(EXPORTDIR)/flashrom-$(RELEASENAME)/Makefile
|
||||||
|
- @cp $(PROGRAM).8 "$(EXPORTDIR)/flashrom-$(RELEASENAME)/$(PROGRAM).8"
|
||||||
|
- @LC_ALL=C svn log >$(EXPORTDIR)/flashrom-$(RELEASENAME)/ChangeLog
|
||||||
|
- @echo Exported $(EXPORTDIR)/flashrom-$(RELEASENAME)/
|
||||||
|
|
||||||
|
tarball: export
|
||||||
|
@tar cjf $(EXPORTDIR)/flashrom-$(RELEASENAME).tar.bz2 -C $(EXPORTDIR)/ $(TAROPTIONS) flashrom-$(RELEASENAME)/
|
3
src/flashrom/patch/series
Normal file
3
src/flashrom/patch/series
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
0002-Flashrom-support-for-Intel-Rangeley-and-Denverton-CP.patch
|
||||||
|
0003-Debian-package-base.patch
|
||||||
|
0004-Flashrom-remove-tmpl.patch
|
Loading…
Reference in New Issue
Block a user