Skip to content

Commit 4753953

Browse files
authored
Ipmitool bookworm: Fix and patch enterprise-numbers URL (sonic-net#17878)
### Why I did it ipmitool utility is used to access various HW sensors. Some platforms use "ipmitool raw " to read specific addresses. ipmitool_1.8.19-4_amd64.deb, that is part of bookworm has a defect. The package is missing file enterprise.txt that is expected by the "raw read" code path. It is so because the file the .deb tries to download at the build time does not have the necessary extension as it is available on remote server: https://www.iana.org/assignments/enterprise-numbers.txt ### How I did it The defect had been fixed using coding changes in next unstable version of Linux. It is expected to be available in future stable version of the OS. Hence to keep the changes to minimal, the .dsc file is downloaded and only the Makefile is modified to download the correct file. To make is work as patch necessary changes are made. #### How to verify it Build log is attached and installation of the file is noted line sonic-net#2274 When using vanilla bookworm on platforms like 5212 or 5224: ------------------------------------------------------------------- root@sonic:~# ipmitool raw 0x04 0x2d 0x31 IANA PEN registry open failed: No such file or directory 00 c0 01 80 When fixed we should not see the above error: -------------------------------------------------- root@sonic:/home/admin# ipmitool raw 0x04 0x2d 0x31 00 c0 00 80 ### Description for the changelog This change is to address ipmitool raw read issue. This patch must be removed once it is available in next stable Linux release that contains the fix. ipmitool/ipmitool@1edb0e2
1 parent 6224d67 commit 4753953

File tree

8 files changed

+175
-1
lines changed

8 files changed

+175
-1
lines changed

build_debian.sh

-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y in
377377
mtr-tiny \
378378
locales \
379379
cgroup-tools \
380-
ipmitool \
381380
ndisc6 \
382381
makedumpfile \
383382
conntrack \

files/build_templates/sonic_debian_extension.j2

+4
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ sudo mkdir -p $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM
101101
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/ifupdown2_*.deb || \
102102
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
103103

104+
# Install a patched version of ipmitool (and its dependencies via 'apt-get -y install -f')
105+
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/ipmitool_*.deb || \
106+
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
107+
104108
# Install a patched version of ntp (and its dependencies via 'apt-get -y install -f')
105109
sudo dpkg --root=$FILESYSTEM_ROOT --force-confdef --force-confold -i $debs_path/ntp_*.deb || \
106110
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y \

rules/ipmitool.dep

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
SPATH := $($(IPMITOOL)_SRC_PATH)
3+
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/ipmitool.mk rules/ipmitool.dep
4+
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
5+
DEP_FILES += $(shell git ls-files $(SPATH))
6+
7+
$(IPMITOOL)_CACHE_MODE := GIT_CONTENT_SHA
8+
$(IPMITOOL)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
9+
$(IPMITOOL)_DEP_FILES := $(DEP_FILES)
10+
11+

rules/ipmitool.mk

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ipmitool packages
2+
IPMITOOL_VERSION = 1.8.19
3+
IPMITOOL_VERSION_SUFFIX = 4
4+
IPMITOOL_VERSION_FULL = $(IPMITOOL_VERSION)-$(IPMITOOL_VERSION_SUFFIX)
5+
IPMITOOL = ipmitool_$(IPMITOOL_VERSION_FULL)_$(CONFIGURED_ARCH).deb
6+
$(IPMITOOL)_SRC_PATH = $(SRC_PATH)/ipmitool
7+
SONIC_MAKE_DEBS += $(IPMITOOL)
8+
IPMITOOL_DBG = ipmitool-dbgsym_$(IPMITOOL_VERSION_FULL)_$(CONFIGURED_ARCH).deb
9+
$(eval $(call add_derived_package,$(IPMITOOL),$(IPMITOOL_DBG)))
10+
DBG_SRC_ARCHIVE += ipmitool
11+
# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list}
12+
# are archived into debug one image to facilitate debugging.
13+
# Export these variables so they can be used in a sub-make
14+
export IPMITOOL_VERSION
15+
export IPMITOOL_VERSION_FULL
16+
export IPMITOOL
17+
export IPMITOOL_DBG

slave.mk

+1
Original file line numberDiff line numberDiff line change
@@ -1356,6 +1356,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
13561356
$(LINUX_KERNEL) \
13571357
$(SONIC_DEVICE_DATA) \
13581358
$(IFUPDOWN2) \
1359+
$(IPMITOOL) \
13591360
$(KDUMP_TOOLS) \
13601361
$(LIBPAM_RADIUS) \
13611362
$(LIBNSS_RADIUS) \

src/ipmitool/Makefile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.ONESHELL:
2+
SHELL = /bin/bash
3+
.SHELLFLAGS += -e
4+
5+
MAIN_TARGET = $(IPMITOOL)
6+
DERIVED_TARGETS = $(IPMITOOL_DBG)
7+
8+
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
9+
# Remove any stale files
10+
rm -rf ./ipmitool-$(IPMITOOL_VERSION) ./ipmitool*.{deb,udeb,dsc,gz,xz}
11+
# Obtain ipmitool
12+
dget https://deb.debian.org/debian/pool/main/i/ipmitool/ipmitool_$(IPMITOOL_VERSION_FULL).dsc
13+
# Build source and Debian packages
14+
pushd ipmitool-$(IPMITOOL_VERSION)
15+
16+
git init
17+
git add -f *
18+
git commit -m "unmodified ipmitool source"
19+
20+
# Apply patches
21+
stg init
22+
stg import -s ../patch/series
23+
dpkg-buildpackage -rfakeroot -d -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --admindir $(SONIC_DPKG_ADMINDIR)
24+
popd
25+
mv $* $(DERIVED_TARGETS) $(DEST)/
26+
27+
$(addprefix $(DEST)/, $(DERIVED_TARGETS)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)
28+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
From 719292c4800054ead278affc2972d8f77babd227 Mon Sep 17 00:00:00 2001
2+
From: rajib-dutta1 <[email protected]>
3+
Date: Wed, 10 Jan 2024 20:51:03 -0800
4+
Subject: [PATCH] Changes needed to install enterprise.txt
5+
6+
---
7+
Makefile.am | 40 ++++++++++++++++++++--------------------
8+
configure.ac | 30 +++++++++++++++---------------
9+
2 files changed, 35 insertions(+), 35 deletions(-)
10+
11+
diff --git a/Makefile.am b/Makefile.am
12+
index 355d3f0..ec9605c 100644
13+
--- a/Makefile.am
14+
+++ b/Makefile.am
15+
@@ -49,25 +49,25 @@ dist-hook:
16+
.PHONY: install-pen-database uninstall-pen-database
17+
.INTERMEDIATE: %.o %.la enterprise-numbers
18+
19+
-#if DOWNLOAD
20+
-
21+
-#enterprise-numbers:
22+
-# @echo Downloading IANA PEN database...
23+
-# @$(DOWNLOAD) "$(IANA_PEN)" > tmpfile.$$PPID || {\
24+
-# echo "FAILED to download the IANA PEN database"; \
25+
-# rm tmpfile.$$PPID; \
26+
-# false; \
27+
-# }
28+
-# @mv tmpfile.$$PPID $@
29+
-#
30+
-#install-pen-database: enterprise-numbers
31+
-# mkdir -m 755 -p $(DESTDIR)$(IANADIR)
32+
-# $(INSTALL_DATA) $< $(DESTDIR)$(IANADIR)/
33+
-#
34+
-#uninstall-pen-database:
35+
-# -rm -rf $(DESTDIR)$(IANADIR)/enterprise-numbers
36+
-#
37+
-#else
38+
+if DOWNLOAD
39+
+
40+
+enterprise-numbers.txt:
41+
+ @echo Downloading IANA PEN database...
42+
+ @$(DOWNLOAD) "$(IANA_PEN)" > tmpfile.$$PPID || {\
43+
+ echo "FAILED to download the IANA PEN database"; \
44+
+ rm tmpfile.$$PPID; \
45+
+ false; \
46+
+ }
47+
+ @mv tmpfile.$$PPID $@
48+
+
49+
+install-pen-database: enterprise-numbers.txt
50+
+ mkdir -m 755 -p $(DESTDIR)$(IANADIR)
51+
+ $(INSTALL_DATA) $< $(DESTDIR)$(IANADIR)/
52+
+
53+
+uninstall-pen-database:
54+
+ -rm -rf $(DESTDIR)$(IANADIR)/enterprise-numbers.txt
55+
+
56+
+else
57+
58+
install-pen-database:
59+
@echo "*** NOT installing the IANA PEN database."
60+
@@ -77,7 +77,7 @@ uninstall-pen-database:
61+
@echo "*** NOT uninstalling the IANA PEN database."
62+
@echo "*** It was installed manually (if ever)."
63+
64+
-#endif
65+
+endif
66+
67+
install-data-local: install-pen-database
68+
mkdir -p $(DESTDIR)$(DOCDIR)
69+
diff --git a/configure.ac b/configure.ac
70+
index b4321c6..d6ba62b 100644
71+
--- a/configure.ac
72+
+++ b/configure.ac
73+
@@ -56,22 +56,22 @@ if test "x$exec_prefix" = "xNONE"; then
74+
exec_prefix="$prefix"
75+
fi
76+
77+
-#if test "x$WGET" = "x"; then
78+
-# if test "x$CURL" = "x"; then
79+
-# AC_MSG_WARN([** Neither wget nor curl could be found.])
80+
-# AC_MSG_WARN([** IANA PEN database will not be installed by `make install` !])
81+
-# else
82+
-# DOWNLOAD="$CURL --location --progress-bar"
83+
-# AM_CONDITIONAL([DOWNLOAD], [true])
84+
-# fi
85+
-#else
86+
-# DOWNLOAD="$WGET -c -nd -O -"
87+
-# AM_CONDITIONAL([DOWNLOAD], [true])
88+
-#fi
89+
+if test "x$WGET" = "x"; then
90+
+ if test "x$CURL" = "x"; then
91+
+ AC_MSG_WARN([** Neither wget nor curl could be found.])
92+
+ AC_MSG_WARN([** IANA PEN database will not be installed by `make install` !])
93+
+ else
94+
+ DOWNLOAD="$CURL --location --progress-bar"
95+
+ AM_CONDITIONAL([DOWNLOAD], [true])
96+
+ fi
97+
+else
98+
+ DOWNLOAD="$WGET -c -nd -O -"
99+
+ AM_CONDITIONAL([DOWNLOAD], [true])
100+
+fi
101+
102+
-#AC_MSG_WARN([** Download is:])
103+
-#AC_MSG_WARN($DOWNLOAD)
104+
-#AC_SUBST(DOWNLOAD, $DOWNLOAD)
105+
+AC_MSG_WARN([** Download is:])
106+
+AC_MSG_WARN($DOWNLOAD)
107+
+AC_SUBST(DOWNLOAD, $DOWNLOAD)
108+
109+
dnl
110+
dnl set default option values
111+
--
112+
2.25.1
113+

src/ipmitool/patch/series

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0001-Changes-needed-to-install-enterprise.txt.patch

0 commit comments

Comments
 (0)