From e9a7d892b0f7db57668c2f75d806fd5a5fbe6e66 Mon Sep 17 00:00:00 2001 From: Baikal Electronics Date: Wed, 14 Sep 2022 01:01:19 +0300 Subject: [PATCH] Add basic functionality for building related projects --- conf/bblayers.conf.sample | 11 + conf/layer.conf | 16 ++ conf/local.conf.sample | 238 ++++++++++++++++++ conf/machine/bfk3.conf | 13 + conf/machine/include/baikal-t1.inc | 41 +++ conf/machine/include/tune-mips32r5.inc | 40 +++ conf/machine/include/tune-p5600.inc | 67 +++++ recipes-bsp/u-boot/u-boot-environment.inc | 15 ++ recipes-bsp/u-boot/u-boot_2022.07.bbappend | 40 +++ .../images/core-image-tiny-initramfs.bbappend | 9 + recipes-kernel/linux/linux-baikal.inc | 52 ++++ recipes-kernel/linux/linux-baikal_5.15.bb | 30 +++ 12 files changed, 572 insertions(+) create mode 100644 conf/bblayers.conf.sample create mode 100644 conf/layer.conf create mode 100644 conf/local.conf.sample create mode 100644 conf/machine/bfk3.conf create mode 100644 conf/machine/include/baikal-t1.inc create mode 100644 conf/machine/include/tune-mips32r5.inc create mode 100644 conf/machine/include/tune-p5600.inc create mode 100644 recipes-bsp/u-boot/u-boot-environment.inc create mode 100644 recipes-bsp/u-boot/u-boot_2022.07.bbappend create mode 100644 recipes-core/images/core-image-tiny-initramfs.bbappend create mode 100644 recipes-kernel/linux/linux-baikal.inc create mode 100644 recipes-kernel/linux/linux-baikal_5.15.bb diff --git a/conf/bblayers.conf.sample b/conf/bblayers.conf.sample new file mode 100644 index 0000000..e3c8f44 --- /dev/null +++ b/conf/bblayers.conf.sample @@ -0,0 +1,11 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ##OEROOT##/meta \ + ##OEROOT##/meta-baikal \ + " diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..6776718 --- /dev/null +++ b/conf/layer.conf @@ -0,0 +1,16 @@ +## We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +## We have recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "baikal-cpu" +BBFILE_PATTERN_baikal-cpu = "^${LAYERDIR}/" + +BBFILE_PRIORITY_baikal-cpu = "4" + +LAYERVERSION_baikal-cpu = "1" +## LAYERDEPENDS_baikal-cpu = "core" + +## LAYERSERIES_COMPAT_baikal-cpu = "honister" diff --git a/conf/local.conf.sample b/conf/local.conf.sample new file mode 100644 index 0000000..c568c65 --- /dev/null +++ b/conf/local.conf.sample @@ -0,0 +1,238 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +MACHINE = "bfk3" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to ipk: +PACKAGE_CLASSES ?= "package_ipk" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686, x86_64, aarch64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +## EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +## USER_CLASSES ?= "buildstats image-mklibs image-prelink" + + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See classes/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO_qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necessary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can be +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + + +# +# Qemu configuration +# +# By default qemu will build with a builtin VNC server where graphical output can be +# seen. The two lines below enable the SDL backend too. By default libsdl2-native will +# be built, if you want to use your host's libSDL instead of the minimal libsdl built +# by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +## PACKAGECONFIG_append_pn-qemu-system-native = " sdl" +## PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" +#ASSUME_PROVIDED += "libsdl2-native" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with ":" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# +# Memory Resident Bitbake +# +# Bitbake's server component can stay in memory after the UI for the current command +# has completed. This means subsequent commands can run faster since there is no need +# for bitbake to reload cache files and so on. Number is in seconds, after which the +# server will shut down. +# +#BB_SERVER_TIMEOUT = "60" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "2" + +INITRAMFS_IMAGE = "core-image-tiny-initramfs" +INITRAMFS_FSTYPES = "cpio cpio.gz cpio.lzma" + +IMAGE_FSTYPES = "ext2 ext2.gz ext2.lzma cpio cpio.gz cpio.lzma" + +BAIKAL_DEPLOY = "${TOPDIR}/baikal" +BAIKAL_IMAGES = "${BAIKAL_DEPLOY}/img" diff --git a/conf/machine/bfk3.conf b/conf/machine/bfk3.conf new file mode 100644 index 0000000..ef631ef --- /dev/null +++ b/conf/machine/bfk3.conf @@ -0,0 +1,13 @@ +#@TYPE: Machine +#@NAME: BFK3 MIPS +#@DESCRIPTION: Baikal-T1 based Baikal BFK v2.0, v3.x evaluation boards + +require conf/machine/include/baikal-t1.inc + +# Kernel and bootloader default configs +UBOOT_MACHINE = "baikal_bfk3_defconfig" + +KBUILD_DEFCONFIG = "baikal_bfk3_defconfig" +KERNEL_DEVICETREE = "baikal-t1/bfk3.dtb" +PREFERRED_PROVIDER_virtual/kernel = "linux-baikal" +PREFERRED_VERSION_virtual/kernel = "5.15%" diff --git a/conf/machine/include/baikal-t1.inc b/conf/machine/include/baikal-t1.inc new file mode 100644 index 0000000..d66e2f7 --- /dev/null +++ b/conf/machine/include/baikal-t1.inc @@ -0,0 +1,41 @@ +DEFAULTTUNE = "p5600el" +MIPSPKGSFX_ENDIAN = "el" + +# Baikal-T(1) is based on MIPS Warrior P-class P5600 core +require conf/machine/include/tune-p5600.inc + +SOC_FAMILY = "baikal" +require conf/machine/include/soc-family.inc + +# Each Baikal-T is equipped with serial, pci and usb controllers +MACHINE_FEATURES = "serial pci usbhost" +SERIAL_CONSOLE = "115200 ttyS0" + +## # Default u-boot code parameters +## PREFERRED_VERSION_u-boot ?= "2014.10" +## PREFERRED_VERSION_u-boot-mkimage ?= "2014.10" +## PREFERRED_VERSION_u-boot-mkimage-native ?= "2014.10" +## PREFERRED_VERSION_u-boot-mkimage-nativesdk ?= "2014.10" +## PREFERRED_VERSION_u-boot-fw-utils ?= "2014.10" +## PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" +## UBOOT_LOADADDRESS ??= "${UBOOT_VMLINUX_LOADADDRESS}" +## UBOOT_ENTRYSYMBOL ??= "kernel_entry" +## UBOOT_VMLINUZ_LOADADDRESS ??= "0x86100000" +## UBOOT_VMLINUX_LOADADDRESS ??= "0x80100000" +## UBOOT_FDT_LOADADDRESS ??= "0x86000000" +## UBOOT_RD_LOADADDRESS ??= "0x84000000" + +## # Set default kernel/bootloader output binary names and symlinks +## KERNEL_IMAGE_BASE_NAME ?= "${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" +## KERNEL_IMAGE_SYMLINK_NAME ?= "${MACHINE}" +## MODULE_TARBALL_BASE_NAME ?= "modules-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}.tgz" +## MODULE_TARBALL_SYMLINK_NAME ?= "modules-${MACHINE}.tgz" +## DTB_IMAGE_BASE_NAME ?= "${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" +## DTB_IMAGE_SYMLINK_NAME ?= "${MACHINE}" +## FIT_IMAGE_BASE_NAME ?= "${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" +## FIT_IMAGE_SYMLINK_NAME ?= "${MACHINE}" +## UBOOT_BASE_NAME ?= "${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" +## UBOOT_SYMLINK_NAME ?= "${MACHINE}" +## UBOOT_DTB_BINARY ?= "u-boot-${UBOOT_SYMLINK_NAME}.dtb" +## UBOOT_ENV_BASE_NAME ?= "u-boot-env-${PKGV}-${PKGR}-${MACHINE}-${DATETIME}" +## UBOOT_ENV_SYMLINK_NAME ?= "u-boot-env-${MACHINE}" diff --git a/conf/machine/include/tune-mips32r5.inc b/conf/machine/include/tune-mips32r5.inc new file mode 100644 index 0000000..ef4fa52 --- /dev/null +++ b/conf/machine/include/tune-mips32r5.inc @@ -0,0 +1,40 @@ +DEFAULTTUNE ?= "mips32r5" + +require conf/machine/include/mips/tune-mips32r2.inc + +# Add the CCFLAGS to have software properly optimized for MIPS32r5 arch +TUNEVALID[mips32r5] = "Enable mips32r5 specific processor optimizations" +TUNECONFLICTS[mips32r5] = "n64 n32" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'mips32r5', ' -march=mips32r5', '', d)}" + +# Base Tunes (Hard Float) +AVAILTUNES += "mips32r5 mips32r5el" + +TUNE_FEATURES:tune-mips32r5 = "${TUNE_FEATURES:tune-mips} mips32r5" +MIPSPKGSFX_VARIANT:tune-mips32r5 = "mips32r5" +PACKAGE_EXTRA_ARCHS:tune-mips32r5 = "mips mips32 mips32r2 mips32r5" + +TUNE_FEATURES:tune-mips32r5el = "${TUNE_FEATURES:tune-mipsel} mips32r5" +MIPSPKGSFX_VARIANT:tune-mips32r5el = "mips32r5el" +PACKAGE_EXTRA_ARCHS:tune-mips32r5el = "mipsel mips32el mips32r2el mips32r5el" + +# Soft Float +AVAILTUNES += "mips32r5-nf mips32r5el-nf" + +TUNE_FEATURES:tune-mips32r5-nf = "${TUNE_FEATURES:tune-mips-nf} mips32r5" +MIPSPKGSFX_VARIANT:tune-mips32r5-nf = "mips32r5" +PACKAGE_EXTRA_ARCHS:tune-mips32r5-nf = "mips-nf mips32-nf mips32r2-nf mips32r5-nf" + +TUNE_FEATURES:tune-mips32r5el-nf = "${TUNE_FEATURES:tune-mipsel-nf} mips32r5" +MIPSPKGSFX_VARIANT:tune-mips32r5el-nf = "mips32r5el" +PACKAGE_EXTRA_ARCHS:tune-mips32r5el-nf = "mipsel-nf mips32el-nf mips32r2el-nf mips32r5el-nf" + +# Set GCC default build settings +MIPS32R5_OECONF = "${@'--with-abi=32 --with-arch=mips32r5' if '${DEFAULTTUNE}' in ['mips32r5', 'mips32r5el', 'mips32r5-nf', 'mips32r5el-nf'] else ''}" +MIPS32R5_OECONF += "${@'--with-float=hard --with-fp-32=xx' if '${DEFAULTTUNE}' in ['mips32r5', 'mips32r5el'] else ''}" +MIPS32R5_OECONF += "${@'--with-float=soft' if '${DEFAULTTUNE}' in ['mips32r5-nf', 'mips32r5el-nf'] else ''}" +MIPS32R5_OECONF += "--enable-target-optspace --enable-plugin --with-mips-plt" +EXTRA_OECONF:append:pn-gcc = " ${MIPS32R5_OECONF}" +EXTRA_OECONF:append:pn-gcc-cross-initial-${TARGET_ARCH} = " ${MIPS32R5_OECONF}" +EXTRA_OECONF:append:pn-gcc-cross-${TARGET_ARCH} = " ${MIPS32R5_OECONF}" +EXTRA_OECONF:append:pn-gcc-cross-canadian-${TARGET_ARCH} = " ${MIPS32R5_OECONF}" diff --git a/conf/machine/include/tune-p5600.inc b/conf/machine/include/tune-p5600.inc new file mode 100644 index 0000000..13218ba --- /dev/null +++ b/conf/machine/include/tune-p5600.inc @@ -0,0 +1,67 @@ +DEFAULTTUNE ?= "p5600" + +require conf/machine/include/tune-mips32r5.inc + +# MIPS Warrior P5600 tuning feature +TUNEVALID[p5600] = "MIPS Warrior P-class P5600 Multiprocessor core" +TUNECONFLICTS[p5600] = "n64 n32" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'p5600', ' -march=mips32r5 -mtune=p5600', '', d)}" + +# Base Tunes (Hard Float) +AVAILTUNES += "p5600 p5600el" + +TUNE_FEATURES:tune-p5600 = "${TUNE_FEATURES:tune-mips} p5600" +MIPSPKGSFX_VARIANT:tune-p5600 = "p5600" +PACKAGE_EXTRA_ARCHS:tune-p5600 = "mips mips32 mips32r2 mips32r5 p5600" + +TUNE_FEATURES:tune-p5600el = "${TUNE_FEATURES:tune-mipsel} p5600" +MIPSPKGSFX_VARIANT:tune-p5600el = "p5600el" +PACKAGE_EXTRA_ARCHS:tune-p5600el = "mipsel mips32el mips32r2el mips32r5el p5600el" + +# Soft Float +AVAILTUNES += "p5600-nf p5600el-nf" + +TUNE_FEATURES:tune-p5600-nf = "${TUNE_FEATURES:tune-mips-nf} p5600" +MIPSPKGSFX_VARIANT:tune-p5600-nf = "p5600" +PACKAGE_EXTRA_ARCHS:tune-p5600-nf = "mips-nf mips32-nf mips32r2-nf mips32r5-nf p5600-nf" + +TUNE_FEATURES:tune-p5600el-nf = "${TUNE_FEATURES:tune-mipsel-nf} p5600" +MIPSPKGSFX_VARIANT:tune-p5600el-nf = "p5600el" +PACKAGE_EXTRA_ARCHS:tune-p5600el-nf = "mipsel-nf mips32el-nf mips32r2el-nf mips32r5el-nf p5600el-nf" + +# MIPS 64-bits floating point registers feature +TUNEVALID[fp64] = "Use MIPS 64-bits FP registers" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'fp64', ' -mfp64', '', d)}" + +# MIPS eXtended Physical Address (XPA) instructions +TUNEVALID[xpa] = "Use MIPS XPA instructions" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'xpa', ' -mxpa', '', d)}" + +# MIPS Enhanced Virtual Addressing instructions +TUNEVALID[eva] = "Use MIPS EVA instructions" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'eva', ' -meva', '', d)}" + +# MIPS Virtualization (VZ) instructions +TUNEVALID[virt] = "Use MIPS VZ instructions" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'virt', ' -mvirt', '', d)}" + +# MIPS SIMD registers and instructions +TUNEVALID[msa] = "Use MIPS SIMD instructions" +TUNE_P5600_MSA = "" +TUNE_CCARGS .= "${@bb.utils.contains('TUNE_FEATURES', 'msa', ' ${TUNE_P5600_MSA}', '', d)}" +# MSA is supported by GCC 7.1 and newer, so lets discard the feature if it is unsupported by compiler +# NOTE we can't use inline python here since external_run hasn't defined before TUNE_FEATURE is referenced +python p5600_gcc_check_msa () { + gcc_major = int((d.getVar('GCCVERSION', True) or '0').replace('%', '').split('.')[0]) + if gcc_major >= 7: + d.setVar('TUNE_P5600_MSA', '-mmsa') +} +p5600_gcc_check_msa[eventmask] = "bb.event.ConfigParsed" +addhandler p5600_gcc_check_msa + +## TUNE_PKGARCH:tune-p5600el = "p5600" + +# Add p5600-specific code tuning +MIPS32R5_OECONF += "${@'--with-abi=32 --with-arch=mips32r5 --with-tune=p5600' if '${DEFAULTTUNE}' in ['p5600', 'p5600el', 'p5600-nf', 'p5600el-nf'] else ''}" +MIPS32R5_OECONF += "${@'--with-float=hard --with-fp-32=xx' if '${DEFAULTTUNE}' in ['p5600', 'p5600el'] else ''}" +MIPS32R5_OECONF += "${@'--with-float=soft' if '${DEFAULTTUNE}' in ['p5600-nf', 'p5600el-nf'] else ''}" diff --git a/recipes-bsp/u-boot/u-boot-environment.inc b/recipes-bsp/u-boot/u-boot-environment.inc new file mode 100644 index 0000000..34d3d47 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-environment.inc @@ -0,0 +1,15 @@ +DEPENDS += "u-boot-mkenvimage-native sed-native" + +PACKAGE_BEFORE_PN += "${PN}-baikal-env" +PROVIDES:${PN}-baikal-env = "${PN}-baikal-env" +FILES:${PN}-baikal-env = "${WORKDIR}/${MACHINE}.bin ${WORKDIR}/${MACHINE}.env" + +ENV_SIZE = "0x10000" +UBOOT_DEF_ENV = "${MACHINE}.def-2022" + +do_build_baikal_environment () { + sed -e "s/build_date=.*$/build_date=${DATE}/; s/build_target=.*$/build_target=${MACHINE}/; s/^\s*#.*$//; /^$/d; " \ + ${BOOTROM_DIR}/${UBOOT_DEF_ENV} > ${WORKDIR}/${MACHINE}.env + uboot-mkenvimage -s ${ENV_SIZE} -o ${WORKDIR}/${MACHINE}.bin ${WORKDIR}/${MACHINE}.env +} +addtask build_baikal_environment before do_install after do_compile diff --git a/recipes-bsp/u-boot/u-boot_2022.07.bbappend b/recipes-bsp/u-boot/u-boot_2022.07.bbappend new file mode 100644 index 0000000..a227adc --- /dev/null +++ b/recipes-bsp/u-boot/u-boot_2022.07.bbappend @@ -0,0 +1,40 @@ +inherit externalsrc + +EXTERNALSRC = "${UBOOT_DIR}" + +do_extsrc_clean () { + if [ -d ${BAIKAL_IMAGES} ]; then + rm -f ${BAIKAL_IMAGES}/*u-boot* + fi + + oe_runmake -C ${S} mrproper +} +addtask do_extsrc_clean + +do_clean[depends] += "u-boot:do_extsrc_clean" + +include u-boot-environment.inc + +do_deploy_baikal () { + if [ ! -d ${BAIKAL_IMAGES} ]; then + mkdir -p ${BAIKAL_IMAGES} + fi + if [ -n "${UBOOT_CONFIG}" ] + then + for config in ${UBOOT_MACHINE}; do + i=$(expr $i + 1); + for type in ${UBOOT_CONFIG}; do + j=$(expr $j + 1); + if [ $j -eq $i ] + then + install -D -m 644 ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX} ${BAIKAL_IMAGES}/${type}.${UBOOT_BINARY} + fi + done + unset j + done + unset i + else + install -D -m 644 ${B}/${UBOOT_BINARY} ${BAIKAL_IMAGES}/${MACHINE}.${UBOOT_BINARY} + fi +} +addtask deploy_baikal after do_deploy diff --git a/recipes-core/images/core-image-tiny-initramfs.bbappend b/recipes-core/images/core-image-tiny-initramfs.bbappend new file mode 100644 index 0000000..b054323 --- /dev/null +++ b/recipes-core/images/core-image-tiny-initramfs.bbappend @@ -0,0 +1,9 @@ +VIRTUAL-RUNTIME_dev_manager = "udev" + +PACKAGE_INSTALL = "initramfs-live-boot packagegroup-core-boot dropbear ${VIRTUAL-RUNTIME_base-utils} ${VIRTUAL-RUNTIME_dev_manager} base-passwd ${ROOTFS_BOOTSTRAP_INSTALL}" + +IMAGE_NAME = "initramfs-bfk3" + +PACKAGE_INSTALL:append = " kernel-modules" + +COMPATIBLE_HOST += '|(mips.*)' diff --git a/recipes-kernel/linux/linux-baikal.inc b/recipes-kernel/linux/linux-baikal.inc new file mode 100644 index 0000000..723c0d2 --- /dev/null +++ b/recipes-kernel/linux/linux-baikal.inc @@ -0,0 +1,52 @@ +SUMMARY = "Linux kernel" +SECTION = "kernel" +LICENSE = "GPL-2.0-only" +HOMEPAGE = "https://www.baikalelectronics.ru/" + +inherit kernel + +# Skip processing of this recipe if it is not explicitly specified as the +# PREFERRED_PROVIDER for virtual/kernel. This avoids network access required +# by the use of AUTOREV SRCREVs, which are the default for this recipe. +python () { + if d.getVar("KERNEL_PACKAGE_NAME") == "kernel" and d.getVar("PREFERRED_PROVIDER_virtual/kernel") != d.getVar("PN"): + d.delVar("BB_DONT_CACHE") + raise bb.parse.SkipRecipe("Set PREFERRED_PROVIDER_virtual/kernel to %s to enable it" % (d.getVar("PN"))) +} + +DEPENDS += "xz-native bc-native" +DEPENDS:append:mipsel = " libgcc" +KERNEL_CC:append:mipsel = " ${TOOLCHAIN_OPTIONS}" +KERNEL_LD:append:mipsel = " ${TOOLCHAIN_OPTIONS}" + +# A KMACHINE is the mapping of a yocto $MACHINE to what is built +# by the kernel. This is typically the branch that should be built, +# and it can be specific to the machine or shared +# KMACHINE = "UNDEFINED" + +LINUX_VERSION_EXTENSION ??= "-oebaikal-${LINUX_KERNEL_TYPE}" + + +B = "${WORKDIR}/linux-${PACKAGE_ARCH}-${LINUX_KERNEL_TYPE}-build" + +do_devshell:prepend() { + # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native) + d.setVar("PKG_CONFIG_DIR", "${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig") + d.setVar("PKG_CONFIG_PATH", "${PKG_CONFIG_DIR}:${STAGING_DATADIR_NATIVE}/pkgconfig") + d.setVar("PKG_CONFIG_LIBDIR", "${PKG_CONFIG_DIR}") + d.setVarFlag("PKG_CONFIG_SYSROOT_DIR", "unexport", "1") + d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_DIR PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR") +} + +do_extsrc_clean () { + if [ -d ${BAIKAL_IMAGES} ]; then + for imageType in ${KERNEL_IMAGETYPES} ; do + rm -f ${BAIKAL_IMAGES}/${MACHINE}.$imageType + done + fi + + oe_runmake -C ${S} mrproper +} +addtask do_extsrc_clean + +do_clean[depends] += "linux-baikal:do_extsrc_clean" diff --git a/recipes-kernel/linux/linux-baikal_5.15.bb b/recipes-kernel/linux/linux-baikal_5.15.bb new file mode 100644 index 0000000..d7e6e64 --- /dev/null +++ b/recipes-kernel/linux/linux-baikal_5.15.bb @@ -0,0 +1,30 @@ +require recipes-kernel/linux/linux-baikal.inc + +inherit externalsrc +inherit kernel-uimage + +KERNEL_IMAGETYPE = "uImage" + +LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46" +LINUX_VERSION ?= "5.15.61" + +DEPENDS += "openssl-native util-linux-native" +DEPENDS += "gmp-native libmpc-native" + +KCONF_BSP_AUDIT_LEVEL = "1" + +COMPATIBLE_MACHINE = "^(bfk3)$" + +EXTERNALSRC="${KERNEL_DIR}" + +deltask package_qa + +do_deploy_baikal () { + if [ ! -d ${BAIKAL_IMAGES} ]; then + mkdir -p ${BAIKAL_IMAGES} + fi + for imageType in ${KERNEL_IMAGETYPES} ; do + install -m 0644 ${B}/${KERNEL_OUTPUT_DIR}/$imageType ${BAIKAL_IMAGES}/${MACHINE}.$imageType + done +} +addtask deploy_baikal after do_deploy -- 2.39.5