Unified linux-postmarketos kernel for qemu and n900 (#228)

The creates the linux-postmarketos package which for now supports the n900 (and probably the other maemo devices) and qemu with the vexpress-a9 machine simulation.

I've put the generated dtbs in /usr/share/dtb for now and set the dtb field in the deviceinfo for the n900 and my new qemu device.

* Introduced linux-postmarketos-omap
* Unified kernel progress
* Created kernel bootable with qemu
* Updated n900 deviceinfo for generic kernel
* Changed qemu device to vexpress
* Updated APK comments and added linux-postmarketos-dev package
* Append dtb in mkinitfs
* Fixed bootscript on n900 for the generic kernel
* Don't detect double flavors with -dtb appending
* Added graphics drivers for vexpress (qemu)
* Added more drivers for qemu

This adds virtio network support in qemu for the vexpress-a9 machine.
The keyboard and mouse don't work yet.
You can boot into weston if --no-fde is specified
This commit is contained in:
Martijn Braam 2017-07-25 22:08:35 +02:00 committed by Oliver Smith
parent 900a661cab
commit bed8ab6427
13 changed files with 5931 additions and 164 deletions

View file

@ -1,11 +1,11 @@
pkgname=device-nokia-rx51
pkgver=1
pkgrel=10
pkgrel=11
pkgdesc="Nokia N900"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-nokia-rx51 uboot-tools linux-firmware"
depends="linux-postmarketos uboot-tools linux-firmware"
makedepends="uboot-tools"
install="$pkgname.post-install"
subpackages=""
@ -33,8 +33,8 @@ package() {
"$pkgdir"/etc/acpi.map
}
sha512sums="d8950025dc1f4c9de9da72fe363e3dc34ae6c18ecbb77a1e60d61456b6f181f7867cf4848ecf457de6fc8651bff052d823a120eea14e9facb6daadbd5d6195c9 deviceinfo
36fdcdc32e75ad82402d7f8dc6ec5879002513b3552ae4cf755df52f2c3df7b12c3ab0aae8ea8207a7fa22240b88f8098fd283298d08f923f9b07b7964289b83 uboot-script.cmd
sha512sums="4efa28cfb35b0ceb783f15fbcf05d7302690d2d767ec7b87578741ccd52988fdc2095baf2a5ce66b964fb0cb151d05238f223a60a9a52c3670bd7b20ead2862a deviceinfo
66dfff0d87cbe7c98162c941704c4d6009c70612a59bfb88c6249638b5215ef0a8ec46932621ccafb6d6050e52e950e5c5d61aa158b9df4557a61670509c47ba uboot-script.cmd
3d55e34b95791636e44a5f41754f3d0de039dbba41f7a556d43a95c9e64afcfa930046b4b96b40020b6f196096ffba93514682927e32fa4488686fdd19c6da5a backlight-enable.sh
98c554a709d6e8da5835bd792d833355d830fca1cfea12ec7fe4f41d1d1126389c51a8a392a7f94093473c19263cc6846cc40d7e179c2facf12db2d68ff923f9 90-touchscreen-dev.rules
df5dcae9a32d04ba2fed8b4dbb8722f8d56d063a288dfbaeca37806bdbb8ba4de639b392859b9f24040a1032456d5dcd754f51314e3ab66515b91ae1e03c93a7 acpi_handler.sh

View file

@ -7,7 +7,7 @@ deviceinfo_manufacturer="Nokia"
deviceinfo_date=""
deviceinfo_keyboard="true"
deviceinfo_nonfree="????"
deviceinfo_dtb=""
deviceinfo_dtb="omap3-n900"
deviceinfo_modules_initfs="tsc2005 tsc200x-core omap_wdt twl4030_wdt"
deviceinfo_external_disk="true"
deviceinfo_external_disk_install="true"

View file

@ -3,8 +3,8 @@ setenv mmcpart 1
setenv mmctype ext2
setenv setup_omap_atag 1
setenv bootargs init=/init.sh rw console=tty0 console=tty02 omapfb_vram=7M omapfb.mode=lcd:848x480-16 nokia-modem.pm=0
setenv mmckernfile /uImage-nokia-rx51
setenv mmcinitrdfile /uInitrd-nokia-rx51
setenv mmckernfile /uImage-postmarketos
setenv mmcinitrdfile /uInitrd-postmarketos
setenv mmcscriptfile
echo Loading initramfs
run initrdload

View file

@ -0,0 +1,23 @@
pkgname=device-qemu-amd64
pkgver=1
pkgrel=1
pkgdesc="Simulated device in qemu with an x86 platform"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-postmarketos"
makedepends=""
subpackages=""
source="deviceinfo"
options="!check"
build() {
return 0
}
package() {
install -D -m644 "$srcdir"/deviceinfo \
"$pkgdir"/etc/deviceinfo
}
sha512sums="6d8c51d5b3d8e59640bdb4272fcd70fb8d262d6233133725b49e3e832ee713710377761456684223d9f4d311c2285bf41e92d88b68ce01963fe5c8ca132117db deviceinfo"

View file

@ -0,0 +1,20 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Qemu amd64"
deviceinfo_manufacturer="Qemu"
deviceinfo_date=""
deviceinfo_keyboard="true"
deviceinfo_nonfree="????"
deviceinfo_dtb=""
deviceinfo_modules_initfs=""
deviceinfo_external_disk="true"
deviceinfo_external_disk_install="true"
deviceinfo_flash_methods="none"
deviceinfo_generate_legacy_uboot_initfs="false"
deviceinfo_arch="x86_64"
# Splash
deviceinfo_screen_width="640"
deviceinfo_screen_height="480"

View file

@ -0,0 +1,23 @@
pkgname=device-qemu-vexpress
pkgver=1
pkgrel=7
pkgdesc="Simulated device in qemu with vexpress soc"
url="https://github.com/postmarketOS"
arch="noarch"
license="MIT"
depends="linux-postmarketos"
makedepends=""
subpackages=""
source="deviceinfo"
options="!check"
build() {
return 0
}
package() {
install -D -m644 "$srcdir"/deviceinfo \
"$pkgdir"/etc/deviceinfo
}
sha512sums="cd0caab21677b5abfc4d58565831e3f1bcca87dd32626625a2ba9bbe53650aa7557d56a46a8cf1557725ecbe43a38e9e9c4637b8d9e925b1a8fbcb0710f7d521 deviceinfo"

View file

@ -0,0 +1,20 @@
# Reference: <https://postmarketos.org/deviceinfo>
# Please use double quotes only. You can source this file in shell scripts.
deviceinfo_format_version="0"
deviceinfo_name="Qemu armhf vexpress"
deviceinfo_manufacturer="Qemu"
deviceinfo_date=""
deviceinfo_keyboard="true"
deviceinfo_nonfree="????"
deviceinfo_dtb="vexpress-v2p-ca9"
deviceinfo_modules_initfs="amba-clcd virtio_net virtio_mmio ambakmi libps2 pcips2"
deviceinfo_external_disk="true"
deviceinfo_external_disk_install="true"
deviceinfo_flash_methods="none"
deviceinfo_generate_legacy_uboot_initfs="false"
deviceinfo_arch="armhf"
# Splash
deviceinfo_screen_width="640"
deviceinfo_screen_height="480"

View file

@ -1,121 +0,0 @@
# APKBUILD based on linux-vanilla aport. Changes:
# - disabled module installation
# - add !check !tracedeps
# - package: just install zimage and kernel.release, because the kernel config
# does not generate modules or dtb files
# - do not create -dev subpackage (makes no sense without module support)
#
# Kernel config based on: arch/arm/configs/lineageos_mako_defconfig
# Changes:
# - enable devtmpfs (needed for udev -> touch support in weston)
_vendor=nokia
_flavor=nokia-rx51
_hash="7b6fbfd899b4133e4f789843e5967beb139ec4d2"
_config="config-${_flavor}.armhf"
pkgname=linux-${_flavor}
pkgver=4.12.3
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=1
arch="armhf"
pkgdesc="Mainline Linux for the Nokia N900"
url="https://github.com/pali/linux-n900"
depends="postmarketos-mkinitfs"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev uboot-tools"
options="!strip !check !tracedeps"
install=
source="
https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-"$pkgver".tar.xz
$_config
"
subpackages=""
license="GPL2"
_abi_release=${pkgver}
_carch="arm"
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
ksrcdir="$srcdir/linux-$pkgver"
prepare() {
local _patch_failed=
cd "$ksrcdir"
# first apply patches in specified order
for i in $source; do
case $i in
*.patch)
msg "Applying $i..."
if ! patch -s -p1 -N -i "$srcdir"/$i; then
echo $i >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
mkdir -p "$srcdir"/build
cp "$srcdir"/$_config "$srcdir"/build/.config || return 1
make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
silentoldconfig
}
# this is so we can do: 'abuild menuconfig' to reconfigure kernel
menuconfig() {
cd "$srcdir"/build || return 1
make ARCH="$_carch" menuconfig
cp .config "$startdir"/$_config
}
build() {
cd "$srcdir"/build
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \
CFLAGS_MODULE=-fno-pic \
zImage modules omap3-n900.dtb \
|| return 1
}
package() {
cd "$srcdir/build/arch/arm/boot"
cat zImage dts/omap3-n900.dtb > zImage-dtb
mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n postmarketos -d zImage-dtb uImage
install -Dm644 "$srcdir/build/arch/arm/boot/uImage" \
"$pkgdir/boot/uImage-$_flavor"
install -Dm644 "$srcdir/build/arch/arm/boot/zImage-dtb" \
"$pkgdir/boot/vmlinuz-$_flavor"
install -Dm644 "$srcdir/build/arch/arm/boot/dts/omap3-n900.dtb" \
"$pkgdir/boot/omap3-n900.dtb"
install -D "$srcdir/build/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
cd "$srcdir"/build
make -j1 modules_install \
ARCH="$_carch" \
INSTALL_MOD_PATH="$pkgdir" \
|| return 1
}
sha512sums="292ca975da27d9ec7dd96d5dd1df0208e88c53c4bf20608ad383148c2b7d331c2fe41b129b5b7e72564259a1fcaabf84b860a435e406528a4882b7a3e7412573 linux-4.12.3.tar.xz
1a9fc469806b44c9ca4355a9f1ff9cc07c282793bf9bd022acfda26361a51233d9f1ddd14c7f439a13dab28a17b039fa229135aa2c5319e4cc0df1d2d0a14dca config-nokia-rx51.armhf"

