Skip to content

Commit 702e852

Browse files
authored
Platform/cisco-8000 module for sonic-buildimage (#8172)
Why I did it Update Makefile, so it does the following: For a given platform, verify if platform/checkout/.ini exists and hence run the platform/checkout/template.j2. This allows platform code to be checked out during the 'make configure' stage. How I did it git clone [email protected]:Azure/sonic-buildimage.git mkdir platform/cisco-8000 make init make configure PLATFORM=cisco-8000 make all
1 parent c37f6ea commit 702e852

File tree

4 files changed

+57
-13
lines changed

4 files changed

+57
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ platform/broadcom/sonic-platform-modules-dell/s6100/modules/dell_s6100_lpc.c
7474
platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_ich.c
7575
platform/broadcom/sonic-platform-modules-dell/z9100/modules/dell_mailbox.c
7676
platform/broadcom/sonic-platform-modules-dell/z9264f/sonic_platform/ipmihelper.py
77+
platform/cisco-8000
7778

7879
# buildinfo
7980
files/build/buildinfo

Makefile

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ NOSTRETCH ?= 0
55
NOBUSTER ?= 0
66
NOBULLSEYE ?= 1
77

8+
ifeq ($(NOJESSIE),0)
9+
BUILD_JESSIE=1
10+
endif
11+
12+
ifeq ($(NOSTRETCH),0)
13+
BUILD_STRETCH=1
14+
endif
15+
16+
ifeq ($(NOBUSTER),0)
17+
BUILD_BUSTER=1
18+
endif
19+
20+
ifeq ($(NOBULLSEYE),0)
21+
BUILD_BULLSEYE=1
22+
endif
23+
24+
PLATFORM_PATH := platform/$(if $(PLATFORM),$(PLATFORM),$(CONFIGURED_PLATFORM))
25+
PLATFORM_CHECKOUT := platform/checkout
26+
PLATFORM_CHECKOUT_FILE := $(PLATFORM_CHECKOUT)/$(PLATFORM).ini
27+
PLATFORM_CHECKOUT_CMD := $(shell if [ -f $(PLATFORM_CHECKOUT_FILE) ]; then PLATFORM_PATH=$(PLATFORM_PATH) j2 $(PLATFORM_CHECKOUT)/template.j2 $(PLATFORM_CHECKOUT_FILE); fi)
28+
829
%::
930
@echo "+++ --- Making $@ --- +++"
1031
ifeq ($(NOJESSIE), 0)
@@ -42,20 +63,28 @@ init:
4263
@echo "+++ Making $@ +++"
4364
make -f Makefile.work $@
4465

45-
clean configure reset showtag sonic-slave-build sonic-slave-bash :
66+
#
67+
# Function to invoke target $@ in Makefile.work with proper BLDENV
68+
#
69+
define make_work
4670
@echo "+++ Making $@ +++"
47-
ifeq ($(NOJESSIE), 0)
48-
make -f Makefile.work $@
49-
endif
50-
ifeq ($(NOSTRETCH), 0)
51-
BLDENV=stretch make -f Makefile.work $@
52-
endif
53-
ifeq ($(NOBUSTER), 0)
54-
BLDENV=buster make -f Makefile.work $@
55-
endif
56-
ifeq ($(NOBULLSEYE), 0)
57-
BLDENV=bullseye make -f Makefile.work $@
58-
endif
71+
$(if $(BUILD_JESSIE),make -f Makefile.work $@,)
72+
$(if $(BUILD_STRETCH),BLDENV=stretch make -f Makefile.work $@,)
73+
$(if $(BUILD_BUSTER),BLDENV=buster make -f Makefile.work $@,)
74+
$(if $(BUILD_BULLSEYE),BLDENV=bullseye make -f Makefile.work $@,)
75+
endef
76+
77+
.PHONY: $(PLATFORM_PATH)
78+
79+
$(PLATFORM_PATH):
80+
@echo "+++ Cheking $@ +++"
81+
$(PLATFORM_CHECKOUT_CMD)
82+
83+
configure : $(PLATFORM_PATH)
84+
$(call make_work, $@)
85+
86+
clean reset showtag sonic-slave-build sonic-slave-bash :
87+
$(call make_work, $@)
5988

6089
# Freeze the versions, see more detail options: scripts/versions_manager.py freeze -h
6190
freeze:

platform/checkout/cisco-8000.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[module]
2+
repo[email protected]:Cisco-8000-sonic/platform-cisco-8000.git
3+
ref=v0.1

platform/checkout/template.j2

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{% set path = env('PLATFORM_PATH') %}
2+
if [ ! -d {{ path }} ]; then git clone {{ module.repo }} {{ path }}; fi;
3+
if [ -d {{ path }}/.git ]; then cd {{ path }} &&
4+
5+
{% if module.ref is defined %}
6+
git checkout {{ module.ref }} && git submodule update --init --recursive;
7+
{% else %}
8+
git submodule update --init --recursive;
9+
{% endif %}
10+
11+
else echo "{{ path }}/.git not found"; exit 1; fi

0 commit comments

Comments
 (0)