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
14 ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO
),y
)
15 QEMU_ARGS
+=-netdev user
,id
=eth0
-device virtio-net-device
,netdev
=eth0
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
22 ifeq ($(ADK_TARGET_FS
),archive
)
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)'
33 ifeq ($(ADK_TARGET_FS
),initramfs
)
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}'
42 ifeq ($(ADK_TARGET_FS
),initramfsarchive
)
44 @echo
'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
45 @echo
"The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
47 ifeq ($(ADK_TARGET_FS
),initramfspiggyback
)
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)'
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)'
58 ifeq ($(ADK_TARGET_FS
),genimage
)
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'
64 ifeq ($(ADK_TARGET_FS
),nfsroot
)
66 @echo
'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
67 @echo
"The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
71 @cp
$(KERNEL
) $(BUILD_DIR
)/$(TARGET_KERNEL
)
73 kernel-install
: kernel-strip
74 @cp
$(BUILD_DIR
)/$(TARGET_KERNEL
) $(FW_DIR
)/$(TARGET_KERNEL
)
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
); \
83 # filesystem specific targets
84 ifeq ($(ADK_TARGET_FS
),archive
)
85 imageinstall
: kernel-install
$(FW_DIR
)/$(ROOTFSTARBALL
) targethelp
87 ifeq ($(ADK_TARGET_FS
),initramfs
)
88 imageinstall
: kernel-install
$(FW_DIR
)/$(INITRAMFS
) targethelp
90 ifeq ($(ADK_TARGET_FS
),initramfsarchive
)
91 imageinstall
: kernel-install
$(FW_DIR
)/$(ROOTFSUSERTARBALL
) targethelp
93 ifeq ($(ADK_TARGET_FS
),initramfspiggyback
)
94 imageinstall
: createinitramfs targethelp
96 ifeq ($(ADK_TARGET_FS
),genimage
)
97 imageinstall
: dtb-install
$(FW_DIR
)/$(GENIMAGE
) targethelp
99 ifeq ($(ADK_TARGET_FS
),nfsroot
)
100 imageinstall
: kernel-install
$(FW_DIR
)/$(ROOTFSUSERTARBALL
) targethelp