Radix cross Linux

The main Radix cross Linux repository contains the build scripts of packages, which have the most complete and common functionality for desktop machines

414 Commits   2 Branches   1 Tag
Index: Makefile
===================================================================
--- Makefile	(nonexistent)
+++ Makefile	(revision 225)
@@ -0,0 +1,269 @@
+
+COMPONENT_TARGETS  = $(HARDWARE_ORANGE_PI5)
+
+NEED_ABS_PATH      = true
+
+COMPONENT_IS_3PP   = true
+
+
+include ../../../../build-system/constants.mk
+
+
+SOURCE_REQUIRES    = sources/U-Boot/rkbin
+SOURCE_REQUIRES   += sources/U-Boot/OrangePi/u-boot
+
+REQUIRES           = boot/kernel/orange-pi5/5.10.110
+
+# ======= __END_OF_REQUIRES__ =======
+
+
+version            = 2023.10
+tar_xz_archive     = $(SRC_PACKAGE_PATH)/U-Boot/OrangePi/u-boot/u-boot-$(version).tar.xz
+SRC_ARCHIVE        = $(tar_xz_archive)
+SRC_DIR            = $(TARGET_BUILD_DIR)/u-boot-$(version)
+src_done           = $(TARGET_BUILD_DIR)/.source_done
+
+rkbin_version      = 20230519
+rkbin_archive      = $(SRC_PACKAGE_PATH)/U-Boot/rkbin/rkbin-$(rkbin_version).tar.xz
+RKBIN_SRC_DIR      = $(TARGET_BUILD_DIR)/rkbin-$(rkbin_version)
+rkbin_src_done     = $(TARGET_BUILD_DIR)/.rkbin-source-done
+
+
+PATCHES = PATCHES
+
+
+bl31               = $(TARGET_DEST_DIR)/bootfs/rk3588_bl31_v1.38.elf
+tpl                = $(TARGET_DEST_DIR)/bootfs/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin
+
+u_boot             = $(TARGET_BUILD_DIR)/.u_boot_done
+u_boot_config      = orangepi-5-rk3588s_defconfig
+
+#
+# Image, zImage from Linux kernel package:
+#
+kernel_version     = 5.10.110
+linux_Image        = $(TARGET_DEST_DIR)/bootfs/Image
+linux_zImage       = $(TARGET_DEST_DIR)/bootfs/vmlinuz
+
+#
+# uImage, uzImage for U-Boot (see u-boot-2023.04/include/configs/rk3399_common.h):
+#
+kernel_addr        = 0x02080000
+entry_point        = $(kernel_addr)
+uImage             = $(TARGET_BUILD_DIR)/uImage
+uzImage            = $(TARGET_BUILD_DIR)/uzImage
+
+fdt_addr           = 0x01f00000
+kernel_comp_addr   = 0x08000000
+ramdisk_addr       = 0x06000000
+
+#
+# Boot Scripts:
+#
+boot_sdhc_script    = $(TARGET_BUILD_DIR)/boot.sdhc.script
+boot_sdhc_scr       = $(TARGET_BUILD_DIR)/boot.sdhc.scr
+
+
+boot_records         = $(TARGET_BUILD_DIR)/$(HARDWARE).boot-records
+install_boot_records = $(TARGET_BUILD_DIR)/.boot_records_done
+
+
+ifneq ($(filter $(TOOLCHAIN),$(TOOLCHAIN_RK358X_GLIBC)),)
+ARCH = arm64
+endif
+
+USE_TARGET_DEST_DIR_SYSROOT = no
+
+
+####### Targets
+
+PKG_GROUP = boot
+
+
+UBOOT_BIN_PKG_NAME                = u-boot
+UBOOT_BIN_PKG_VERSION             = 2023.10
+UBOOT_BIN_PKG_ARCH                = $(PKGARCH)
+UBOOT_BIN_PKG_DISTRO_NAME         = $(DISTRO_NAME)
+UBOOT_BIN_PKG_DISTRO_VERSION      = $(DISTRO_VERSION)
+UBOOT_BIN_PKG_GROUP               = $(PKG_GROUP)
+###                                |---handy-ruler-------------------------------|
+UBOOT_BIN_PKG_SHORT_DESCRIPTION   = Rockchip U-Boot
+UBOOT_BIN_PKG_URL                 = $(BUG_URL)
+UBOOT_BIN_PKG_LICENSE             = custom
+UBOOT_BIN_PKG_DESCRIPTION_FILE    = $(TARGET_BUILD_DIR)/$(UBOOT_BIN_PKG_NAME)-pkg-description
+UBOOT_BIN_PKG_DESCRIPTION_FILE_IN = $(UBOOT_BIN_PKG_NAME)-pkg-description.in
+UBOOT_BIN_PKG_INSTALL_SCRIPT      = $(UBOOT_BIN_PKG_NAME)-pkg-install.sh
+
+UBOOT_BIN_PKG      = $(CURDIR)/$(TARGET_BUILD_DIR)/$(UBOOT_BIN_PKG_NAME)-package
+
+build_uboot_pkg    = $(TARGET_BUILD_DIR)/.u_boot_pkg_done
+
+pkg_basename       = $(UBOOT_BIN_PKG_NAME)-$(UBOOT_BIN_PKG_VERSION)-$(UBOOT_BIN_PKG_ARCH)-$(UBOOT_BIN_PKG_DISTRO_NAME)-$(UBOOT_BIN_PKG_DISTRO_VERSION)
+
+pkg_archive        = $(TARGET_BUILD_DIR)/$(PKG_GROUP)/$(pkg_basename).$(pkg_arch_suffix)
+
+pkg_certificate    = $(call cert-name,$(pkg_archive))
+pkg_signature      = $(call sign-name,$(pkg_archive))
+pkg_description    = $(call desc-name,$(pkg_archive))
+products           = $(call pkg-files,$(pkg_archive))
+
+BUILD_TARGETS      = $(bl31)
+BUILD_TARGETS     += $(tpl)
+BUILD_TARGETS     += $(u_boot)
+BUILD_TARGETS     += $(uImage)
+BUILD_TARGETS     += $(uzImage)
+BUILD_TARGETS     += $(boot_sdhc_script)
+BUILD_TARGETS     += $(boot_sdhc_scr)
+BUILD_TARGETS     += $(build_uboot_pkg)
+BUILD_TARGETS     += $(install_boot_records)
+
+PRODUCT_TARGETS    = $(products)
+
+ROOTFS_TARGETS     = $(pkg_archive)
+
+
+include ../../../../build-system/core.mk
+
+
+HOST_TOOLS_SETTINGS = PYTHON3=/usr/bin/python3 HOSTLDFLAGS='-L/usr/lib64' HOSTCFLAGS='-I/usr/include'
+
+device_dtb = rk3588s-orangepi-5.dtb
+
+#
+# Extra kernel boot arguments:
+#
+extra  = consoleblank=0
+extra += no_console_suspend
+
+
+####### Dependencies
+
+
+$(rkbin_src_done): $(rkbin_archive)
+	@echo "Expanding $(rkbin_archive)"
+	@tar xJf $(rkbin_archive) -C $(TARGET_BUILD_DIR)
+	@touch $@
+
+$(src_done): $(SRC_ARCHIVE) $(PATCHES_DEP) $(rkbin_src_done)
+	$(UNPACK_SRC_ARCHIVE)
+	$(APPLY_PATCHES)
+	@( cd $(SRC_DIR)/configs ; \
+	   echo '# Set BOOTDELAY options:'          >> $(u_boot_config) ; \
+	   echo 'CONFIG_SYS_PROMPT="$(HARDWARE)# "' >> $(u_boot_config) ; \
+	   echo 'CONFIG_BOOTDELAY=3'                >> $(u_boot_config) ; \
+	   echo 'CONFIG_AUTOBOOT_KEYED=y'           >> $(u_boot_config) ; \
+	   echo 'CONFIG_AUTOBOOT_PROMPT="Hit SPACE in %d seconds to stop autoboot.\n"' >> $(u_boot_config) ; \
+	   echo 'CONFIG_AUTOBOOT_STOP_STR=" "'      >> $(u_boot_config) ; \
+	 )
+	# ======= Suppress '_elf.so has a LOAD segment with RWX permissions' warnings =======
+	@( cd $(SRC_DIR) ; \
+	   sed -i 's,^\(KBUILD_LDFLAGS[ \t]*:=\).*,\1 --no-warn-rwx-segments,' Makefile ; \
+	   sed -i 's,^\(cmd_efi_ld = $$(LD)\),\1 --no-warn-rwx-segments,'      scripts/Makefile.lib ; \
+	 )
+	@touch $@
+
+$(bl31): $(src_done)
+	@cp -a $(RKBIN_SRC_DIR)/bin/rk35/rk3588_bl31_v1.38.elf $@
+
+$(tpl): $(src_done)
+	@cp -a $(RKBIN_SRC_DIR)/bin/rk35/rk3588_ddr_lp4_2112MHz_lp5_2736MHz_v1.11.bin $@
+
+UMAKE := $(HOST_TOOLS_SETTINGS) $(MAKE) -C $(SRC_DIR) BL31=$(bl31) ROCKCHIP_TPL=$(tpl) CROSS_COMPILE='$(CROSS_PREFIX)'
+
+$(u_boot): $(bl31) $(tpl)
+	+$(UMAKE) $(u_boot_config)
+	+$(UMAKE)
+	@touch $@
+
+$(uImage): $(u_boot)
+	$(CURDIR)/$(SRC_DIR)/tools/mkimage \
+	   -A $(ARCH) -O linux -T kernel -C none -a $(kernel_addr) -e $(entry_point) \
+	   -n $(kernel_version) -d $(linux_Image) $@
+
+$(uzImage): $(u_boot)
+	$(CURDIR)/$(SRC_DIR)/tools/mkimage \
+	   -A $(ARCH) -O linux -T kernel -C lzma -a $(kernel_addr) -e $(entry_point) \
+	   -n $(kernel_version) -d $(linux_zImage) $@
+
+#
+# NOTE:
+# ====
+#   sdhc is always mmc0 in u-boot and mmcblk0 in kernel
+#
+
+$(boot_sdhc_script): $(uzImage)
+	@( echo ""                                                                > $(boot_sdhc_script) && \
+	   echo "mmc dev 0"                                                      >> $(boot_sdhc_script) && \
+	   echo "mmcinfo"                                                        >> $(boot_sdhc_script) && \
+	   echo "ext4load mmc 0:1 \$${kernel_comp_addr_r} /boot/uzImage"         >> $(boot_sdhc_script) && \
+	   echo "ext4load mmc 0:1 \$${fdt_addr_r} /boot/rockchip/$(device_dtb)"  >> $(boot_sdhc_script) && \
+	   echo "setenv bootargs 'earlyprintk console=ttyS2,1500000n8 console=tty1 ro root=/dev/mmcblk0p1 rootwait rootfstype=ext4 $(extra)'" >> $(boot_sdhc_script) && \
+	   echo "bootm \$${kernel_comp_addr_r} - \$${fdt_addr_r}"                >> $(boot_sdhc_script) \
+	 )
+
+$(boot_sdhc_scr): $(boot_sdhc_script)
+	$(CURDIR)/$(SRC_DIR)/tools/mkimage -A $(ARCH) -T script -C none -n "Boot Script" -d $< $@
+
+$(build_uboot_pkg): $(boot_sdhc_scr)
+	@mkdir -p $(TARGET_DEST_DIR)/bootfs/u-boot
+	@mkdir -p $(UBOOT_BIN_PKG)/boot/u-boot
+	# ======= install U-Boot images =======
+	@cp -a $(SRC_DIR)/idbloader.img $(SRC_DIR)/u-boot.itb  $(UBOOT_BIN_PKG)/boot/u-boot
+	# ======= install signed kernel and script images =======
+	@cp -a $(uImage) $(uzImage) $(boot_sdhc_scr) $(UBOOT_BIN_PKG)/boot
+	@( cd $(UBOOT_BIN_PKG)/boot ; \
+	   ln -sf boot.sdhc.scr boot.scr ; \
+	 )
+	# ======= install-u-boot service script =======
+	@cp $(CURDIR)/scripts/install-u-boot  $(UBOOT_BIN_PKG)/boot/u-boot
+	@chmod 755 $(UBOOT_BIN_PKG)/boot/u-boot/install-u-boot
+	# ======= copy U-Boot images and binaries into devenv =======
+	@cp -a $(uImage) $(uzImage) $(boot_sdhc_scr) $(TARGET_DEST_DIR)/bootfs
+	@cp -a $(SRC_DIR)/idbloader.img $(SRC_DIR)/u-boot.itb  $(TARGET_DEST_DIR)/bootfs/u-boot
+	# ======= install Documentation =======
+	@mkdir -p $(UBOOT_BIN_PKG)/usr/doc/u-boot-$(version)
+	@cp -a $(SRC_DIR)/Licenses $(SRC_DIR)/MAINTAINERS $(SRC_DIR)/README \
+	       $(UBOOT_BIN_PKG)/usr/doc/u-boot-$(version)
+	@touch $@
+
+$(boot_records): $(build_uboot_pkg)
+	@$(DD) if=/dev/zero of=$@ bs=512 count=32768 conv=notrunc
+	# ======= Setup u-boot into unallocated space of disk image =======
+	@$(DD) if=$(UBOOT_BIN_PKG)/boot/u-boot/idbloader.img of=$@ bs=512 seek=64    conv=notrunc
+	@$(DD) if=$(UBOOT_BIN_PKG)/boot/u-boot/u-boot.itb    of=$@ bs=512 seek=16384 conv=notrunc
+	@touch $@
+
+$(install_boot_records): $(boot_records)
+	@$(BUILDSYSTEM)/install_targets         \
+	   --destination=$(PRODUCTS_DEST_DIR)   \
+	   --toolchain=$(TOOLCHAIN)             \
+	   --hardware=$(HARDWARE)               \
+	   --flavour=$(FLAVOUR)                 \
+	   $^
+	@touch $@
+
+$(UBOOT_BIN_PKG_DESCRIPTION_FILE): $(UBOOT_BIN_PKG_DESCRIPTION_FILE_IN)
+	@cat $< | $(SED) -e "s/@VERSION@/$(UBOOT_BIN_PKG_VERSION)/g" | \
+	          $(SED) -e "s/@HARDWARE_SPEC@/$(HW_SPEC)/g"> $@
+
+$(pkg_certificate) : $(pkg_archive) ;
+$(pkg_signature)   : $(pkg_archive) ;
+$(pkg_description) : $(pkg_archive) ;
+
+$(pkg_archive): $(install_boot_records) $(UBOOT_BIN_PKG_DESCRIPTION_FILE) $(UBOOT_BIN_PKG_INSTALL_SCRIPT)
+	@cp $(UBOOT_BIN_PKG_DESCRIPTION_FILE) $(UBOOT_BIN_PKG)/.DESCRIPTION
+	@cp $(UBOOT_BIN_PKG_INSTALL_SCRIPT) $(UBOOT_BIN_PKG)/.INSTALL
+	@chmod a+x $(UBOOT_BIN_PKG)/.INSTALL
+	@$(BUILD_PKG_REQUIRES) $(UBOOT_BIN_PKG)/.REQUIRES
+	@echo "pkgname=$(UBOOT_BIN_PKG_NAME)"                            >  $(UBOOT_BIN_PKG)/.PKGINFO ; \
+	 echo "pkgver=$(UBOOT_BIN_PKG_VERSION)"                          >> $(UBOOT_BIN_PKG)/.PKGINFO ; \
+	 echo "arch=$(UBOOT_BIN_PKG_ARCH)"                               >> $(UBOOT_BIN_PKG)/.PKGINFO ; \
+	 echo "distroname=$(UBOOT_BIN_PKG_DISTRO_NAME)"                  >> $(UBOOT_BIN_PKG)/.PKGINFO ; \
+	 echo "distrover=$(UBOOT_BIN_PKG_DISTRO_VERSION)"                >> $(UBOOT_BIN_PKG)/.PKGINFO ; \
+	 echo "group=$(UBOOT_BIN_PKG_GROUP)"                             >> $(UBOOT_BIN_PKG)/.PKGINFO ; \
+	 echo "short_description=\"$(UBOOT_BIN_PKG_SHORT_DESCRIPTION)\"" >> $(UBOOT_BIN_PKG)/.PKGINFO ; \
+	 echo "url=$(UBOOT_BIN_PKG_URL)"                                 >> $(UBOOT_BIN_PKG)/.PKGINFO ; \
+	 echo "license=$(UBOOT_BIN_PKG_LICENSE)"                         >> $(UBOOT_BIN_PKG)/.PKGINFO
+	@$(PSEUDO) sh -c "cd $(UBOOT_BIN_PKG) && \
+	                  chown -R root:root . && \
+	                  $(MAKE_PACKAGE) -J --linkadd=yes $(GNUPG_OPTIONS) -m -d .. ."