diff options
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | 95-linux.hook | 11 | ||||
-rw-r--r-- | PKGBUILD | 27 | ||||
-rwxr-xr-x | bpir64-writefip | 42 | ||||
-rw-r--r-- | defconfig | 16 |
5 files changed, 92 insertions, 15 deletions
@@ -4,19 +4,20 @@ pkgbase = linux-bpir64-git url = http://www.kernel.org/ arch = aarch64 license = GPL2 - makedepends = xmlto - makedepends = docbook-xsl makedepends = kmod makedepends = inetutils makedepends = bc makedepends = git - makedepends = uboot-tools makedepends = dtc options = !strip source = defconfig source = linux.preset source = 60-linux.hook source = 90-linux.hook + source = 95-linux.hook + source = bpir64-writefip + md5sums = SKIP + md5sums = SKIP md5sums = SKIP md5sums = SKIP md5sums = SKIP @@ -28,8 +29,8 @@ pkgname = linux-bpir64-git depends = coreutils depends = linux-firmware depends = kmod - depends = mkinitcpio>=0.7 - optdepends = crda: to set the correct wireless channels of your country + depends = linux-bpir64-fiptool-git + optdepends = mkinitcpio>=0.7 provides = linux=5.18.11.bpi.r64.1 provides = WIREGUARD-MODULE conflicts = linux diff --git a/95-linux.hook b/95-linux.hook new file mode 100644 index 000000000000..8c7a96316e67 --- /dev/null +++ b/95-linux.hook @@ -0,0 +1,11 @@ +[Trigger] +Type = File +Operation = Install +Operation = Upgrade +Target = boot/Image +Target = usr/lib/initcpio/* + +[Action] +Description = Updating %PKGBASE% fip partition... +When = PostTransaction +Exec = /usr/bin/bpir64-writefip @@ -1,4 +1,4 @@ -# Aarch64 kernel for BananaPi R64 +# Arch64 kernel for BananaPi R64 # Maintainer: yjun <ericwouds@gmail.com> # PKGBUILD: https://github.com/archlinuxarm/PKGBUILDs/tree/master/core/linux-aarch64 @@ -14,19 +14,21 @@ pkgrel=1 arch=('aarch64') url="http://www.kernel.org/" license=('GPL2') -## uboot-tools ???? -makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git' 'uboot-tools' 'dtc') +makedepends=('kmod' 'inetutils' 'bc' 'git' 'dtc') options=('!strip') source=('defconfig' 'linux.preset' '60-linux.hook' - '90-linux.hook') -md5sums=(SKIP SKIP SKIP SKIP) + '90-linux.hook' + '95-linux.hook' + 'bpir64-writefip') +md5sums=(SKIP SKIP SKIP SKIP SKIP SKIP) export LOCALVERSION="-${pkgrel}" prepare() { if [[ -d "${srcdir}/${_srcname}/" ]]; then +echo test cd "${srcdir}/${_srcname}/" git fetch echo "LOCAL HEAD: $(git rev-parse HEAD)" @@ -39,6 +41,7 @@ prepare() { echo else cd "${srcdir}/" +echo git clone --branch "${_gitbranch}" --depth=1 "${_gitroot}" "${srcdir}/${_srcname}/" git clone --branch "${_gitbranch}" --depth=1 "${_gitroot}" "${srcdir}/${_srcname}/" echo fi @@ -67,8 +70,8 @@ build() { _package() { pkgdesc="The Linux Kernel and modules - ${_desc}" - depends=('coreutils' 'linux-firmware' 'kmod' 'mkinitcpio>=0.7') - optdepends=('crda: to set the correct wireless channels of your country') + depends=('coreutils' 'linux-firmware' 'kmod' 'linux-bpir64-fiptool-git') + optdepends=('mkinitcpio>=0.7') provides=("linux=${pkgver}" "WIREGUARD-MODULE") replaces=('linux-armv8') conflicts=('linux') @@ -84,10 +87,11 @@ _package() { _basekernel=${_kernver%%-*} _basekernel=${_basekernel%.*} - mkdir -p "${pkgdir}"/{boot,usr/lib/modules} + mkdir -p "${pkgdir}"/{boot,boot/dtss,boot/dtbs,usr/lib/modules} make INSTALL_MOD_PATH="${pkgdir}/usr" DEPMOD=/doesnt/exist modules_install - make INSTALL_DTBS_PATH="${pkgdir}/boot/dtbs" dtbs_install + make dtbs cp arch/$KARCH/boot/Image{,.gz} "${pkgdir}/boot" + cp arch/$KARCH/boot/dts/mediatek/.*.dtb.dts.tmp "${pkgdir}/boot/dtss" # make room for external modules local _extramodules="extramodules-${_basekernel}${_kernelname}" @@ -122,6 +126,11 @@ _package() { install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/60-${pkgbase}.hook" sed "${_subst}" ../90-linux.hook | install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/90-${pkgbase}.hook" + sed "${_subst}" ../95-linux.hook | + install -Dm644 /dev/stdin "${pkgdir}/usr/share/libalpm/hooks/95-${pkgbase}.hook" + + cd "${startdir}" + install -m755 -vDt $pkgdir/usr/bin bpir64-writefip } _package-headers() { diff --git a/bpir64-writefip b/bpir64-writefip new file mode 100755 index 000000000000..370ebf459887 --- /dev/null +++ b/bpir64-writefip @@ -0,0 +1,42 @@ +#!/bin/bash + +[ ! -d "$1/boot/bootcfg/" ] && exit +[ ! -d "$1/boot/dtb-patch/" ] && exit +fipdev=$(cat $1/boot/bootcfg/device) +linux=$(cat $1/boot/bootcfg/linux) +cmdline=$(cat $1/boot/bootcfg/cmdline) +initrd=$(cat $1/boot/bootcfg/initrd) +dtb=$(cat $1/boot/bootcfg/dtb) +cp -vf $1/boot/dtss/.${dtb}.dtb.dts.tmp $1/boot/dtbs/${dtb}.dts +for bp in $1/boot/dtb-patch/*.patch; do + echo Applying: $bp + patch -d $1/ -p1 -N -r - < $bp +done +if [ -f "$1$initrd" ];then + iend=$(( 0x48000000 + $(du -b $1$initrd | cut -f1) )) + in="\n linux,initrd-start = <0x48000000>;\n linux,initrd-end = <0x$(printf '%x\n' $iend)>;" +else + in="" + echo -n "" > "$1$initrd" +fi +origargs=$(cat $1/boot/dtbs/${dtb}.dts | grep "bootargs = ") +origargs=${origargs##*"bootargs = "} +origargs=${origargs/;/} +origargs=${origargs//"\""/} +echo ORIGARGS = "$origargs" +bootargs="root=PARTLABEL=bpir64-${fipdev}-root $origargs $cmdline" +sed -i 's/.*bootargs = .*/ bootargs = "'"$bootargs"'";'"$in"'/' \ + $1/boot/dtbs/${dtb}.dts +dtc -q -I dts -O dtb -o $1/boot/dtbs/${dtb}.dtb $1/boot/dtbs/${dtb}.dts +fiptool --verbose create $1/boot/fip.bin \ + --tos-fw-extra2 $1$initrd \ + --nt-fw $1$linux \ + --nt-fw-config $1/boot/dtbs/${dtb}.dtb +fiptool info $1/boot/fip.bin +fipdev="/dev/disk/by-partlabel/bpir64-${fipdev}-fip" +echo Writing to: $fipdev +dd of=$fipdev if=/dev/zero 2>/dev/null +dd of=$fipdev if=$1/boot/fip.bin + +exit 0 + diff --git a/defconfig b/defconfig index e104c26c757a..33a874db5042 100644 --- a/defconfig +++ b/defconfig @@ -51,7 +51,6 @@ CONFIG_CGROUP_CPUACCT=y CONFIG_CGROUP_PERF=y # CONFIG_UTS_NS is not set CONFIG_USER_NS=y -CONFIG_BLK_DEV_INITRD=y CONFIG_CC_OPTIMIZE_FOR_SIZE=y # @@ -301,6 +300,7 @@ CONFIG_MTD=y # # Partition parsers # +CONFIG_MTD_CMDLINE_PARTS=m # CONFIG_MTD_OF_PARTS is not set # end of Partition parsers @@ -309,6 +309,13 @@ CONFIG_MTD=y # CONFIG_NFTL=m CONFIG_NFTL_RW=y + +# +# Self-contained MTD device drivers +# +CONFIG_MTD_BLOCK2MTD=m +# end of Self-contained MTD device drivers + CONFIG_MTD_SPI_NOR=y # CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set @@ -744,6 +751,13 @@ CONFIG_NLS_ISO8859_1=y CONFIG_CRYPTO_ECHAINIV=y # +# Library routines +# + +CONFIG_XZ_DEC=y +# end of Library routines + +# # Kernel hacking # |