182
linux-postmarketos/APKBUILD Normal file
View file

@ -0,0 +1,182 @@
# APKBUILD loosely based on linux-vanilla aport. Changes:
#
# - Use new kernel config for the postmarketos device support
# - Package the device tree files
#
# Kernel config based on: arch/arm/configs/lineageos_mako_defconfig
# Changes:
# - enable devtmpfs (needed for udev -> touch support in weston)
_flavor=postmarketos
_hash="7b6fbfd899b4133e4f789843e5967beb139ec4d2"
_config="config-${_flavor}.${CARCH}"
pkgname=linux-${_flavor}
pkgver=4.12.3
case $pkgver in
*.*.*) _kernver=${pkgver%.*};;
*.*) _kernver=$pkgver;;
esac
pkgrel=1
arch="all"
pkgdesc="Mainline Linux for pmOS supported chipsets (OMAP)"
url="https://kernel.org/"
depends="postmarketos-mkinitfs"
makedepends="perl sed installkernel bash gmp-dev bc linux-headers elfutils-dev"
options="!strip !check !tracedeps"
install=
source="
https://cdn.kernel.org/pub/linux/kernel/v${pkgver%%.*}.x/linux-$_kernver.tar.xz
config-${_flavor}.armhf
config-${_flavor}.x86_64
"
subpackages="$pkgname-dev::$CBUILD_ARCH"
license="GPL2"
_abi_release=${pkgver}
_carch=${CARCH}
case "$_carch" in
aarch64*) _carch="arm64" ;;
arm*) _carch="arm" ;;
ppc*) _carch="powerpc" ;;
s390*) _carch="s390" ;;
esac
HOSTCC="${CC:-gcc}"
HOSTCC="${HOSTCC#${CROSS_COMPILE}}"
ksrcdir="$srcdir/linux-$_kernver"
prepare() {
local _patch_failed=
cd "$ksrcdir"
# first apply patches in specified order
for i in $source; do
case $i in
*.patch)
msg "Applying $i..."
if ! patch -s -p1 -N -i "$srcdir"/$i; then
echo $i >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
mkdir -p "$srcdir"/build
cp -v "$srcdir"/$_config "$srcdir"/build/.config || return 1
make -C "$ksrcdir" O="$srcdir"/build ARCH="$_carch" HOSTCC="$HOSTCC" \
silentoldconfig
}
# this is so we can do: 'abuild menuconfig' to reconfigure kernel
menuconfig() {
cd "$srcdir"/build || return 1
make ARCH="$_carch" menuconfig
cp .config "$startdir"/$_config
}
build() {
cd "$srcdir"/build
unset LDFLAGS
make ARCH="$_carch" CC="${CC:-gcc}" \
KBUILD_BUILD_VERSION="$((pkgrel + 1 ))-Alpine" \
CFLAGS_MODULE=-fno-pic \
|| return 1
}
package() {
cd "$srcdir/build/arch/${_carch}/boot"
install -Dm644 "$srcdir/build/arch/${_carch}/boot/"*zImage \
"$pkgdir/boot/vmlinuz-$_flavor"
install -D "$srcdir/build/include/config/kernel.release" \
"$pkgdir/usr/share/kernel/$_flavor/kernel.release"
cd "$srcdir"/build
local _install
case "$CARCH" in
aarch64*|arm*) _install="modules_install dtbs_install" ;;
*) _install="modules_install" ;;
esac
make -j1 $_install \
ARCH="$_carch" \
INSTALL_MOD_PATH="$pkgdir" \
INSTALL_DTBS_PATH="pkgdir" \
|| return 1
if [ -d "$pkgdir/arch/${_carch}/boot/dts" ]; then
mv "$pkgdir/arch/${_carch}/boot/dts" "$pkgdir/usr/share"
fi
}
dev() {
# copy the only the parts that we really need for build 3rd party
# kernel modules and install those as /usr/src/linux-headers,
# simlar to what ubuntu does
#
# this way you dont need to install the 300-400 kernel sources to
# build a tiny kernel module
#
pkgdesc="Headers and script for third party modules for postmarketos kernel"
depends="gmp-dev bash perl"
local dir="$subpkgdir"/usr/src/linux-headers-${_abi_release}
# first we import config, run prepare to set up for building
# external modules, and create the scripts
mkdir -p "$dir"
cp "$srcdir"/$_config "$dir"/.config
make -j1 -C "$srcdir"/linux-$_kernver O="$dir" ARCH="$_carch" HOSTCC="$HOSTCC" \
silentoldconfig prepare modules_prepare scripts
# needed for 3rd party modules
# https://bugzilla.kernel.org/show_bug.cgi?id=11143
case "$CARCH" in
ppc*) (cd "$dir" && make arch/powerpc/lib/crtsavres.o);;
esac
# remove the stuff that points to real sources. we want 3rd party
# modules to believe this is the soruces
rm "$dir"/Makefile "$dir"/source
# copy the needed stuff from real sources
#
# this is taken from ubuntu kernel build script
# http://kernel.ubuntu.com/git/ubuntu/ubuntu-zesty.git/tree/debian/rules.d/3-binary-indep.mk
cd "$srcdir"/linux-$_kernver
find . -path './include/*' -prune \
-o -path './scripts/*' -prune -o -type f \
\( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
-name '*.sh' -o -name '*.pl' -o -name '*.lds' \) \
-print | cpio -pdm "$dir" || return 1
cp -a scripts include "$dir"
find $(find arch -name include -type d -print) -type f \
| cpio -pdm "$dir"
install -Dm644 "$srcdir"/build/Module.symvers \
"$dir"/Module.symvers
mkdir -p "$subpkgdir"/lib/modules/${_abi_release}
ln -sf /usr/src/linux-headers-${_abi_release} \
"$subpkgdir"/lib/modules/${_abi_release}/build
}
sha512sums="8e81b41b253e63233e92948941f44c6482acb52aa3a3fd172f03a38a86f2c35b2ad4fd407acd1bc3964673eba344fe104d3a03e3ff4bf9cd1f22bd44263bd728 linux-4.12.tar.xz
3f4435ce0cf227e4ba64aa7153c913370c53069e34a376e453786d601b5a73706a3f44b002fab1b10a72dc94e896c1d8fb462c2b78e62ed69c468d98aa7220da config-postmarketos.armhf
a657c7fe0ebd5deba7c335ef8536d15edfdfb112dd4078d41710cad8db17cb86b88879b144d3ca34dddceb1ec841f65a4842a0ef0ae9dc48980eeeffc8545efa config-postmarketos.x86_64"

