2021-02-24 18:45:27 -06:00
|
|
|
PWD = $(shell pwd)
|
|
|
|
CC ?=gcc
|
|
|
|
INSTALL_MOD_DIR ?=extra
|
|
|
|
KVERSION ?= $(shell uname -r)
|
|
|
|
KERNEL_SRC ?= /lib/modules/$(KVERSION)
|
|
|
|
EXTRA_CFLAGS:= -I$(M)/include
|
|
|
|
EXTRA_CFLAGS+= -Wall
|
|
|
|
SUB_BUILD_DIR = $(PWD)/build
|
|
|
|
DIR_KERNEL_SRC = $(PWD)/modules
|
|
|
|
SCRIPT_DIR = $(PWD)/script
|
|
|
|
SERVICE_DIR = $(PWD)/service
|
[ruijie] Fix show version error info (#7541)
Fix following crash in `show version`:
```
Traceback (most recent call last):
File "/usr/local/bin/decode-syseeprom", line 32, in instantiate_eeprom_object
eeprom = sonic_platform.platform.Platform().get_chassis().get_eeprom()
AttributeError: module 'sonic_platform' has no attribute 'platform'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/decode-syseeprom", line 262, in <module>
sys.exit(main())
File "/usr/local/bin/decode-syseeprom", line 244, in main
print_serial(use_db)
File "/usr/local/bin/decode-syseeprom", line 169, in print_serial
eeprom = instantiate_eeprom_object()
File "/usr/local/bin/decode-syseeprom", line 34, in instantiate_eeprom_object
log.log_error('Failed to obtain EEPROM object due to {}'.format(repr(e)))
NameError: name 'log' is not defined
```
Signed-off-by: pettershao-ragilenetworks <pettershao@ragilenetworks.com>
2021-05-06 16:53:20 -05:00
|
|
|
DEPMOD_CONF_DIR = $(PWD)/depmod_conf
|
2021-02-24 18:45:27 -06:00
|
|
|
|
|
|
|
KBUILD_EXTRA_SYMBOLS += $(DIR_KERNEL_SRC)/Module.symvers
|
|
|
|
export KBUILD_EXTRA_SYMBOLS
|
|
|
|
|
|
|
|
INSTALL_MODULE_DIR = $(SUB_BUILD_DIR)/$(KERNEL_SRC)/$(INSTALL_MOD_DIR)
|
|
|
|
INSTALL_SCRIPT_DIR = $(SUB_BUILD_DIR)/usr/local/bin
|
|
|
|
INSTALL_SERVICE_DIR = $(SUB_BUILD_DIR)/lib/systemd/system
|
|
|
|
INSTALL_LIB_DIR = $(SUB_BUILD_DIR)/usr/lib/python3.7/dist-packages
|
[ruijie] Fix show version error info (#7541)
Fix following crash in `show version`:
```
Traceback (most recent call last):
File "/usr/local/bin/decode-syseeprom", line 32, in instantiate_eeprom_object
eeprom = sonic_platform.platform.Platform().get_chassis().get_eeprom()
AttributeError: module 'sonic_platform' has no attribute 'platform'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/decode-syseeprom", line 262, in <module>
sys.exit(main())
File "/usr/local/bin/decode-syseeprom", line 244, in main
print_serial(use_db)
File "/usr/local/bin/decode-syseeprom", line 169, in print_serial
eeprom = instantiate_eeprom_object()
File "/usr/local/bin/decode-syseeprom", line 34, in instantiate_eeprom_object
log.log_error('Failed to obtain EEPROM object due to {}'.format(repr(e)))
NameError: name 'log' is not defined
```
Signed-off-by: pettershao-ragilenetworks <pettershao@ragilenetworks.com>
2021-05-06 16:53:20 -05:00
|
|
|
INSTALL_DEPMOD_CONF = $(SUB_BUILD_DIR)/etc/depmod.d
|
2021-02-24 18:45:27 -06:00
|
|
|
|
|
|
|
all:
|
|
|
|
$(MAKE) -C $(KERNEL_SRC)/build M=$(DIR_KERNEL_SRC) modules
|
|
|
|
@if [ ! -d ${INSTALL_MODULE_DIR} ]; then mkdir -p ${INSTALL_MODULE_DIR} ;fi
|
|
|
|
@if [ ! -d ${INSTALL_SCRIPT_DIR} ]; then mkdir -p ${INSTALL_SCRIPT_DIR} ;fi
|
|
|
|
@if [ ! -d ${INSTALL_SERVICE_DIR} ]; then mkdir -p ${INSTALL_SERVICE_DIR} ;fi
|
|
|
|
@if [ ! -d ${INSTALL_LIB_DIR} ]; then mkdir -p ${INSTALL_LIB_DIR} ;fi
|
|
|
|
@if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR} ;fi
|
|
|
|
@if [ -d $(PWD)/lib/ ]; then cp -r $(PWD)/lib/* ${INSTALL_LIB_DIR2} ;fi
|
|
|
|
cp -r $(DIR_KERNEL_SRC)/*.ko $(INSTALL_MODULE_DIR)
|
[ruijie] Fix show version error info (#7541)
Fix following crash in `show version`:
```
Traceback (most recent call last):
File "/usr/local/bin/decode-syseeprom", line 32, in instantiate_eeprom_object
eeprom = sonic_platform.platform.Platform().get_chassis().get_eeprom()
AttributeError: module 'sonic_platform' has no attribute 'platform'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/decode-syseeprom", line 262, in <module>
sys.exit(main())
File "/usr/local/bin/decode-syseeprom", line 244, in main
print_serial(use_db)
File "/usr/local/bin/decode-syseeprom", line 169, in print_serial
eeprom = instantiate_eeprom_object()
File "/usr/local/bin/decode-syseeprom", line 34, in instantiate_eeprom_object
log.log_error('Failed to obtain EEPROM object due to {}'.format(repr(e)))
NameError: name 'log' is not defined
```
Signed-off-by: pettershao-ragilenetworks <pettershao@ragilenetworks.com>
2021-05-06 16:53:20 -05:00
|
|
|
@if [ ! -d ${INSTALL_DEPMOD_CONF} ]; then mkdir -p ${INSTALL_DEPMOD_CONF} ;fi
|
|
|
|
cp -r $(DEPMOD_CONF_DIR)/* $(INSTALL_DEPMOD_CONF)
|
2021-02-24 18:45:27 -06:00
|
|
|
cp -r $(SCRIPT_DIR)/* $(INSTALL_SCRIPT_DIR)
|
|
|
|
cp -r $(SERVICE_DIR)/* $(INSTALL_SERVICE_DIR)
|
|
|
|
@if [ -d $(INSTALL_SCRIPT_DIR) ]; then chmod +x $(INSTALL_SCRIPT_DIR)/* ;fi
|
|
|
|
clean:
|
|
|
|
rm -f ${DIR_KERNEL_SRC}/*.o ${DIR_KERNEL_SRC}/*.ko ${DIR_KERNEL_SRC}/*.mod.c ${DIR_KERNEL_SRC}/.*.cmd
|
|
|
|
rm -f ${DIR_KERNEL_SRC}/Module.markers ${DIR_KERNEL_SRC}/Module.symvers ${DIR_KERNEL_SRC}/modules.order
|
|
|
|
rm -rf ${DIR_KERNEL_SRC}/.tmp_versions
|
|
|
|
rm -rf $(SUB_BUILD_DIR)
|