Skip to content

Commit

Permalink
core/linux-raspberrypi to 5.10.63-14
Browse files Browse the repository at this point in the history
  • Loading branch information
graysky2 committed Oct 1, 2021
1 parent 6753de8 commit dbd80e6
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 177 deletions.
12 changes: 0 additions & 12 deletions core/linux-raspberrypi/60-linux.hook

This file was deleted.

12 changes: 0 additions & 12 deletions core/linux-raspberrypi/90-linux.hook

This file was deleted.

249 changes: 109 additions & 140 deletions core/linux-raspberrypi/PKGBUILD
Original file line number Diff line number Diff line change
@@ -1,77 +1,64 @@
# Maintainer: Dave Higham <pepedog@archlinuxarm.org>
# Maintainer: graysky <graysky@archlinux.us>
# Maintainer: Kevin Mihelich <kevin@archlinuxarm.org>
# Maintainer: Oleg Rakhmanov <oleg@archlinuxarm.org>
# Maintainer: graysky <graysky@archlinux.us>
# Maintainer: Dave Higham <pepedog@archlinuxarm.org>
# Contributer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>

buildarch=20

pkgbase=linux-raspberrypi
_commit=f694d1cfee63afaaa77e7d9e1f621a83e2f98846
_commit=1faafd963e48eafb3abd555e13496a773d858b02
_srcname=linux-${_commit}
_kernelname=${pkgbase#linux}
_desc="Raspberry Pi 2"
_desc="Raspberry Pi 1 and 2"
pkgver=5.10.63
pkgrel=13
arch=('armv6h' 'armv7h')
pkgrel=14
pkgdesc='Linux'
url="http://www.kernel.org/"
license=('GPL2')
makedepends=('xmlto' 'docbook-xsl' 'kmod' 'inetutils' 'bc' 'git')
arch=(armv6h armv7h)
license=(GPL2)
makedepends=(
bc kmod inetutils
)
options=('!strip')
source=("https://github.com/raspberrypi/linux/archive/${_commit}.tar.gz"
'cmdline.txt'
'linux.preset'
'config.txt'
'config'
'60-linux.hook'
'90-linux.hook')
md5sums=('cb39469f07bcf3c3eb2509ed24231f9f'
cmdline.txt
config.txt
config
)
md5sums=('8b6f5b06d5a252cbb06ea1b33ee45c25'
'31c02f4518d46deb5f0c2ad1f8b083cd'
'86d4a35722b5410e3b29fc92dae15d4b'
'9669d916a5929a2eedbd64477f83d99e'
'4e77a3c2e7dbf645f60fcc9217587dc6'
'ce6c81ad1ad1f8b333fd6077d47abdaf'
'69e1db90d78f691dc446fe2ab94727eb')
'18d63f130f6e161aece55aea93b38e14')

# setup vars
[[ $CARCH == "armv6h" ]] && _kernel=kernel.img
[[ $CARCH == "armv7h" ]] && _kernel=kernel7.img
_image=zImage
_config=config
_bconfig=config.txt
KARCH=arm

prepare() {
cd "${srcdir}/${_srcname}"

cat "${srcdir}/config" > ./.config
echo "Setting version..."
scripts/setlocalversion --save-scmversion
echo "-$pkgrel" > localversion.10-pkgrel
echo "${pkgbase#linux}" > localversion.20-pkgname

# add pkgrel to extraversion
sed -ri "s|^(EXTRAVERSION =)(.*)|\1 \2-${pkgrel}|" Makefile
echo "Setting config..."
cp ../"$_config" .config
make olddefconfig

# don't run depmod on 'make install'. We'll do this ourselves in packaging
sed -i '2iexit 0' scripts/depmod.sh
make -s kernelrelease > version
echo "Prepared $pkgbase version $(<version)"
}

build() {
cd "${srcdir}/${_srcname}"

# get kernel version
make prepare

# load configuration
# Configure the kernel. Replace the line below with one of your choice.
#make menuconfig # CLI menu for configuration
#make nconfig # new CLI menu for configuration
#make xconfig # X-based configuration
#make oldconfig # using old config from previous kernel version
#make bcmrpi_defconfig # using RPi defconfig
# ... or manually edit .config

# Copy back our configuration (use with new kernel version)
#cp ./.config ../${pkgver}.config

####################
# stop here
# this is useful to configure the kernel
#msg "Stopping build"
#return 1
####################

#yes "" | make config

make ${MAKEFLAGS} zImage modules dtbs
make "$_image" modules dtbs
}

