12fe4e5f8Sopenharmony_ci# Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED.
22fe4e5f8Sopenharmony_ci#
32fe4e5f8Sopenharmony_ci# This program is free software; you can redistribute it and/or
42fe4e5f8Sopenharmony_ci# modify it under the terms of the GNU General Public License
52fe4e5f8Sopenharmony_ci# as published by the Free Software Foundation; either version 2
62fe4e5f8Sopenharmony_ci# of the License, or (at your option) any later version.
72fe4e5f8Sopenharmony_ci#
82fe4e5f8Sopenharmony_ci# This program is distributed in the hope that it will be useful,
92fe4e5f8Sopenharmony_ci# but WITHOUT ANY WARRANTY; without even the implied warranty of
102fe4e5f8Sopenharmony_ci# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
112fe4e5f8Sopenharmony_ci# GNU General Public License for more details.
122fe4e5f8Sopenharmony_ci#
132fe4e5f8Sopenharmony_ci# You should have received a copy of the GNU General Public License
142fe4e5f8Sopenharmony_ci# along with this program; if not, write to the Free Software
152fe4e5f8Sopenharmony_ci# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
162fe4e5f8Sopenharmony_ci
172fe4e5f8Sopenharmony_ci.PHONY:all
182fe4e5f8Sopenharmony_ci#export MACH
192fe4e5f8Sopenharmony_ci
202fe4e5f8Sopenharmony_ciBIT_WIDTH:=$(shell getconf LONG_BIT)
212fe4e5f8Sopenharmony_ci
222fe4e5f8Sopenharmony_ciifeq ($(BIT_WIDTH),64)
232fe4e5f8Sopenharmony_ciMACH:=m64
242fe4e5f8Sopenharmony_cielse
252fe4e5f8Sopenharmony_ciMACH:=m32
262fe4e5f8Sopenharmony_ciendif
272fe4e5f8Sopenharmony_ci
282fe4e5f8Sopenharmony_ciall: ddrinit rsa2048pem_gen rsa4096pem_gen
292fe4e5f8Sopenharmony_ciddrinit:
302fe4e5f8Sopenharmony_ci	pushd ddr_init;make;./mkddrinit.sh u-boot-original.bin;popd
312fe4e5f8Sopenharmony_ci	cp ./ddr_init/ddr_init_reg_info.bin ./
322fe4e5f8Sopenharmony_ci
332fe4e5f8Sopenharmony_cirsa2048pem_gen: ddrinit
342fe4e5f8Sopenharmony_ci	./rsa2048pem.sh
352fe4e5f8Sopenharmony_ci	sh create_secure_boot.sh rsa2048pem_gen
362fe4e5f8Sopenharmony_ci
372fe4e5f8Sopenharmony_cirsa4096pem_gen: ddrinit
382fe4e5f8Sopenharmony_ci	./rsa4096pem.sh
392fe4e5f8Sopenharmony_ci	sh create_secure_boot.sh rsa4096pem_gen
402fe4e5f8Sopenharmony_ci
412fe4e5f8Sopenharmony_ciclean:
422fe4e5f8Sopenharmony_ci	pushd ddr_init;make clean;popd
432fe4e5f8Sopenharmony_ci	find . -name "*.bin" -exec rm -rf {} \;
442fe4e5f8Sopenharmony_cidistclean:clean
452fe4e5f8Sopenharmony_ci	rm rsa2048pem/*
462fe4e5f8Sopenharmony_ci	rm rsa4096pem/*
472fe4e5f8Sopenharmony_ci	rm -rf aes_otp_cfg.txt
48