File diff suppressed because it is too large Load diff

View file

@ -29,5 +29,5 @@ package() {
}
sha512sums="22418d8869448b456a775f03b18d7b4e13f3cac1129233ced42caf67c3aea4abcc6488fcba2acb5e20dd72f2a6da6419938ac44751a5ba175f02eab586573c43 init.sh.in
6d130be59507ad6c755ce8dfe345335e54b3891ca484e7865246ce69fe9d4e6441247acf6d17cc2ff414aaa0aca13fc28c8956b90f1626b784429adc3b5bf866 init_functions.sh
76abcc7b206126c82f500556187174915aa11d67ccabee90228fb426bf77d3a6e28f512c117f93d5e579dd878f343c55d27124c402be777c7ab9499d7f40fc7c mkinitfs.sh
81d2782d0c4098dc503c52172a62ea90b6495d5a397f49c6a1544444e48f74e3645f17db6b710330ba70eb13defd81c47b9b5d1326146cbcd17bee59ff89b99d mkinitfs.sh
8129300894f0b91ba669c12df2e51fb8dd9a9366da26496523047782026714444f40037b88d3e56dc28e3049901c32bf2a4959390883dfbbff8cfa19bb82045f 10-usb-unlock.sh"

View file

@ -135,11 +135,18 @@ create_cpio_image()
}
# Legacy u-boot images
create_uinitrd()
create_uboot_files()
{
[ "${deviceinfo_generate_legacy_uboot_initfs}" == "true" ] || return
echo "==> initramfs: creating uInitrd"
mkimage -A arm -T ramdisk -C none -n uInitrd -d "$outfile" "${outfile/initramfs-/uInitrd-}"
echo "==> kernel: creating uImage"
kernelfile="${outfile/initramfs-/vmlinuz-}"
if [ -n "${deviceinfo_dtb}" ]; then
kernelfile="${kernelfile}-dtb"
fi
mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n postmarketos -d $kernelfile "${outfile/initramfs-/uImage-}"
}
# Android devices
@ -149,8 +156,13 @@ create_bootimg()
echo "==> initramfs: creating boot.img"
_base="${deviceinfo_flash_offset_base}"
[ -z "$_base" ] && _base="0x10000000"
kernelfile="${outfile/initramfs-/vmlinuz-}"
if [ -n "${deviceinfo_dtb}" ]; then
kernelfile="${kernelfile}-dtb"
fi
mkbootimg \
--kernel "${outfile/initramfs-/vmlinuz-}" \
--kernel "${kernelfile}" \
--ramdisk "$outfile" \
--base "${_base}" \
--second_offset "${deviceinfo_flash_offset_second}" \
@ -178,6 +190,16 @@ generate_splash_screens()
gzip "${tmpdir}/splash2.ppm"
}
# Append the correct device tree to the linux image file
append_device_tree()
{
[ -n "${deviceinfo_dtb}" ] || return
dtb="/usr/share/dtb/${deviceinfo_dtb}.dtb"
kernel="${outfile/initramfs-/vmlinuz-}"
echo "==> kernel: appending device-tree ${deviceinfo_dtb}"
cat $kernel $dtb > "${kernel}-dtb"
}
# initialize
source_deviceinfo
parse_commandline $1 $2 $3
@ -200,7 +222,8 @@ install -Dm755 "/usr/share/postmarketos-mkinitfs/init_functions.sh" \
generate_splash_screens
replace_init_variables
create_cpio_image
create_uinitrd
append_device_tree
create_uboot_files
create_bootimg
rm -rf "$tmpdir"