_package() {
Expand All @@ -86,56 +73,29 @@ _package() {

cd "${srcdir}/${_srcname}"

KARCH=arm
local kernver="$(<version)"
local modulesdir="$pkgdir/usr/lib/modules/$kernver"

# get kernel version
_kernver="$(make kernelrelease)"
_basekernel=${_kernver%%-*}
_basekernel=${_basekernel%.*}
# Used by mkinitcpio to name the kernel
echo "$pkgbase" | install -Dm644 /dev/stdin "$modulesdir/pkgbase"

mkdir -p "${pkgdir}"/{boot,usr/lib/modules}
make INSTALL_MOD_PATH="${pkgdir}/usr" modules_install
make INSTALL_DTBS_PATH="${pkgdir}/boot" dtbs_install
echo "Installing modules..."
make INSTALL_MOD_PATH="$pkgdir/usr" modules_install

[[ $CARCH == "armv6h" ]] && cp arch/$KARCH/boot/zImage "${pkgdir}/boot/kernel.img" \
&& rm -f "${pkgdir}"/boot/bcm{2836,2837,2838,2709,2710,2711}*.dtb
[[ $CARCH == "armv7h" ]] && cp arch/$KARCH/boot/zImage "${pkgdir}/boot/kernel7.img" \
&& rm -f "${pkgdir}"/boot/bcm{2835,2838,2708,2711}*.dtb
cp arch/$KARCH/boot/dts/overlays/README "${pkgdir}/boot/overlays"
# remove build and source links
rm "$modulesdir"/{source,build}

# make room for external modules
local _extramodules="extramodules-${_basekernel}${_kernelname}"
ln -s "../${_extramodules}" "${pkgdir}/usr/lib/modules/${_kernver}/extramodules"
echo "Installing Arch ARM specific stuff..."
mkdir -p "${pkgdir}"/boot
make INSTALL_DTBS_PATH="${pkgdir}/boot" dtbs_install

# add real version for building modules and running depmod from hook
echo "${_kernver}" |
install -Dm644 /dev/stdin "${pkgdir}/usr/lib/modules/${_extramodules}/version"
cp arch/$KARCH/boot/$_image "${pkgdir}/boot/$_kernel"
cp arch/$KARCH/boot/dts/overlays/README "${pkgdir}/boot/overlays"
install -m644 ../$_bconfig "${pkgdir}/boot/config.txt"
install -m644 ../cmdline.txt "${pkgdir}/boot"

# remove build and source links
rm "${pkgdir}"/usr/lib/modules/${_kernver}/{source,build}

# now we call depmod...
depmod -b "${pkgdir}/usr" -F System.map "${_kernver}"

# sed expression for following substitutions
local _subst="
s|%PKGBASE%|${pkgbase}|g
s|%KERNVER%|${_kernver}|g
s|%EXTRAMODULES%|${_extramodules}|g
"

# install mkinitcpio preset file
sed "${_subst}" ../linux.preset |
install -Dm644 /dev/stdin "${pkgdir}/etc/mkinitcpio.d/${pkgbase}.preset"

# install pacman hooks
sed "${_subst}" ../60-linux.hook |
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"

# install boot files
install -m644 ../config.txt ../cmdline.txt "${pkgdir}/boot"
[[ $CARCH == "armv6h" ]] && rm -f "${pkgdir}"/boot/bcm{2836,2837,2838,2709,2710,2711}*.dtb
[[ $CARCH == "armv7h" ]] && rm -f "${pkgdir}"/boot/bcm{2835,2838,2708,2711}*.dtb
}

_package-headers() {
Expand All @@ -145,66 +105,75 @@ _package-headers() {
replaces=('linux-raspberrypi-latest-headers')

cd ${_srcname}
local _builddir="${pkgdir}/usr/lib/modules/${_kernver}/build"
local builddir="$pkgdir/usr/lib/modules/$(<version)/build"

install -Dt "${_builddir}" -m644 Makefile .config Module.symvers
install -Dt "${_builddir}/kernel" -m644 kernel/Makefile
echo "Installing build files..."
install -Dt "$builddir" -m644 .config Makefile Module.symvers System.map \
localversion.* version
install -Dt "$builddir/kernel" -m644 kernel/Makefile
install -Dt "$builddir/arch/$KARCH" -m644 "arch/$KARCH/Makefile"
cp -t "$builddir" -a scripts

mkdir "${_builddir}/.tmp_versions"

cp -t "${_builddir}" -a include scripts
# add xfs and shmem for aufs building
mkdir -p "$builddir"/{fs/xfs,mm}

install -Dt "${_builddir}/arch/${KARCH}" -m644 arch/${KARCH}/Makefile
install -Dt "${_builddir}/arch/${KARCH}/kernel" -m644 arch/${KARCH}/kernel/asm-offsets.s scripts/module.lds
echo "Installing headers..."
cp -t "$builddir" -a include
cp -t "$builddir/arch/$KARCH" -a "arch/$KARCH/include"
install -Dt "$builddir/arch/$KARCH/kernel" -m644 "arch/$KARCH/kernel/asm-offsets.s"

cp -t "${_builddir}/arch/${KARCH}" -a arch/${KARCH}/include
install -Dt "$builddir/drivers/md" -m644 drivers/md/*.h
install -Dt "$builddir/net/mac80211" -m644 net/mac80211/*.h

install -Dt "${_builddir}/drivers/md" -m644 drivers/md/*.h
install -Dt "${_builddir}/net/mac80211" -m644 net/mac80211/*.h
# https://bugs.archlinux.org/task/13146
install -Dt "$builddir/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h

# http://bugs.archlinux.org/task/13146
install -Dt "${_builddir}/drivers/media/i2c" -m644 drivers/media/i2c/msp3400-driver.h
# https://bugs.archlinux.org/task/20402
install -Dt "$builddir/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
install -Dt "$builddir/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
install -Dt "$builddir/drivers/media/tuners" -m644 drivers/media/tuners/*.h

# http://bugs.archlinux.org/task/20402
install -Dt "${_builddir}/drivers/media/usb/dvb-usb" -m644 drivers/media/usb/dvb-usb/*.h
install -Dt "${_builddir}/drivers/media/dvb-frontends" -m644 drivers/media/dvb-frontends/*.h
install -Dt "${_builddir}/drivers/media/tuners" -m644 drivers/media/tuners/*.h
# https://bugs.archlinux.org/task/71392
install -Dt "$builddir/drivers/iio/common/hid-sensors" -m644 drivers/iio/common/hid-sensors/*.h

# add xfs and shmem for aufs building
mkdir -p "${_builddir}"/{fs/xfs,mm}
echo "Installing KConfig files..."
find . -name 'Kconfig*' -exec install -Dm644 {} "$builddir/{}" \;

# copy in Kconfig files
find . -name Kconfig\* -exec install -Dm644 {} "${_builddir}/{}" \;

# remove unneeded architectures
echo "Removing unneeded architectures..."
local _arch
for _arch in "${_builddir}"/arch/*/; do
[[ ${_arch} == */${KARCH}/ ]] && continue
rm -r "${_arch}"
for _arch in "$builddir"/arch/*/; do
[[ $_arch = */"$KARCH"/ ]] && continue
echo "Removing $(basename "$_arch")"
rm -r "$_arch"
done

# remove files already in linux-docs package
rm -r "${_builddir}/Documentation"

# remove now broken symlinks
find -L "${_builddir}" -type l -printf 'Removing %P\n' -delete

# Fix permissions
if ! chmod -R u=rwX,go=rX "${_builddir}"; then
true
fi

# strip scripts directory
local _binary _strip
while read -rd '' _binary; do
case "$(file -bi "${_binary}")" in
*application/x-sharedlib*) _strip="${STRIP_SHARED}" ;; # Libraries (.so)
*application/x-archive*) _strip="${STRIP_STATIC}" ;; # Libraries (.a)
*application/x-executable*) _strip="${STRIP_BINARIES}" ;; # Binaries
*) continue ;;
echo "Removing documentation..."
rm -r "$builddir/Documentation"

