Skip to content

Commit 8093ab2

Browse files
VenkatCiscojudyjoseph
authored andcommitted
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 402b073 commit 8093ab2

File tree

4 files changed

+57
-8
lines changed

4 files changed

+57
-8
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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
NOJESSIE ?= 1
44
NOSTRETCH ?= 0
55

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

32-
clean configure reset showtag sonic-slave-build sonic-slave-bash :
53+
#
54+
# Function to invoke target $@ in Makefile.work with proper BLDENV
55+
#
56+
define make_work
3357
@echo "+++ Making $@ +++"
34-
ifeq ($(NOJESSIE), 0)
35-
make -f Makefile.work $@
36-
endif
37-
ifeq ($(NOSTRETCH), 0)
38-
BLDENV=stretch make -f Makefile.work $@
39-
endif
40-
BLDENV=buster make -f Makefile.work $@
58+
$(if $(BUILD_JESSIE),make -f Makefile.work $@,)
59+
$(if $(BUILD_STRETCH),BLDENV=stretch make -f Makefile.work $@,)
60+
$(if $(BUILD_BUSTER),BLDENV=buster make -f Makefile.work $@,)
61+
$(if $(BUILD_BULLSEYE),BLDENV=bullseye make -f Makefile.work $@,)
62+
endef
63+
64+
.PHONY: $(PLATFORM_PATH)
65+
66+
$(PLATFORM_PATH):
67+
@echo "+++ Cheking $@ +++"
68+
$(PLATFORM_CHECKOUT_CMD)
69+
70+
configure : $(PLATFORM_PATH)
71+
$(call make_work, $@)
72+
73+
clean reset showtag sonic-slave-build sonic-slave-bash :
74+
$(call make_work, $@)
4175

4276
# Freeze the versions, see more detail options: scripts/versions_manager.py freeze -h
4377
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)