diff --git a/.kernel_gdbinit b/.gdbinits/kernel similarity index 100% rename from .kernel_gdbinit rename to .gdbinits/kernel diff --git a/.uboot_gdbinit b/.gdbinits/uboot similarity index 100% rename from .uboot_gdbinit rename to .gdbinits/uboot diff --git a/.gitmodules b/.gitmodules index cc98a05ff811e8a2c5c2d5246d67e03c4633f521..41a8cb093a9cb6a4a9cfae5f9f79ba0be8738cae 100644 --- a/.gitmodules +++ b/.gitmodules @@ -54,3 +54,6 @@ ignore = all path = boards/x86_64/pc/bsp url = https://gitee.com/tinylab/qemu-x86_64-pc.git +[submodule "boards/arm/mcimx6ul-evk/bsp"] + path = boards/arm/mcimx6ul-evk/bsp + url = https://gitee.com/pingwuu/qemu-arm-mcimx6ul-evk.git diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000000000000000000000000000000000000..03d81c9c090e5f9146312be3b99862c550f9d2c0 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,7 @@ +maintainers: +- Wu Zhangijn (@lzufalcon) + +contributors: +- LastRitter (@lastritter) +- Ping Wu (@pingwuu) +- unicornx (@unicornx) diff --git a/COPYING b/COPYING index 10828e06eca80e104cf90bc3fb8f6a4f3c6b2ae8..814b9f9a34655696b2ba7d1817f778dab3c0119f 100644 --- a/COPYING +++ b/COPYING @@ -1,4 +1,9 @@ +Linux Lab is Copyright (C) 2016-2020 Wu Zhangjin and the +authors in AUTHORS. +The Linux Lab files are licensed under GPL v2 for non-commercial users. + +--- GNU GENERAL PUBLIC LICENSE Version 2, June 1991 diff --git a/Makefile b/Makefile index 9d6fac40afb6881b95368a6267056847a24a7039..fb8bc247a51faa4576f49ea3fafd72ccefbb30c5 100644 --- a/Makefile +++ b/Makefile @@ -92,6 +92,7 @@ BOARD_DIR := $(TOP_DIR)/$(BOARDS_DIR)/$(BOARD) FEATURE_DIR := feature/linux TFTPBOOT := tftpboot HOME_DIR := /home/$(USER)/ +GDBINIT_DIR := $(TOP_DIR)/.gdbinits # Search board in basic arch list while board name given without arch specified BASE_ARCHS := arm aarch64 mipsel ppc i386 x86_64 loongson csky @@ -264,22 +265,11 @@ $(call _i,$(1),$(2),$(HOME_DIR)) endef # Include board detailed configuration -# Makefile.config/beforeconfig/afterconfig hooks for more - define board_config -$(call _bi,beforeconfig.private,Makefile) -$(call _bi,beforeconfig,Makefile) - -$(call _bi,config.private,Makefile) -$(call _bi,config,Makefile) - $(call _bi,GCC,Makefile) $(call _bi,ROOT,Makefile) $(call _bi,NET,Makefile) $(call _bvi,LINUX,Makefile) - -$(call _bi,afterconfig,Makefile) -$(call _bi,afterconfig.private,Makefile) endef define fixup_arch @@ -294,28 +284,22 @@ ifneq ($$(IS_ARCH),0) endif endef -# include Makefile.init if exist -# the .private version is for user local customization, should not be added in mainline repository -$(eval $(call _ti,init,Makefile)) -$(eval $(call _ti,init.private,Makefile)) -$(eval $(call _ti,config,Makefile)) -$(eval $(call _ti,config.private,Makefile)) +# include .labinit if exist +$(eval $(call _ti,labinit)) + +$(eval $(call _ti,labconfig)) +$(eval $(call _hi,labconfig)) # Loading board configurations ifneq ($(BOARD),) - # include $(BOARD_DIR)/Makefile.init if exist - $(eval $(call _bi,init.private,Makefile)) - $(eval $(call _bi,init,Makefile)) - include $(BOARD_MAKEFILE) - # include $(BOARD_DIR)/Makefile.fini if exist - $(eval $(call _bi,fini,Makefile)) - $(eval $(call _bi,fini.private,Makefile)) + # include $(BOARD_DIR)/.labinit + $(eval $(call _bi,labinit)) $(eval $(call _bi,labconfig)) + include $(BOARD_MAKEFILE) + # include $(BOARD_DIR)/.labfini + $(eval $(call _bi,labfini)) endif -$(eval $(call _ti,labconfig)) -$(eval $(call _hi,labconfig)) - # Customize kernel git repo and local dir $(eval $(call __vs,KERNEL_SRC,LINUX)) $(eval $(call __vs,KERNEL_GIT,LINUX)) @@ -3238,11 +3222,11 @@ endif ifeq ($(DEBUG),uboot) GDB_CMD ?= $(GDB) $(BIMAGE) - GDB_INIT ?= $(TOP_DIR)/.uboot_gdbinit + GDB_INIT ?= $(GDBINIT_DIR)/uboot DEBUG_DEPS := uboot-build else GDB_CMD ?= $(GDB) $(VMLINUX) - GDB_INIT ?= $(TOP_DIR)/.kernel_gdbinit + GDB_INIT ?= $(GDBINIT_DIR)/kernel DEBUG_DPES := kernel-build endif @@ -3273,7 +3257,7 @@ endif # FIXME: gdb not continue the commands in .gdbinit while runing with 'CASE=debug tools/testing/run.sh' # just ignore the do_fork breakpoint to workaround it. _debug: - $(Q)ln -sf $(notdir $(GDB_INIT)) .gdbinit + $(Q)ln -sf $(notdir $(GDBINIT_DIR))/$(notdir $(GDB_INIT)) .gdbinit $(Q)sudo -u $(GDB_USER) echo "add-auto-load-safe-path .gdbinit" > $(HOME_GDB_INIT) $(Q)$(DEBUG_CMD) & @@ -3345,9 +3329,8 @@ default-help: PHONY += env env-list env-prepare env-dump env-save lab-help -# include Makefile.fini if exist -$(eval $(call _ti,fini,Makefile)) -$(eval $(call _ti,fini.private,Makefile)) +# include .labfini if exist +$(eval $(call _ti,.labfini)) # # override all of the above targets if the first target is XXX-run, treat left parts as its arguments, simplify input diff --git a/README.md b/README.md index 9e309491c73cec5e8cade68e83f046ad7f2b8a9d..f54541e1035fddd9e9266c36e7c062bb740e792f 100644 --- a/README.md +++ b/README.md @@ -1034,7 +1034,7 @@ And then debug it directly: $ make debug -It will open a new terminal, load the scripts from `.kernel_gdbinit`, run gdb automatically. +It will open a new terminal, load the scripts from `.gdbinits/kernel`, run gdb automatically. It equals to: @@ -1054,7 +1054,7 @@ find out the code line of a kernel panic address: ### 4.6.2 Debugging Uboot -to debug uboot with `.uboot_gdbinit`: +to debug uboot with `.gdbinits/uboot`: $ make debug uboot or @@ -1173,12 +1173,11 @@ default: Simply put the files with a relative path in `system/`, install and rebuild the rootfs: - $ cd system/ $ mkdir system/root/ $ touch system/root/new_file $ make root-install $ make root-rebuild - $ make boot G=1 + $ make boot ### 4.8.2 Share with NFS diff --git a/README_zh.md b/README_zh.md index 655af457c96e201949a8efcc5d28af1c84d92f44..29fd4b0f2929ec76a4ac899972f7ab0cad8f0c48 100644 --- a/README_zh.md +++ b/README_zh.md @@ -1066,7 +1066,7 @@ GCC 的版本可以分别在开发板特定的 Makefile 中针对 Linux, Uboot, $ make debug -将打开一个新的终端窗口,从 `.kernel_gdbinit` 加载脚本,自动运行 gdb。 +将打开一个新的终端窗口,从 `.gdbinits/kernel` 加载脚本,自动运行 gdb。 以上命令等价于运行如下命令: @@ -1086,7 +1086,7 @@ GCC 的版本可以分别在开发板特定的 Makefile 中针对 Linux, Uboot, ### 4.6.2 调试 Uboot -如果想调试 Uboot(采用 `.uboot_gdbinit` 调试脚本): +如果想调试 Uboot(采用 `.gdbinits/uboot` 调试脚本): $ make debug uboot 或 @@ -1208,12 +1208,11 @@ GCC 的版本可以分别在开发板特定的 Makefile 中针对 Linux, Uboot, 将文件放在 `system/` 的相对路径中,安装和重新制作 rootfs: - $ cd system/ $ mkdir system/root/ $ touch system/root/new_file $ make root-install $ make root-rebuild - $ make boot G=1 + $ make boot 上述操作在 root 用户目录下新增 `new_file` 文件。 diff --git a/boards/arm/mcimx6ul-evk/Makefile b/boards/arm/mcimx6ul-evk/Makefile new file mode 100755 index 0000000000000000000000000000000000000000..9e7f1105488a2fad78bece7814b859f581825f44 --- /dev/null +++ b/boards/arm/mcimx6ul-evk/Makefile @@ -0,0 +1,68 @@ +_BASE = 1 +ARCH = arm +XARCH = $(ARCH) +CPU ?= cortex-a9 +MEM ?= 512M +QEMU ?= v4.2.0 +## compile qemu-user with QEMU_US=1, by default only compile qemu-system-$(XARCH) +## after enabling QEMU_US=1, qemu-system-$(XARCH) will not be compiled +QEMU_US ?= 0 +#UBOOT ?= v2015.07 +LINUX ?= v5.4 +# +## Uboot breaks 9pnet sharing, disable uboot if 9pnet share used +#UBOOT[SHARE_1] := disabled +# +#GCC[LINUX_v3.18.39] = 4.3 +#GCC[LINUX_v4.0.9] = 4.3 +#GCC[LINUX_v4.12] = 4.7 +#GCC[LINUX_v3.16.80] = 4.3 +GCC = 4.7 +# +BUILDROOT?= 2020.02 +#KRN_ADDR?= 0x60003000 +#KRN_SIZE?= 5 +#RDK_ADDR?= 0x60900000 +#RDK_SIZE?= 4 +#DTB_ADDR?= 0x60500000 +#DTB_SIZE?= 1 +#UCONFIG ?= vexpress_common.h +#BOOTDEV_LIST := tftp sdcard sd mmc flash pflash +#BOOTDEV ?= flash +BOOTDEV ?= sdcard +## 64M pflash0@0x40000000, 64M pflash1@0x44000000 +#PFLASH_BASE ?= 0x40000000 +#PFLASH_SIZE ?= 64 +#PFLASH_BS ?= 512 +# +## 9pnet based network filesystem sharing, vexpress-a9 not support virtio-9p-pci, so, the virtio-9p-pci based -virtfs not work +#NET9PDEV ?= virtio-9p-device +# +#NETDEV_LIST := lan9118 +#NETDEV ?= lan9118 +SERIAL ?= ttymxc0 +# +#ROOTDEV_LIST := /dev/mmcblk0 /dev/ram0 /dev/nfs +# +ROOTDEV ?= /dev/mmcblk0 +FSTYPE ?= ext4 +ORIIMG ?= arch/$(ARCH)/boot/zImage +#UORIIMG ?= arch/$(ARCH)/boot/uImage +ORIDTB ?= arch/$(ARCH)/boot/dts/imx6ul-14x14-evk.dtb +#BIMAGE ?= $(BSP_UBOOT)/$(UBOOT)/u-boot +KIMAGE ?= $(BSP_KERNEL)/$(LINUX)/zImage +DTB ?= $(BSP_KERNEL)/$(LINUX)/imx6ul-14x14-evk.dtb +#UKIMAGE ?= $(BSP_KERNEL)/$(LINUX)/uImage +#ROOTFS ?= $(BSP_ROOT)/$(BUILDROOT)/rootfs.cpio.gz +ROOTFS ?= $(BSP_ROOT)/$(BUILDROOT)/rootfs.cpio.gz +UROOTFS ?= $(BSP_ROOT)/$(BUILDROOT)/rootfs.cpio.uboot +HROOTFS ?= $(BSP_ROOT)/$(BUILDROOT)/rootfs.$(FSTYPE) +##QP ?= 1 +QTOOL ?= $(BSP_QEMU)/$(QEMU)/bin/qemu-system-$(XARCH) +# +## prebuilt toolchain, please download it if not internal via: make toolchain +## Available CCORI: internal, bootlin, arm +## Notes: Uboot compiled with Linaro toolchain can not boot, simply hang there. +CCORI ?= internal +include $(PREBUILT_TOOLCHAINS)/$(XARCH)/Makefile +# diff --git a/boards/arm/mcimx6ul-evk/bsp b/boards/arm/mcimx6ul-evk/bsp new file mode 160000 index 0000000000000000000000000000000000000000..aa59cebdf978894b5290355a8da2a86ad4c05318 --- /dev/null +++ b/boards/arm/mcimx6ul-evk/bsp @@ -0,0 +1 @@ +Subproject commit aa59cebdf978894b5290355a8da2a86ad4c05318 diff --git a/tools/uboot/pflash.sh b/tools/uboot/pflash.sh index 9f9b2454c9ac98137f95f17e2c8f53d2ea33b48a..8930ce3871f9e0f00dfe2d25b2196419150b6343 100755 --- a/tools/uboot/pflash.sh +++ b/tools/uboot/pflash.sh @@ -25,4 +25,5 @@ if [ "${BOOTDEV}" == "pflash" -o "${BOOTDEV}" == "flash" ]; then [ -n "$DTB_IMAGE" -a -f "$DTB_IMAGE" ] && dd if=$DTB_IMAGE of=$PFLASH_IMG status=none conv=notrunc seek=$(((KRN_SIZE+RDK_SIZE) * 1024 / PFLASH_BS)) bs=${PFLASH_BS}K #sync + exit 0 fi diff --git a/tools/uboot/sd.sh b/tools/uboot/sd.sh index 1392a8c4c128ce7fe3705f2443a418721207d005..d7dc90fbaaf7cf6593edc944f511d634f42e9411 100755 --- a/tools/uboot/sd.sh +++ b/tools/uboot/sd.sh @@ -32,4 +32,5 @@ if [ "${BOOTDEV}" == "sdcard" -o "${BOOTDEV}" == "sd" -o "${BOOTDEV}" == "mmc" ] sudo umount $SD_DIR #sync + exit 0 fi