echo "Removing broken symlinks..."
find -L "$builddir" -type l -printf 'Removing %P\n' -delete

echo "Removing loose objects..."
find "$builddir" -type f -name '*.o' -printf 'Removing %P\n' -delete

echo "Stripping build tools..."
local file
while read -rd '' file; do
case "$(file -bi "$file")" in
application/x-sharedlib\;*) # Libraries (.so)
strip -v $STRIP_SHARED "$file" ;;
application/x-archive\;*) # Libraries (.a)
strip -v $STRIP_STATIC "$file" ;;
application/x-executable\;*) # Binaries
strip -v $STRIP_BINARIES "$file" ;;
application/x-pie-executable\;*) # Relocatable binaries
strip -v $STRIP_SHARED "$file" ;;
esac
/usr/bin/strip ${_strip} "${_binary}"
done < <(find "${_builddir}/scripts" -type f -perm -u+w -print0 2>/dev/null)
done < <(find "$builddir" -type f -perm -u+x)

echo "Adding symlink..."
mkdir -p "$pkgdir/usr/src"
ln -sr "$builddir" "$pkgdir/usr/src/$pkgbase"
}

pkgname=("${pkgbase}" "${pkgbase}-headers")
Expand Down
7 changes: 4 additions & 3 deletions core/linux-raspberrypi/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 5.10.52-4 Kernel Configuration
# Linux/arm 5.10.63 Kernel Configuration
#
CONFIG_CC_VERSION_TEXT="gcc (GCC) 10.2.0"
CONFIG_CC_IS_GCC=y
Expand Down Expand Up @@ -4087,7 +4087,7 @@ CONFIG_REGULATOR_GPIO=y
# CONFIG_REGULATOR_PV88080 is not set
# CONFIG_REGULATOR_PV88090 is not set
# CONFIG_REGULATOR_PWM is not set
# CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY is not set
CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY=m
# CONFIG_REGULATOR_RT4801 is not set
# CONFIG_REGULATOR_RTMV20 is not set
# CONFIG_REGULATOR_SLG51000 is not set
Expand Down Expand Up @@ -4548,6 +4548,7 @@ CONFIG_VIDEO_IMX290=m
CONFIG_VIDEO_IMX477=m
# CONFIG_VIDEO_IMX319 is not set
# CONFIG_VIDEO_IMX355 is not set
CONFIG_VIDEO_IMX519=m
# CONFIG_VIDEO_OV2640 is not set
# CONFIG_VIDEO_OV2659 is not set
# CONFIG_VIDEO_OV2680 is not set
Expand Down Expand Up @@ -4978,7 +4979,7 @@ CONFIG_DRM_DISPLAY_CONNECTOR=m
# CONFIG_DRM_SII9234 is not set
CONFIG_DRM_SIMPLE_BRIDGE=m
# CONFIG_DRM_THINE_THC63LVD1024 is not set
# CONFIG_DRM_TOSHIBA_TC358762 is not set
CONFIG_DRM_TOSHIBA_TC358762=m
# CONFIG_DRM_TOSHIBA_TC358764 is not set
# CONFIG_DRM_TOSHIBA_TC358767 is not set
# CONFIG_DRM_TOSHIBA_TC358768 is not set
Expand Down
10 changes: 0 additions & 10 deletions core/linux-raspberrypi/linux.preset

