Skip to content

Instantly share code, notes, and snippets.

@CommitThis
Last active June 17, 2021 15:23
Show Gist options
  • Save CommitThis/bdbc852532115f6ac85e157be793e1f2 to your computer and use it in GitHub Desktop.
Save CommitThis/bdbc852532115f6ac85e157be793e1f2 to your computer and use it in GitHub Desktop.
Build ONLP manually
From a982850e4602a585ad2634032fa8f598b6999e50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eil=C3=ADs=20N=C3=AD=20Fhlannag=C3=A1in?=
<pidge@toganlabs.com>
Date: Tue, 17 Nov 2020 10:30:18 +0000
Subject: [PATCH] Makefile: Add FILTER from src to machine name
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Killing the alltargets bug
Signed-off-by: Eil<C3><AD>s N<C3><AD> Fhlannag<C3><A1>in <pidge@toganlabs.com>
---
.../platforms/stordis/x86-64/bf6064x-t/onlp/builds/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/platforms/stordis/x86-64/bf6064x-t/onlp/builds/Makefile b/packages/platforms/stordis/x86-64/bf6064x-t/onlp/builds/Makefile
index e7437cb2..a6d6da88 100755
--- a/packages/platforms/stordis/x86-64/bf6064x-t/onlp/builds/Makefile
+++ b/packages/platforms/stordis/x86-64/bf6064x-t/onlp/builds/Makefile
@@ -1,2 +1,2 @@
-FILTER=src
+FILTER=x86_64_stordis_bf6064x_t
include $(ONL)/make/subdirs.mk
--
2.29.2
From ad24649c0e13ca72afc8b25a39d6a5a4a389869b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eil=C3=ADs=20N=C3=AD=20Fhlannag=C3=A1in?=
<pidge@toganlabs.com>
Date: Wed, 15 Jul 2020 14:39:33 +0000
Subject: [PATCH] i2c: use libi2c for onlpdump and update headers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Eil<C3><AD>s N<C3><AD> Fhlannag<C3><A1>in <pidge@toganlabs.com>
---
packages/base/any/onlp/src/onlplib/module/inc/onlplib/i2c.h | 3 ++-
6 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/i2c.h b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/i2c.h
index 8af45370..45d9cf5b 100644
--- a/packages/base/any/onlp/src/onlplib/module/inc/onlplib/i2c.h
+++ b/packages/base/any/onlp/src/onlplib/module/inc/onlplib/i2c.h
@@ -352,7 +352,8 @@ extern onlp_i2c_mux_driver_t onlp_i2c_mux_driver_pca9548;
#if ONLPLIB_CONFIG_I2C_USE_CUSTOM_HEADER == 1
-#include <linux/i2c-devices.h>
+#include <i2c/smbus.h>
+#include <linux/i2c-dev.h>
#else
#include <linux/i2c-dev.h>
#endif
--
2.17.1
From 8e4460281f0f744611f71160a1b769dbec49445a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eil=C3=ADs=20N=C3=AD=20Fhlannag=C3=A1in?=
<pidge@toganlabs.com>
Date: Wed, 15 Jul 2020 14:08:07 +0000
Subject: [PATCH] i2c modules: use libi2c for onlpdump and update headers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Eil<C3><AD>s N<C3><AD> Fhlannag<C3><A1>in <pidge@toganlabs.com>
---
modules/OS/module/src/make.mk | 2 +-
modules/orc/module/src/drivers/veth/make.mk | 4 ++--
modules/sff/utest/Makefile | 2 +-
targets/utests/OS/posix/Makefile | 2 +-
targets/vpi/libvpi/Makefile | 4 ++--
targets/vpi/vpitool/Makefile | 2 +-
6 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/modules/OS/module/src/make.mk b/modules/OS/module/src/make.mk
index eb50f88..82fb1cb 100644
--- a/modules/OS/module/src/make.mk
+++ b/modules/OS/module/src/make.mk
@@ -29,7 +29,7 @@ ifeq ($(OS_MAKE_CONFIG_AUTOSELECT),1)
uname := $(shell uname -s)
ifeq ($(uname),Linux)
OS_CFLAGS += -DOS_CONFIG_INCLUDE_POSIX=1
- GLOBAL_LINK_LIBS += -lrt -lpthread
+ GLOBAL_LINK_LIBS += -lrt -li2c -lpthread
endif
ifeq ($(uname),Darwin)
OS_CFLAGS += -DOS_CONFIG_INCLUDE_OSX=1
diff --git a/modules/orc/module/src/drivers/veth/make.mk b/modules/orc/module/src/drivers/veth/make.mk
index 9e85113..c7da0fa 100644
--- a/modules/orc/module/src/drivers/veth/make.mk
+++ b/modules/orc/module/src/drivers/veth/make.mk
@@ -36,7 +36,7 @@ include $(BUILDER)/lib.mk
#
# include $(BUILDER)/targets.mk
#
-# #LDFLAGS += -lpthread -lrt
+# #LDFLAGS += -lpthread -lrt -li2c
# GLOBAL_CFLAGS += -fPIC
-#GLOBAL_LINK_LIBS += -lpcap -lrt
+#GLOBAL_LINK_LIBS += -lpcap -lrt -li2c
diff --git a/modules/sff/utest/Makefile b/modules/sff/utest/Makefile
index aa5a1d4..78c2605 100644
--- a/modules/sff/utest/Makefile
+++ b/modules/sff/utest/Makefile
@@ -11,5 +11,5 @@ GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
GLOBAL_CFLAGS += -DSFF_CONFIG_INCLUDE_EXT_CC_CHECK=1
GLOBAL_CFLAGS += -DSFF_CONFIG_INCLUDE_DATABASE=1
-GLOBAL_LINK_LIBS += -lrt -lpthread -lm
+GLOBAL_LINK_LIBS += -lrt -li2c -lpthread -lm
include $(BUILDER)/build-unit-test.mk
diff --git a/targets/utests/OS/posix/Makefile b/targets/utests/OS/posix/Makefile
index ff4a813..778a1bc 100644
--- a/targets/utests/OS/posix/Makefile
+++ b/targets/utests/OS/posix/Makefile
@@ -22,6 +22,6 @@ MODULE := OS_utest
TEST_MODULE := OS
DEPENDMODULES := AIM
GLOBAL_CFLAGS += -DOS_CONFIG_INCLUDE_POSIX=1
-GLOBAL_LINK_LIBS := -lpthread -lrt
+GLOBAL_LINK_LIBS := -lpthread -lrt -li2c
include $(BUILDER)/build-unit-test.mk
diff --git a/targets/vpi/libvpi/Makefile b/targets/vpi/libvpi/Makefile
index 1524ede..0b74389 100644
--- a/targets/vpi/libvpi/Makefile
+++ b/targets/vpi/libvpi/Makefile
@@ -37,11 +37,11 @@ include $(BUILDER)/so.mk
include $(BUILDER)/targets.mk
-LDFLAGS += -lpthread -lrt
+LDFLAGS += -lpthread -lrt -li2c
# TODO use pkg-config
GLOBAL_CFLAGS += -fPIC
-GLOBAL_LINK_LIBS += -lpcap -lrt
+GLOBAL_LINK_LIBS += -lpcap -lrt -li2c
.DEFAULT_GOAL := all
diff --git a/targets/vpi/vpitool/Makefile b/targets/vpi/vpitool/Makefile
index 96b31be..bc4acd1 100644
--- a/targets/vpi/vpitool/Makefile
+++ b/targets/vpi/vpitool/Makefile
@@ -52,7 +52,7 @@ GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -DOS_CONFIG_INCLUDE_POSIX=1
-GLOBAL_LINK_LIBS += -lrt
+GLOBAL_LINK_LIBS += -lrt -li2c
ucli:
../../tools/uclihandlers.py main.c
--
2.17.1
ONL=/root/APSN-ONL
cd $ONL
git reset --hard
git clean -xfd
cd packages/platforms
rm -rf accton alphanetworks celestica dell dellemc delta ingrasys inventec kvm \
lenovo mellanox mitac netberg nxp qemu quanta wnc
cd $ONL
rm -rf sm
export WORKDIR=${ONL}
export ONIE_VENDOR=stordis
export ONL_ARCH=x86-64
export ONL_MACHINE=bf6064x-t
# The ONL package dir is here:
#export ONLPM_OPTION_PACKAGEDIRS="$ONL/packages:$ONL/builds"
#export ONLPM_OPTION_REPO="$ONL/REPO"
#export ONLPM_OPTION_RELEASE_DIR="$ONL/RELEASE"
export PATH="$ONL/tools/scripts:$ONL/tools:$PATH"
export ONL_MAKE_PARALLEL=-j$(echo "$(nproc) * 2" | bc)
mkdir sm
cd sm
git clone git://github.com/floodlight/infra.git
cd infra
git checkout 16ce9cd77f6639aac4813d698f9dd11f3ee47e7a
cd ..
git clone git://github.com/floodlight/bigcode.git
cd bigcode
git checkout 94091600faa76fac492b4be2ffab17cb9788d697
cd $ONL
#$ONL/tools/submodules.py $ONL sm/infra
#$ONL/tools/submodules.py $ONL sm/bigcode
#$ONL/tools/submodules.py $ONL sm/build-artifacts
export SUBMODULE_INFRA="${ONL}/sm/infra"
export SUBMODULE_BIGCODE="${ONL}/sm/bigcode"
export BUILDER="${SUBMODULE_INFRA}/builder/unix"
export BUILDER_MODULE_DATABASE="${ONL}/modules/modules.json"
export BUILDER_MODULE_DATABASE_ROOT="${ONL}"
export BUILDER_MODULE_MANIFEST="${ONL}/modules/modules.mk"
mkdir -p $(dirname ${BUILDER_MODULE_DATABASE})
export MODULEMANIFEST=$(${BUILDER}/tools/modtool.py \
--db ${BUILDER_MODULE_DATABASE} \
--dbroot ${BUILDER_MODULE_DATABASE_ROOT} \
--make-manifest ${BUILDER_MODULE_MANIFEST})
export CC=gcc
#export CFLAGS="-Wno-error -Wno-error=restrict -Wno-error=format-overflow -Wno-error=cpp -lm -Wl,z,now"
export CFLAGS="-Wno-error=restrict -Wno-error=format-overflow" # -Wno-error -Wno-error=cpp"
export NO_USE_GCC_VERSION_TOOL=1
export TOOLCHAIN=x86_64-linux-gnu
export ONL_DEBIAN_SUITE=mion
read -r -d '' MAKE_ARGS << EOF
VERBOSE=0 \
AR=ar \
ARCH=amd64 \
BUILDER=${BUILDER} \
BUILDER_MODULE_DATABASE=${BUILDER_MODULE_DATABASE} \
BUILDER_MODULE_DATABASE_ROOT=${BUILDER_MODULE_DATABASE_ROOT} \
BUILDER_MODULE_MANIFEST=${BUILDER_MODULE_MANIFEST} \
MODULEMANIFEST=${MODULEMANIFEST} \
GCC=${CC} \
ONL=${ONL} \
ONL_DEBIAN_SUITE=${ONL_DEBIAN_SUITE} \
SUBMODULE_BIGCODE=${SUBMODULE_BIGCODE} \
SUBMODULE_INFRA=${SUBMODULE_INFRA} \
TOOLCHAIN=${TOOLCHAIN}
EOF
# NO_USE_GCC_VERSION_TOOL=${NO_USE_GCC_VERSION_TOOL} \
# TOOLCHAIN=${TOOLCHAIN}
# Patches
# =============================================
cp ../bf6064-i2c.patch .
cp ../bf6064-filter.patch .
cp ../bigcode-i2c.patch .
cp ../infra-i2c.patch .
cp ../remove-irq-debug.patch .
patch -p1 -d ${SUBMODULE_BIGCODE} < bigcode-i2c.patch
patch -p1 -d ${SUBMODULE_INFRA}< infra-i2c.patch
patch -p1 < bf6064-filter.patch
patch -p1 < bf6064-i2c.patch
patch -p1 < remove-irq-debug.patch
# Building
# ==========================================
make -C packages/base/any/onlp/builds -j ${ONL_MAKE_PARALLEL} ${MAKE_ARGS} GCC_FLAGS="${CFLAGS}" alltargets
make -C packages/base/any/onlp/builds/onlpd -j ${ONL_MAKE_PARALLEL} ${MAKE_ARGS} GCC_FLAGS="${CFLAGS}" alltargets
# Has errors that have been excluded via CFLAGS in mion recipe
make -C packages/platforms/${ONIE_VENDOR}/${ONL_ARCH}/${ONL_MACHINE}/onlp/builds \
-j ${ONL_MAKE_PARALLEL} ${MAKE_ARGS} GCC_FLAGS="${CFLAGS}" alltargets
rm /usr/lib/libonlp-platform-defaults.so.1
rm /usr/lib/libonlp-platform-defaults.so
rm /usr/lib/libonlp.so.1
rm /usr/lib/libonlp.so
rm /usr/lib/libonlp-platform.so.1
rm /usr/lib/libonlp-x86-64-stordis-bf6064x-t.so.1
rm /usr/lib/libonlp-x86-64-stordis-bf6064x-t.so
rm /bin/onlpd -f # Don't care if doesn't exist
rm /usr/bin/onlps -f # Don't care if doesn't exist
cp ./packages/base/any/onlp/builds/onlpd/BUILD/mion/${TOOLCHAIN}/bin/onlpd /bin/onlpd
cp ./packages/platforms/stordis/x86-64/bf6064x-t/onlp/builds/onlpdump/BUILD/mion/${TOOLCHAIN}/bin/onlps /usr/bin/onlps
cp ./packages/base/any/onlp/builds/onlp-platform-defaults/BUILD/mion/${TOOLCHAIN}/bin/libonlp-platform-defaults.so /usr/lib/libonlp-platform-defaults.so.1
cp ./packages/platforms/stordis/x86-64/bf6064x-t/onlp/builds/lib/BUILD/mion/${TOOLCHAIN}/bin/libonlp-x86-64-stordis-bf6064x-t.so /usr/lib/libonlp-x86-64-stordis-bf6064x-t.so.1
cp ./packages/base/any/onlp/builds/onlp/BUILD/mion/${TOOLCHAIN}/bin/libonlp.so /usr/lib/libonlp.so.1
ln -s /usr/lib/libonlp-platform-defaults.so.1 /usr/lib/libonlp-platform-defaults.so
ln -s /usr/lib/libonlp-x86-64-stordis-bf6064x-t.so.1 /usr/lib/libonlp-platform.so.1
ln -s /usr/lib/libonlp-x86-64-stordis-bf6064x-t.so.1 /usr/lib/libonlp-x86-64-stordis-bf6064x-t.so
ln -s /usr/lib/libonlp.so.1 /usr/lib/libonlp.so
onlpd -h
From 10de86bf52144b4cde1298e633859a5e4beeec31 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eil=C3=ADs=20N=C3=AD=20Fhlannag=C3=A1in?=
<pidge@toganlabs.com>
Date: Wed, 15 Jul 2020 14:09:45 +0000
Subject: [PATCH] i2c: infra use libi2c for onlpdump and update headers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Eil<C3><AD>s N<C3><AD> Fhlannag<C3><A1>in <pidge@toganlabs.com>
---
targets/utests/AIM/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/targets/utests/AIM/Makefile b/targets/utests/AIM/Makefile
index 0ad6977..bd3aac6 100644
--- a/targets/utests/AIM/Makefile
+++ b/targets/utests/AIM/Makefile
@@ -24,7 +24,7 @@ TEST_MODULE := AIM
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_POSIX=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
-GLOBAL_LINK_LIBS += -lpthread -lrt
+GLOBAL_LINK_LIBS += -lpthread -lrt -li2c
PEDANTIC := 1
include $(BUILDER)/build-unit-test.mk
--
2.17.1
diff --git a/packages/platforms/stordis/x86-64/bf6064x-t/platform-config/r0/src/python/x86_64_stordis_bf6064x_t_r0/__init__.py b/packages/platforms/stordis/x86-64/bf6064x-t/platform-config/r0/src/python/x86_64_stordis_bf6064x_t_r0/__init__.py
index be64b848..bd0ca96d 100755
--- a/packages/platforms/stordis/x86-64/bf6064x-t/platform-config/r0/src/python/x86_64_stordis_bf6064x_t_r0/__init__.py
+++ b/packages/platforms/stordis/x86-64/bf6064x-t/platform-config/r0/src/python/x86_64_stordis_bf6064x_t_r0/__init__.py
@@ -9,5 +9,4 @@ class OnlPlatform_x86_64_stordis_bf6064x_t_r0(OnlPlatformStordis,
SYS_OBJECT_ID = ".6064"
def baseconfig(self):
- self.insmod('irq_debug')
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment