From: Zoltan HERPAI Date: Mon, 26 Aug 2019 14:37:31 +0000 (+0200) Subject: sh775x: add new target to support SH7751R-based (SH4) boards X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a556d606be9a63a1ea6f24ce1fbea53121a0dd33;p=openwrt%2Fstaging%2Fwigyori.git sh775x: add new target to support SH7751R-based (SH4) boards If SH4 hardware is not available for testing, the generated kernel and rootfs can happily start up in qemu: qemu-system-sh4 -M r2d -nographic -no-reboot -kernel openwrt-sh775x-zImage \ -append "console=ttySC1 noiotrap root=/dev/hda" -monitor null -serial null \ -serial stdio -drive file=openwrt-sh775x-rootfs-ext4.img,format=raw Signed-off-by: Zoltan HERPAI --- diff --git a/include/site/sh4 b/include/site/sh4 new file mode 100644 index 0000000000..2f9fac3e8f --- /dev/null +++ b/include/site/sh4 @@ -0,0 +1,28 @@ +#!/bin/sh + +ac_cv_c_littleendian=${ac_cv_c_littleendian=no} +ac_cv_c_bigendian=${ac_cv_c_bigendian=yes} + +ac_cv_sizeof___int64=0 +ac_cv_sizeof_char=1 +ac_cv_sizeof_int=4 +ac_cv_sizeof_int16_t=2 +ac_cv_sizeof_int32_t=4 +ac_cv_sizeof_int64_t=8 +ac_cv_sizeof_long_int=4 +ac_cv_sizeof_long_long=8 +ac_cv_sizeof_long=4 +ac_cv_sizeof_off_t=4 +ac_cv_sizeof_short_int=2 +ac_cv_sizeof_short=2 +ac_cv_sizeof_size_t=4 +ac_cv_sizeof_u_int16_t=2 +ac_cv_sizeof_u_int32_t=4 +ac_cv_sizeof_u_int64_t=8 +ac_cv_sizeof_uint16_t=2 +ac_cv_sizeof_uint32_t=4 +ac_cv_sizeof_uint64_t=8 +ac_cv_sizeof_unsigned_int=4 +ac_cv_sizeof_unsigned_long=4 +ac_cv_sizeof_unsigned_short=2 +ac_cv_sizeof_void_p=4 diff --git a/target/linux/sh775x/Makefile b/target/linux/sh775x/Makefile new file mode 100644 index 0000000000..0732556ef5 --- /dev/null +++ b/target/linux/sh775x/Makefile @@ -0,0 +1,25 @@ +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +ARCH:=sh4 +BOARD:=sh775x +BOARDNAME:=SH775x-based +FEATURES:=tgz ext4 ramdisk fpu squashfs targz + +KERNEL_PATCHVER:=5.15 +LINUX_KARCH:=sh +KERNELNAME:=zImage + +include $(INCLUDE_DIR)/target.mk + +define Target/Description + Build firmware images for SH775x-based boards + (currently only for IO-DATA USL-5P and QEMU) +endef + +$(eval $(call BuildTarget)) diff --git a/target/linux/sh775x/base-files/etc/board.d/02_network b/target/linux/sh775x/base-files/etc/board.d/02_network new file mode 100644 index 0000000000..7822f8076c --- /dev/null +++ b/target/linux/sh775x/base-files/etc/board.d/02_network @@ -0,0 +1,17 @@ +# Copyright (C) 2013-2015 OpenWrt.org + +. /lib/functions/uci-defaults.sh + +board_config_update + +board=$(board_name) + +case "$board" in +*) + ucidef_set_interface_lan 'eth0' + ;; +esac + +board_config_flush + +exit 0 diff --git a/target/linux/sh775x/base-files/etc/inittab b/target/linux/sh775x/base-files/etc/inittab new file mode 100644 index 0000000000..85a2467e15 --- /dev/null +++ b/target/linux/sh775x/base-files/etc/inittab @@ -0,0 +1,3 @@ +::sysinit:/etc/init.d/rcS S boot +::shutdown:/etc/init.d/rcS K stop +ttySC1::askfirst:/bin/ash --login diff --git a/target/linux/sh775x/config-5.15 b/target/linux/sh775x/config-5.15 new file mode 100644 index 0000000000..95d01401ba --- /dev/null +++ b/target/linux/sh775x/config-5.15 @@ -0,0 +1,283 @@ +CONFIG_29BIT=y +# CONFIG_4KSTACKS is not set +CONFIG_8139CP=y +CONFIG_ARCH_32BIT_OFF_T=y +CONFIG_ARCH_HIBERNATION_POSSIBLE=y +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y +CONFIG_ARCH_SELECT_MEMORY_MODEL=y +CONFIG_ARCH_SPARSEMEM_DEFAULT=y +CONFIG_ARCH_SPARSEMEM_ENABLE=y +CONFIG_ATALK=m +# CONFIG_BLK_DEV_DM is not set +CONFIG_BLK_DEV_GENERIC=y +CONFIG_BLK_DEV_IDEPCI=y +# CONFIG_BLK_DEV_INITRD is not set +CONFIG_BLK_DEV_LOOP=y +# CONFIG_BLK_DEV_MD is not set +CONFIG_BLK_DEV_PLATFORM=y +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_RAM_COUNT=16 +CONFIG_BLK_DEV_RAM_SIZE=4096 +CONFIG_BLK_DEV_SD=y +CONFIG_BLK_MQ_PCI=y +CONFIG_BLK_SCSI_REQUEST=y +CONFIG_BOOT_LINK_OFFSET=0x00800000 +# CONFIG_CACHE_OFF is not set +CONFIG_CACHE_WRITEBACK=y +# CONFIG_CACHE_WRITETHROUGH is not set +CONFIG_CLKDEV_LOOKUP=y +CONFIG_COMPAT_32BIT_TIME=y +CONFIG_COMPAT_BRK=y +CONFIG_CONSOLE_TRANSLATIONS=y +CONFIG_COREDUMP=y +CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS=y +CONFIG_CPU_HAS_FPU=y +CONFIG_CPU_HAS_INTEVT=y +CONFIG_CPU_HAS_PMU=y +CONFIG_CPU_HAS_SR_RB=y +CONFIG_CPU_NO_EFFICIENT_FFS=y +CONFIG_CPU_SH4=y +# CONFIG_CPU_SUBTYPE_J2 is not set +# CONFIG_CPU_SUBTYPE_MXG is not set +# CONFIG_CPU_SUBTYPE_SH4_202 is not set +# CONFIG_CPU_SUBTYPE_SH7091 is not set +# CONFIG_CPU_SUBTYPE_SH7201 is not set +# CONFIG_CPU_SUBTYPE_SH7203 is not set +# CONFIG_CPU_SUBTYPE_SH7206 is not set +# CONFIG_CPU_SUBTYPE_SH7263 is not set +# CONFIG_CPU_SUBTYPE_SH7264 is not set +# CONFIG_CPU_SUBTYPE_SH7269 is not set +# CONFIG_CPU_SUBTYPE_SH7343 is not set +# CONFIG_CPU_SUBTYPE_SH7366 is not set +# CONFIG_CPU_SUBTYPE_SH7619 is not set +# CONFIG_CPU_SUBTYPE_SH7705 is not set +# CONFIG_CPU_SUBTYPE_SH7706 is not set +# CONFIG_CPU_SUBTYPE_SH7707 is not set +# CONFIG_CPU_SUBTYPE_SH7708 is not set +# CONFIG_CPU_SUBTYPE_SH7709 is not set +# CONFIG_CPU_SUBTYPE_SH7710 is not set +# CONFIG_CPU_SUBTYPE_SH7712 is not set +# CONFIG_CPU_SUBTYPE_SH7720 is not set +# CONFIG_CPU_SUBTYPE_SH7721 is not set +# CONFIG_CPU_SUBTYPE_SH7722 is not set +# CONFIG_CPU_SUBTYPE_SH7723 is not set +# CONFIG_CPU_SUBTYPE_SH7724 is not set +# CONFIG_CPU_SUBTYPE_SH7734 is not set +# CONFIG_CPU_SUBTYPE_SH7750 is not set +# CONFIG_CPU_SUBTYPE_SH7750R is not set +# CONFIG_CPU_SUBTYPE_SH7750S is not set +# CONFIG_CPU_SUBTYPE_SH7751 is not set +CONFIG_CPU_SUBTYPE_SH7751R=y +# CONFIG_CPU_SUBTYPE_SH7757 is not set +# CONFIG_CPU_SUBTYPE_SH7760 is not set +# CONFIG_CPU_SUBTYPE_SH7763 is not set +# CONFIG_CPU_SUBTYPE_SH7770 is not set +# CONFIG_CPU_SUBTYPE_SH7780 is not set +# CONFIG_CPU_SUBTYPE_SH7785 is not set +# CONFIG_CPU_SUBTYPE_SH7786 is not set +# CONFIG_CPU_SUBTYPE_SHX3 is not set +CONFIG_CRASH_CORE=y +CONFIG_CRC16=y +# CONFIG_CRC32_SARWATE is not set +CONFIG_CRC32_SLICEBY8=y +CONFIG_CRC_T10DIF=m +CONFIG_CROSS_MEMORY_ATTACH=y +# CONFIG_CRYPTO_AEAD is not set +# CONFIG_CRYPTO_AES is not set +# CONFIG_CRYPTO_CCM is not set +CONFIG_CRYPTO_CRC32C=y +CONFIG_CRYPTO_CRCT10DIF=y +# CONFIG_CRYPTO_CTR is not set +# CONFIG_CRYPTO_GCM is not set +# CONFIG_CRYPTO_GHASH is not set +# CONFIG_CRYPTO_LIB_ARC4 is not set +CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1 +# CONFIG_CRYPTO_MANAGER is not set +# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set +# CONFIG_CRYPTO_NULL is not set +# CONFIG_CRYPTO_SKCIPHER is not set +CONFIG_DEBUG_BUGVERBOSE=y +# CONFIG_DEBUG_FS is not set +CONFIG_DEVKMEM=y +# CONFIG_DEV_APPLETALK is not set +CONFIG_DMA_DIRECT_REMAP=y +CONFIG_DMA_NONCOHERENT=y +CONFIG_DMA_REMAP=y +CONFIG_DNOTIFY=y +CONFIG_DUMMY_CONSOLE=y +CONFIG_DUMP_CODE=y +# CONFIG_DWARF_UNWINDER is not set +CONFIG_ELF_CORE=y +# CONFIG_EMBEDDED is not set +# CONFIG_ENABLE_DEFAULT_TRACERS is not set +CONFIG_ENABLE_MUST_CHECK=y +CONFIG_ENTRY_OFFSET=0x00001000 +CONFIG_EXT4_FS=y +CONFIG_FS_IOMAP=y +CONFIG_FS_MBCACHE=y +CONFIG_FTRACE=y +# CONFIG_FTRACE_SYSCALLS is not set +CONFIG_FW_LOADER_PAGED_BUF=y +CONFIG_GENERIC_ALLOCATOR=y +CONFIG_GENERIC_ATOMIC64=y +CONFIG_GENERIC_BUG=y +CONFIG_GENERIC_CLOCKEVENTS=y +CONFIG_GENERIC_IDLE_POLL_SETUP=y +CONFIG_GENERIC_IRQ_SHOW=y +CONFIG_GENERIC_PCI_IOMAP=y +CONFIG_GENERIC_SCHED_CLOCK=y +CONFIG_GENERIC_SMP_IDLE_THREAD=y +CONFIG_GENERIC_STRNCPY_FROM_USER=y +CONFIG_GENERIC_STRNLEN_USER=y +CONFIG_GUSA=y +# CONFIG_GUSA_RB is not set +CONFIG_HAS_DMA=y +CONFIG_HAS_IOMEM=y +CONFIG_HAS_IOPORT_MAP=y +CONFIG_HEARTBEAT=y +# CONFIG_HIGH_RES_TIMERS is not set +CONFIG_HWMON=y +CONFIG_HW_CONSOLE=y +CONFIG_HW_RANDOM=y +CONFIG_HZ=250 +# CONFIG_HZ_100 is not set +CONFIG_HZ_250=y +CONFIG_HZ_PERIODIC=y +CONFIG_IDE=y +# CONFIG_IDEPCI_PCIBUS_ORDER is not set +CONFIG_IDE_GD=y +CONFIG_IDE_GD_ATA=y +# CONFIG_IDE_GD_ATAPI is not set +CONFIG_IDE_PROC_FS=y +CONFIG_INET_DIAG=y +# CONFIG_INET_DIAG_DESTROY is not set +# CONFIG_INET_RAW_DIAG is not set +CONFIG_INET_TCP_DIAG=y +CONFIG_INPUT=y +CONFIG_INPUT_FF_MEMLESS=m +# CONFIG_INPUT_MISC is not set +CONFIG_INPUT_MOUSEDEV=y +# CONFIG_INPUT_MOUSEDEV_PSAUX is not set +CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 +CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 +# CONFIG_INTC_MAPPING_DEBUG is not set +CONFIG_IO_TRAPPED=y +CONFIG_IRQ_DOMAIN=y +CONFIG_IRQ_FORCED_THREADING=y +CONFIG_IRQ_WORK=y +CONFIG_JBD2=y +CONFIG_KALLSYMS=y +CONFIG_KEXEC=y +CONFIG_KEXEC_CORE=y +CONFIG_LEGACY_PTYS=y +CONFIG_LEGACY_PTY_COUNT=256 +CONFIG_LOCALVERSION_AUTO=y +CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_MAY_HAVE_SPARSE_IRQ=y +CONFIG_MD=y +CONFIG_MEMFD_CREATE=y +CONFIG_MEMORY_SIZE=0x04000000 +CONFIG_MEMORY_START=0x0c000000 +CONFIG_MFD_SM501=y +# CONFIG_MFD_SM501_GPIO is not set +CONFIG_MIGRATION=y +CONFIG_MODULES_TREE_LOOKUP=y +CONFIG_MODULES_USE_ELF_RELA=y +CONFIG_MODULE_FORCE_UNLOAD=y +# CONFIG_MODULE_STRIPPED is not set +# CONFIG_MTD is not set +CONFIG_NEED_PER_CPU_KM=y +CONFIG_NEED_SG_DMA_LENGTH=y +CONFIG_NETFILTER=y +CONFIG_NETFILTER_ADVANCED=y +# CONFIG_NEW_LEDS is not set +CONFIG_NLS=y +CONFIG_NO_GENERIC_PCI_IOPORT_MAP=y +CONFIG_NR_ONCHIP_DMA_CHANNELS=8 +# CONFIG_OF is not set +CONFIG_OLD_SIGACTION=y +CONFIG_OLD_SIGSUSPEND=y +CONFIG_PAGE_OFFSET=0x80000000 +# CONFIG_PARTITION_ADVANCED is not set +CONFIG_PCCARD=y +CONFIG_PCI=y +CONFIG_PCI_DOMAINS=y +CONFIG_PCMCIA=y +CONFIG_PCMCIA_LOAD_CIS=y +CONFIG_PERF_EVENTS=y +CONFIG_PERF_USE_VMALLOC=y +CONFIG_PGTABLE_LEVELS=2 +CONFIG_PHYSICAL_START=0x0c000000 +CONFIG_PRINTK_TIME=y +CONFIG_PROC_PAGE_MONITOR=y +# CONFIG_PUSH_SWITCH is not set +CONFIG_ROMFS_BACKED_BY_BLOCK=y +CONFIG_ROMFS_FS=y +CONFIG_ROMFS_ON_BLOCK=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_R9701=y +# CONFIG_RTC_DRV_SH is not set +CONFIG_RTC_I2C_AND_SPI=y +# CONFIG_RTS7751R2D_1 is not set +CONFIG_RTS7751R2D_PLUS=y +CONFIG_SCHED_DEBUG=y +CONFIG_SCSI=y +CONFIG_SERIAL_SH_SCI=y +CONFIG_SERIAL_SH_SCI_CONSOLE=y +CONFIG_SERIAL_SH_SCI_EARLYCON=y +CONFIG_SERIAL_SH_SCI_NR_UARTS=2 +CONFIG_SG_POOL=y +CONFIG_SH_CLK_CPG=y +CONFIG_SH_CLK_CPG_LEGACY=y +CONFIG_SH_CUSTOM_CLK=y +CONFIG_SH_DMA=y +CONFIG_SH_DMA_API=y +CONFIG_SH_DMA_IRQ_MULTI=y +CONFIG_SH_FPU=y +CONFIG_SH_INTC=y +# CONFIG_SH_LANDISK is not set +# CONFIG_SH_LBOX_RE2 is not set +# CONFIG_SH_NO_BSS_INIT is not set +CONFIG_SH_PCLK_FREQ=33333333 +CONFIG_SH_RTS7751R2D=y +CONFIG_SH_SECUREEDGE5410=y +CONFIG_SH_STANDARD_BIOS=y +CONFIG_SH_STORE_QUEUES=y +CONFIG_SH_TIMER_TMU=y +# CONFIG_SH_TITAN is not set +CONFIG_SOCK_DIAG=y +CONFIG_SOUND=m +CONFIG_SPARSEMEM_STATIC=y +CONFIG_SPARSE_IRQ=y +CONFIG_SPI=y +CONFIG_SPI_MASTER=y +# CONFIG_SPI_RSPI is not set +CONFIG_SPI_SH=y +# CONFIG_SPI_SH_SCI is not set +CONFIG_SRCU=y +# CONFIG_STACK_DEBUG is not set +# CONFIG_STAGING is not set +# CONFIG_STNIC is not set +# CONFIG_STRIP_ASM_SYMS is not set +CONFIG_SUPERH=y +# CONFIG_SYN_COOKIES is not set +CONFIG_SYS_SUPPORTS_HUGETLBFS=y +CONFIG_SYS_SUPPORTS_SH_TMU=y +# CONFIG_TCP_CONG_ADVANCED is not set +# CONFIG_TEXTSEARCH is not set +CONFIG_TICK_CPU_ACCOUNTING=y +CONFIG_TINY_SRCU=y +# CONFIG_TMPFS_XATTR is not set +CONFIG_TUN=m +CONFIG_UNCACHED_MAPPING=y +CONFIG_VM_EVENT_COUNTERS=y +CONFIG_VSYSCALL=y +CONFIG_VT=y +CONFIG_VT_CONSOLE=y +# CONFIG_VT_HW_CONSOLE_BINDING is not set +# CONFIG_WATCHDOG is not set +# CONFIG_WEXT_PRIV is not set +# CONFIG_WEXT_SPY is not set +# CONFIG_WIRELESS_EXT is not set +CONFIG_ZERO_PAGE_OFFSET=0x00010000 diff --git a/target/linux/sh775x/image/Makefile b/target/linux/sh775x/image/Makefile new file mode 100644 index 0000000000..416315978a --- /dev/null +++ b/target/linux/sh775x/image/Makefile @@ -0,0 +1,34 @@ +# +# Copyright (C) 2007 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/image.mk + +define Image/BuildKernel + $(foreach k,$(filter zImage Image,$(KERNELNAME)), \ + cp $(KDIR)/$(KERNELNAME) $(BIN_DIR)/$(IMG_PREFIX)-$(k) \ + ) +endef + +define Image/Build/Initramfs + $(foreach k,$(filter zImage Image,$(KERNELNAME)), \ + cp $(KDIR)/$(k)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-$(k)-initramfs \ + ) +endef + +define Image/Build/gzip + gzip -f9n $(BIN_DIR)/$(IMG_ROOTFS)-$(1).img +endef + +$(eval $(call Image/gzip-ext4-padded-squashfs)) + +define Image/Build + $(call Image/Build/$(1)) + $(CP) $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_ROOTFS)-$(1).img + $(call Image/Build/gzip/$(1)) +endef + +$(eval $(call BuildImage))