This file was deleted.

3 comments on commit dbd80e6

@stevegk
Copy link

@stevegk stevegk commented on dbd80e6 Oct 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit breaks rebuilding the initramfs, both for kernel and other upgrades such as the recent systemd update - see comments in this pull request #1767.

@graysky2
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will need to look into this. Do you know how Arch is handling these rebuilds? I believe changes have been made to mkinitcpio which have been propagated here.

@stevegk
Copy link

@stevegk stevegk commented on dbd80e6 Oct 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes the mkinitcpio changes are here. I'm still figuring out exactly what ARCH does, I'm no expert, but AFAICT it uses this hook /usr/share/libalpm/hooks/90-mkinitcpio-install.hook which calls this script /usr/share/libalpm/scripts/mkinitcpio-install from mkinitcpio and depending on the trigger conditions will install the kernel, do something with depmod and create a *.preset file automatically and generate the iniramfs. However, the trigger conditions seem to rely on the kernel being named vmlinuz and having vmlinuz in the path, which is why this change breaks.

I haven't got a solution, its taken me sometime to work out why things stopped, but I can see a couple of potential ways forward. Neither are straightforward, as Kevin and eworm point out in the linked pull request.

First option copy the conventions of ARCH and rename the kernel, but I don't if know if just renaming the kernel will work because I haven't fully figured out the script. I do know it won't do anything with the device tree stuff. But how depmod works in ARCH and how it will interact with what you've done here I don't know.

Second option is use what you've done but also install a hook and preset, but this kinda feels like a step backward but might be the simplest.

As an aside - running

sudo mkinitcpio -g /boot/initramfs-linux.img

should regenerate the initramfs as long as your system is running

Please sign in to comment.