imgtec-ci20: genimage config/ u-boot env
[openadk.git] / target / riscv64 / Makefile
blob55134d24e71dee9bde05d18cd06100ebf217dca8
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 include $(ADK_TOPDIR)/rules.mk
5 include $(ADK_TOPDIR)/mk/kernel-build.mk
6 include $(ADK_TOPDIR)/mk/image.mk
8 KERNEL:=$(LINUX_DIR)/arch/riscv/boot/Image
9 QEMU_ARGS:=-M virt -m 512 -nographic
10 ifeq ($(ADK_TARGET_WITH_MMU),)
11 QEMU_ARGS+=-bios none -cpu rv64,mmu=off
12 endif
14 ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
15 QEMU_ARGS+=-netdev user,id=eth0 -device virtio-net-device,netdev=eth0
16 endif
17 ifeq ($(ADK_TARGET_FS),archive)
18 QEMU_ARGS+=-device virtio-blk-device,drive=vda -drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=none,id=vda,format=raw
19 endif
21 # target helper text
22 ifeq ($(ADK_TARGET_FS),archive)
23 targethelp:
24 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
25 ifeq ($(ADK_TARGET_QEMU),y)
26 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
27 @echo "Use following command to create a QEMU Image:"
28 @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
29 @echo "Start qemu with following options:"
30 @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
31 endif
32 endif
33 ifeq ($(ADK_TARGET_FS),initramfs)
34 targethelp:
35 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
36 @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
37 ifeq ($(ADK_TARGET_QEMU),y)
38 @echo "Start qemu with following command line:"
39 @echo 'qemu-system-riscv64 ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
40 endif
41 endif
42 ifeq ($(ADK_TARGET_FS),initramfsarchive)
43 targethelp:
44 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
45 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
46 endif
47 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
48 targethelp:
49 @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
50 ifeq ($(ADK_TARGET_QEMU),y)
51 @echo "Start qemu with following command line:"
52 @echo 'qemu-system-riscv64 ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
53 endif
54 ifeq ($(ADK_TARGET_SYSTEM_SIPEED_MAIX_BIT),y)
55 @echo 'sudo python3 scripts/kflash.py -p /dev/ttyUSB0 -b 1500000 -t $(FW_DIR)/$(TARGET_KERNEL)'
56 endif
57 endif
58 ifeq ($(ADK_TARGET_FS),genimage)
59 targethelp:
60 @echo "The disk image is: $(FW_DIR)/sdcard.img"
61 @echo "Use following command to install it on SD card:"
62 @echo 'sudo dd if=$(FW_DIR)/sdcard.img of=/dev/sdX bs=2048k'
63 endif
64 ifeq ($(ADK_TARGET_FS),nfsroot)
65 targethelp:
66 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
67 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
68 endif
70 kernel-strip:
71 @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
73 kernel-install: kernel-strip
74 @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
76 dtb-install:
77 ${KERNEL_MAKE} dtbs
78 for x in $(LINUX_DIR)/arch/riscv/boot/dts/*/*.dtb; do \
79 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/riscv/boot/dts/*/*.dtb $(FW_DIR); \
80 break; \
81 done
83 # filesystem specific targets
84 ifeq ($(ADK_TARGET_FS),archive)
85 imageinstall: kernel-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
86 endif
87 ifeq ($(ADK_TARGET_FS),initramfs)
88 imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
89 endif
90 ifeq ($(ADK_TARGET_FS),initramfsarchive)
91 imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
92 endif
93 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
94 imageinstall: createinitramfs targethelp
95 endif
96 ifeq ($(ADK_TARGET_FS),genimage)
97 imageinstall: dtb-install $(FW_DIR)/$(GENIMAGE) targethelp
98 endif
99 ifeq ($(ADK_TARGET_FS),nfsroot)
100 imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
101 endif