Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 1 | ################################################################################ |
| 2 | # Following variables defines how the NS_USER (Non Secure User - Client |
| 3 | # Application), NS_KERNEL (Non Secure Kernel), S_KERNEL (Secure Kernel) and |
| 4 | # S_USER (Secure User - TA) are compiled |
| 5 | ################################################################################ |
| 6 | COMPILE_NS_USER ?= 64 |
| 7 | override COMPILE_NS_KERNEL := 64 |
| 8 | COMPILE_S_USER ?= 32 |
| 9 | COMPILE_S_KERNEL ?= 64 |
| 10 | |
| 11 | # Normal and secure world console UART: 6 (v2 or newer board) or 5 (v1 board) |
| 12 | CFG_CONSOLE_UART ?= 6 |
Jens Wiklander | 5a098ec | 2018-04-26 09:54:42 +0200 | [diff] [blame] | 13 | # Needed by buildroot |
| 14 | CFG_NW_CONSOLE_UART ?= $(CFG_CONSOLE_UART) |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 15 | |
Jerome Forissier | 03b920b | 2019-10-01 18:53:23 +0200 | [diff] [blame] | 16 | # To enable Wi-Fi on HiKey960: |
| 17 | # 1. Set the network name (SSID) and password in |
| 18 | # $(BR2_ROOTFS_OVERLAY)/etc/wpa_supplicant.conf before building |
| 19 | # 2. Boot the board, login as root and run: ifup wlan0 |
| 20 | BR2_PACKAGE_LINUX_FIRMWARE = y |
| 21 | BR2_PACKAGE_LINUX_FIRMWARE_TI_WL18XX = y |
| 22 | BR2_PACKAGE_WPA_SUPPLICANT = y |
| 23 | BR2_PACKAGE_WIRELESS_REGDB = y |
| 24 | |
| 25 | BR2_ROOTFS_OVERLAY = $(ROOT)/build/br-ext/board/hikey960/overlay |
| 26 | |
Etienne Carriere | 3768a2b | 2019-05-14 17:13:19 +0200 | [diff] [blame] | 27 | OPTEE_OS_PLATFORM = hikey-hikey960 |
| 28 | |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 29 | ################################################################################ |
| 30 | # Includes |
| 31 | ################################################################################ |
Victor Chong | 7a71651 | 2017-09-11 15:18:44 +0100 | [diff] [blame] | 32 | include common.mk |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 33 | |
| 34 | ################################################################################ |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 35 | # Paths to git projects and various binaries |
| 36 | ################################################################################ |
Victor Chong | df54b11 | 2019-08-11 15:58:12 +0100 | [diff] [blame] | 37 | TF_A_PATH ?= $(ROOT)/trusted-firmware-a |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 38 | ifeq ($(DEBUG),1) |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 39 | TF_A_BUILD ?= debug |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 40 | else |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 41 | TF_A_BUILD ?= release |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 42 | endif |
| 43 | |
| 44 | EDK2_PATH ?= $(ROOT)/edk2 |
| 45 | ifeq ($(DEBUG),1) |
| 46 | EDK2_BUILD ?= DEBUG |
| 47 | else |
| 48 | EDK2_BUILD ?= RELEASE |
| 49 | endif |
| 50 | EDK2_BIN ?= $(EDK2_PATH)/Build/HiKey960/$(EDK2_BUILD)_$(EDK2_TOOLCHAIN)/FV/BL33_AP_UEFI.fd |
| 51 | OPENPLATPKG_PATH ?= $(ROOT)/OpenPlatformPkg |
| 52 | |
| 53 | OUT_PATH ?=$(ROOT)/out |
| 54 | MCUIMAGE_BIN ?= $(OPENPLATPKG_PATH)/Platforms/Hisilicon/HiKey960/Binary/lpm3.img |
| 55 | BOOT_IMG ?=$(ROOT)/out/boot-fat.uefi.img |
| 56 | GRUB_PATH ?=$(ROOT)/grub |
| 57 | LLOADER_PATH ?=$(ROOT)/l-loader |
| 58 | IMAGE_TOOLS_PATH ?=$(ROOT)/tools-images-hikey960 |
| 59 | IMAGE_TOOLS_CONFIG ?=$(OUT_PATH)/config |
| 60 | PATCHES_PATH ?=$(ROOT)/patches_hikey |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 61 | |
| 62 | ################################################################################ |
| 63 | # Targets |
| 64 | ################################################################################ |
| 65 | .PHONY: all |
Victor Chong | 86840a4 | 2017-10-28 13:01:33 +0100 | [diff] [blame] | 66 | all: arm-tf boot-img lloader |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 67 | |
| 68 | .PHONY: clean |
Jens Wiklander | 5a098ec | 2018-04-26 09:54:42 +0200 | [diff] [blame] | 69 | clean: arm-tf-clean buildroot-clean edk2-clean linux-clean optee-os-clean \ |
| 70 | boot-img-clean lloader-clean grub-clean |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 71 | |
| 72 | .PHONY: cleaner |
Jens Wiklander | 5a098ec | 2018-04-26 09:54:42 +0200 | [diff] [blame] | 73 | cleaner: clean prepare-cleaner buildroot-cleaner linux-cleaner grub-cleaner |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 74 | |
Victor Chong | 7a71651 | 2017-09-11 15:18:44 +0100 | [diff] [blame] | 75 | include toolchain.mk |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 76 | |
| 77 | .PHONY: prepare |
| 78 | prepare: |
| 79 | mkdir -p $(OUT_PATH) |
| 80 | |
| 81 | .PHONY: prepare-cleaner |
| 82 | prepare-cleaner: |
| 83 | rm -rf $(ROOT)/out |
| 84 | |
| 85 | ################################################################################ |
| 86 | # ARM Trusted Firmware |
| 87 | ################################################################################ |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 88 | TF_A_EXPORTS ?= \ |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 89 | CROSS_COMPILE="$(CCACHE)$(AARCH64_CROSS_COMPILE)" |
| 90 | |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 91 | TF_A_FLAGS ?= \ |
Victor Chong | 865d775 | 2017-08-24 04:53:07 +0100 | [diff] [blame] | 92 | BL32=$(OPTEE_OS_HEADER_V2_BIN) \ |
| 93 | BL32_EXTRA1=$(OPTEE_OS_PAGER_V2_BIN) \ |
| 94 | BL32_EXTRA2=$(OPTEE_OS_PAGEABLE_V2_BIN) \ |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 95 | BL33=$(EDK2_BIN) \ |
| 96 | SCP_BL2=$(MCUIMAGE_BIN) \ |
| 97 | DEBUG=$(DEBUG) \ |
| 98 | PLAT=hikey960 \ |
| 99 | SPD=opteed |
| 100 | |
| 101 | ifeq ($(CFG_CONSOLE_UART),5) |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 102 | TF_A_FLAGS += CRASH_CONSOLE_BASE=PL011_UART5_BASE |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 103 | endif |
| 104 | |
| 105 | .PHONY: arm-tf |
| 106 | arm-tf: optee-os edk2 |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 107 | $(TF_A_EXPORTS) $(MAKE) -C $(TF_A_PATH) $(TF_A_FLAGS) all fip |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 108 | |
| 109 | .PHONY: arm-tf-clean |
| 110 | arm-tf-clean: |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 111 | $(TF_A_EXPORTS) $(MAKE) -C $(TF_A_PATH) $(TF_A_FLAGS) clean |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 112 | |
| 113 | ################################################################################ |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 114 | # EDK2 / Tianocore |
| 115 | ################################################################################ |
| 116 | EDK2_ARCH ?= AARCH64 |
| 117 | EDK2_DSC ?= OpenPlatformPkg/Platforms/Hisilicon/HiKey960/HiKey960.dsc |
| 118 | EDK2_TOOLCHAIN ?= GCC49 |
| 119 | |
| 120 | ifeq ($(CFG_CONSOLE_UART),5) |
| 121 | EDK2_BUILDFLAGS += -DSERIAL_BASE=0xFDF05000 |
| 122 | endif |
| 123 | |
| 124 | define edk2-call |
Joakim Bech | d1a05e3 | 2018-05-23 08:36:52 +0200 | [diff] [blame] | 125 | $(EDK2_TOOLCHAIN)_$(EDK2_ARCH)_PREFIX=$(AARCH64_CROSS_COMPILE) \ |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 126 | build -n `getconf _NPROCESSORS_ONLN` -a $(EDK2_ARCH) \ |
| 127 | -t $(EDK2_TOOLCHAIN) -p $(EDK2_DSC) \ |
| 128 | -b $(EDK2_BUILD) $(EDK2_BUILDFLAGS) |
| 129 | endef |
| 130 | |
| 131 | .PHONY: edk2 |
| 132 | edk2: |
Jerome Forissier | 064b4b0 | 2023-07-05 15:50:03 +0200 | [diff] [blame] | 133 | sed -i 's/\(^DEFINE GCC_ALL_CC_FLAGS.*-Wno-array-bounds\) -include/\1 -Wno-stringop-overflow -include/' $(EDK2_PATH)/BaseTools/Conf/tools_def.template |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 134 | cd $(EDK2_PATH) && rm -rf OpenPlatformPkg && \ |
| 135 | ln -s $(OPENPLATPKG_PATH) |
| 136 | set -e && cd $(EDK2_PATH) && source edksetup.sh && \ |
Jerome Forissier | 46f7be2 | 2019-12-11 15:25:39 +0100 | [diff] [blame] | 137 | $(MAKE) -j1 -C $(EDK2_PATH)/BaseTools \ |
Jerome Forissier | f342db9 | 2020-01-07 18:19:46 +0100 | [diff] [blame] | 138 | BUILD_CC="gcc $(call cc-option,gcc,-Wno-error=stringop-truncation,)" && \ |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 139 | $(call edk2-call) |
| 140 | |
| 141 | .PHONY: edk2-clean |
| 142 | edk2-clean: |
| 143 | set -e && cd $(EDK2_PATH) && source edksetup.sh && \ |
| 144 | $(call edk2-call) cleanall && \ |
| 145 | $(MAKE) -j1 -C $(EDK2_PATH)/BaseTools clean |
| 146 | rm -rf $(EDK2_PATH)/Build |
| 147 | rm -rf $(EDK2_PATH)/Conf/.cache |
| 148 | rm -f $(EDK2_PATH)/Conf/build_rule.txt |
| 149 | rm -f $(EDK2_PATH)/Conf/target.txt |
| 150 | rm -f $(EDK2_PATH)/Conf/tools_def.txt |
| 151 | |
| 152 | ################################################################################ |
| 153 | # Linux kernel |
| 154 | ################################################################################ |
| 155 | LINUX_DEFCONFIG_COMMON_ARCH ?= arm64 |
| 156 | LINUX_DEFCONFIG_COMMON_FILES ?= $(LINUX_PATH)/arch/arm64/configs/defconfig \ |
| 157 | $(CURDIR)/kconfigs/hikey960.conf \ |
| 158 | $(PATCHES_PATH)/kernel_config/usb_net_dm9601.conf \ |
| 159 | $(PATCHES_PATH)/kernel_config/ftrace.conf |
| 160 | |
| 161 | .PHONY: linux-defconfig |
| 162 | linux-defconfig: $(LINUX_PATH)/.config |
| 163 | |
| 164 | .PHONY: linux-gen_init_cpio |
| 165 | linux-gen_init_cpio: linux-defconfig |
| 166 | $(MAKE) -C $(LINUX_PATH)/usr \ |
| 167 | CROSS_COMPILE=$(CROSS_COMPILE_NS_KERNEL) \ |
| 168 | ARCH=arm64 \ |
| 169 | LOCALVERSION= \ |
| 170 | gen_init_cpio |
| 171 | |
Jens Wiklander | 41207ba | 2024-01-30 16:58:47 +0100 | [diff] [blame] | 172 | LINUX_COMMON_FLAGS += ARCH=arm64 |
| 173 | LINUX_COMMON_TARGETS += Image hisilicon/hi3660-hikey960.dtb |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 174 | |
| 175 | .PHONY: linux |
| 176 | linux: linux-common |
| 177 | |
| 178 | .PHONY: linux-defconfig-clean |
| 179 | linux-defconfig-clean: linux-defconfig-clean-common |
| 180 | |
| 181 | LINUX_CLEAN_COMMON_FLAGS += ARCH=arm64 |
| 182 | |
| 183 | .PHONY: linux-clean |
| 184 | linux-clean: linux-clean-common |
| 185 | |
| 186 | LINUX_CLEANER_COMMON_FLAGS += ARCH=arm64 |
| 187 | |
| 188 | .PHONY: linux-cleaner |
| 189 | linux-cleaner: linux-cleaner-common |
| 190 | |
| 191 | ################################################################################ |
| 192 | # OP-TEE |
| 193 | ################################################################################ |
Etienne Carriere | 3768a2b | 2019-05-14 17:13:19 +0200 | [diff] [blame] | 194 | OPTEE_OS_COMMON_FLAGS += CFG_CONSOLE_UART=$(CFG_CONSOLE_UART) |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 195 | |
| 196 | .PHONY: optee-os |
| 197 | optee-os: optee-os-common |
| 198 | |
| 199 | .PHONY: optee-os-clean |
| 200 | optee-os-clean: optee-os-clean-common |
| 201 | |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 202 | ################################################################################ |
| 203 | # grub |
| 204 | ################################################################################ |
| 205 | grub-flags := CC="$(CCACHE)gcc" \ |
| 206 | TARGET_CC="$(AARCH64_CROSS_COMPILE)gcc" \ |
| 207 | TARGET_OBJCOPY="$(AARCH64_CROSS_COMPILE)objcopy" \ |
| 208 | TARGET_NM="$(AARCH64_CROSS_COMPILE)nm" \ |
| 209 | TARGET_RANLIB="$(AARCH64_CROSS_COMPILE)ranlib" \ |
Jens Wiklander | 3b5d8f0 | 2018-06-27 09:16:24 +0200 | [diff] [blame] | 210 | TARGET_STRIP="$(AARCH64_CROSS_COMPILE)strip" \ |
| 211 | --disable-werror |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 212 | |
| 213 | GRUB_MODULES += boot chain configfile echo efinet eval ext2 fat font gettext \ |
| 214 | gfxterm gzio help linux loadenv lsefi normal part_gpt \ |
| 215 | part_msdos read regexp search search_fs_file search_fs_uuid \ |
| 216 | search_label terminal terminfo test tftp time |
| 217 | |
| 218 | $(GRUB_PATH)/configure: $(GRUB_PATH)/configure.ac |
| 219 | cd $(GRUB_PATH) && ./autogen.sh |
| 220 | |
| 221 | $(GRUB_PATH)/Makefile: $(GRUB_PATH)/configure |
| 222 | cd $(GRUB_PATH) && ./configure --target=aarch64 --enable-boot-time $(grub-flags) |
| 223 | |
| 224 | .PHONY: grub |
| 225 | grub: prepare $(GRUB_PATH)/Makefile |
| 226 | $(MAKE) -C $(GRUB_PATH); \ |
| 227 | cd $(GRUB_PATH) && ./grub-mkimage \ |
| 228 | --verbose \ |
| 229 | --output=$(OUT_PATH)/grubaa64.efi \ |
| 230 | --config=$(PATCHES_PATH)/grub/grub.configfile \ |
| 231 | --format=arm64-efi \ |
| 232 | --directory=grub-core \ |
| 233 | --prefix=/boot/grub \ |
| 234 | $(GRUB_MODULES) |
| 235 | |
| 236 | .PHONY: grub-clean |
| 237 | grub-clean: |
| 238 | if [ -e $(GRUB_PATH)/Makefile ]; then $(MAKE) -C $(GRUB_PATH) clean; fi |
| 239 | rm -f $(OUT_PATH)/grubaa64.efi |
| 240 | |
| 241 | .PHONY: grub-cleaner |
| 242 | grub-cleaner: grub-clean |
| 243 | if [ -e $(GRUB_PATH)/Makefile ]; then $(MAKE) -C $(GRUB_PATH) distclean; fi |
| 244 | rm -f $(GRUB_PATH)/configure |
| 245 | |
| 246 | ################################################################################ |
| 247 | # Boot Image |
| 248 | ################################################################################ |
| 249 | ifeq ($(CFG_CONSOLE_UART),6) |
| 250 | GRUBCFG = $(PATCHES_PATH)/grub/grub_uart6.cfg |
| 251 | else |
| 252 | GRUBCFG = $(PATCHES_PATH)/grub/grub_uart5.cfg |
| 253 | endif |
| 254 | |
| 255 | .PHONY: boot-img |
Jens Wiklander | 5a098ec | 2018-04-26 09:54:42 +0200 | [diff] [blame] | 256 | boot-img: linux buildroot edk2 grub |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 257 | rm -f $(BOOT_IMG) |
| 258 | mformat -i $(BOOT_IMG) -n 64 -h 255 -T 131072 -v "BOOT IMG" -C :: |
| 259 | mcopy -i $(BOOT_IMG) $(LINUX_PATH)/arch/arm64/boot/Image :: |
| 260 | mcopy -i $(BOOT_IMG) $(LINUX_PATH)/arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dtb :: |
| 261 | mmd -i $(BOOT_IMG) ::/EFI |
| 262 | mmd -i $(BOOT_IMG) ::/EFI/BOOT |
| 263 | mcopy -i $(BOOT_IMG) $(OUT_PATH)/grubaa64.efi ::/EFI/BOOT/ |
| 264 | mcopy -i $(BOOT_IMG) $(GRUBCFG) ::/EFI/BOOT/grub.cfg |
Jens Wiklander | 5a098ec | 2018-04-26 09:54:42 +0200 | [diff] [blame] | 265 | mcopy -i $(BOOT_IMG) $(ROOT)/out-br/images/rootfs.cpio.gz ::/initrd.img |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 266 | mcopy -i $(BOOT_IMG) $(EDK2_PATH)/Build/HiKey960/$(EDK2_BUILD)_$(EDK2_TOOLCHAIN)/$(EDK2_ARCH)/AndroidFastbootApp.efi ::/EFI/BOOT/fastboot.efi |
| 267 | |
| 268 | .PHONY: boot-img-clean |
| 269 | boot-img-clean: |
| 270 | rm -f $(BOOT_IMG) |
| 271 | |
| 272 | ################################################################################ |
| 273 | # l-loader |
| 274 | ################################################################################ |
Victor Chong | 9860c92 | 2017-09-29 18:25:37 +0100 | [diff] [blame] | 275 | .PHONY: lloader |
Jens Wiklander | a51a404 | 2017-10-09 13:30:24 +0200 | [diff] [blame] | 276 | lloader: arm-tf edk2 |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 277 | cd $(LLOADER_PATH) && \ |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 278 | ln -sf $(TF_A_PATH)/build/hikey960/$(TF_A_BUILD)/bl1.bin && \ |
| 279 | ln -sf $(TF_A_PATH)/build/hikey960/$(TF_A_BUILD)/bl2.bin && \ |
Victor Chong | 9860c92 | 2017-09-29 18:25:37 +0100 | [diff] [blame] | 280 | ln -sf $(EDK2_BIN) && \ |
| 281 | $(MAKE) hikey960 PTABLE_LST=linux-32g |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 282 | |
| 283 | .PHONY: lloader-clean |
Victor Chong | 9860c92 | 2017-09-29 18:25:37 +0100 | [diff] [blame] | 284 | lloader-clean: |
| 285 | $(MAKE) -C $(LLOADER_PATH) hikey960-clean |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 286 | |
| 287 | ################################################################################ |
| 288 | # Flash |
| 289 | ################################################################################ |
| 290 | define flash_help |
| 291 | @read -r -p "Connect HiKey960 to power up (press enter)" dummy |
| 292 | @read -r -p "Connect USB OTG cable, the micro USB cable (press enter)" dummy |
| 293 | endef |
| 294 | |
| 295 | .PHONY: recov_cfg |
| 296 | recov_cfg: |
Jerome Forissier | a4a5255 | 2018-06-21 15:31:22 +0200 | [diff] [blame] | 297 | @echo "./hisi-sec_usb_xloader.img 0x00020000" > $(IMAGE_TOOLS_CONFIG) |
| 298 | @echo "./hisi-sec_uce_boot.img 0x6A908000" >> $(IMAGE_TOOLS_CONFIG) |
Victor Chong | f9f3912 | 2018-03-09 06:54:53 +0000 | [diff] [blame] | 299 | @echo "./recovery.bin 0x1AC00000" >> $(IMAGE_TOOLS_CONFIG) |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 300 | |
| 301 | .PHONY: recovery |
| 302 | recovery: recov_cfg |
| 303 | @echo "Enter recovery mode to flash a new bootloader" |
| 304 | @echo |
| 305 | @echo "Make sure udev permissions are set appropriately:" |
| 306 | @echo " # /etc/udev/rules.d/hikey960.rules" |
| 307 | @echo ' SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="d00d", MODE="0666"' |
| 308 | @echo ' SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666", ENV{ID_MM_DEVICE_IGNORE}="1"' |
| 309 | @echo |
| 310 | @echo "Set jumpers or switches as follows:" |
| 311 | @echo "Jumper 1-2: Closed or Switch 1: On" |
| 312 | @echo " 3-4: Closed or 2: On" |
| 313 | @echo " 5-6: Open or 3: Off" |
| 314 | @read -r -p "Press enter to continue" dummy |
| 315 | @echo |
| 316 | $(call flash_help) |
| 317 | @echo |
| 318 | @echo "Check the device node (/dev/ttyUSBx) of the micro USB connection" |
| 319 | @echo "Note the value x of the device node. Default is 1" |
| 320 | @read -r -p "Enter the device node. Press enter for /dev/ttyUSB1: " DEV && \ |
| 321 | DEV=$${DEV:-/dev/ttyUSB1} && \ |
| 322 | cd $(IMAGE_TOOLS_PATH) && \ |
Victor Chong | f9f3912 | 2018-03-09 06:54:53 +0000 | [diff] [blame] | 323 | ln -sf $(LLOADER_PATH)/recovery.bin && \ |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 324 | sudo ./hikey_idt -c $(IMAGE_TOOLS_CONFIG) -p $$DEV && \ |
| 325 | rm -f $(IMAGE_TOOLS_CONFIG) |
| 326 | @echo |
| 327 | @echo "If you see dots starting to appear on the console," |
| 328 | @echo "press f ON THE CONSOLE (NOT HERE!) to run fastboot." |
| 329 | @echo "You have 10 seconds! Go!" |
| 330 | @echo "If not, fastboot should load automatically." |
| 331 | @read -r -p "Press enter (HERE) to continue flashing" dummy |
| 332 | @$(MAKE) --no-print flash FROM_RECOVERY=1 |
| 333 | |
| 334 | .PHONY: flash |
| 335 | flash: |
| 336 | ifneq ($(FROM_RECOVERY),1) |
| 337 | @echo "Flash binaries using fastboot" |
| 338 | @echo |
| 339 | @echo "Set jumpers or switches as follows:" |
| 340 | @echo "Jumper 1-2: Closed or Switch 1: On" |
| 341 | @echo " 3-4: Open or 2: Off" |
| 342 | @echo " 5-6: Closed or 3: On" |
| 343 | @read -r -p "Press enter to continue" dummy |
| 344 | @echo |
| 345 | $(call flash_help) |
| 346 | endif |
| 347 | @echo "Wait until you see the (UART) message" |
| 348 | @echo " \"Android Fastboot mode - version x.x.\"" |
| 349 | @echo " Press RETURN or SPACE key to quit.\"" |
Victor Chong | f9f3912 | 2018-03-09 06:54:53 +0000 | [diff] [blame] | 350 | @echo "It can take a while for the fastboot device to come up," |
| 351 | @echo "so please wait ~10 seconds." |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 352 | @read -r -p "Then press enter to continue flashing" dummy |
| 353 | @echo |
| 354 | fastboot flash ptable $(LLOADER_PATH)/prm_ptable.img |
Jerome Forissier | f4fe662 | 2018-04-26 14:17:34 +0200 | [diff] [blame] | 355 | fastboot flash xloader $(IMAGE_TOOLS_PATH)/hisi-sec_xloader.img |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 356 | fastboot flash fastboot $(LLOADER_PATH)/l-loader.bin |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 357 | fastboot flash fip $(TF_A_PATH)/build/hikey960/$(TF_A_BUILD)/fip.bin |
Victor Chong | f9f3912 | 2018-03-09 06:54:53 +0000 | [diff] [blame] | 358 | fastboot flash nvme $(IMAGE_TOOLS_PATH)/hisi-nvme.img |
Victor Chong | 05bb4ed | 2017-07-02 13:47:57 +0100 | [diff] [blame] | 359 | fastboot flash boot $(BOOT_IMG) |