main/postmarketos-mkinitfs: enable profiling with bootchart (!852)

If (a) the kernel command line parameters include PMOS_BOOTCHART2 and
(b) /sbin/bootchartd exists (i.e., the bootchart2 package has been
installed), run /sbin/bootchartd instead of /sbin/init.
This commit is contained in:
Pops Dylan 2020-01-01 20:12:20 -08:00 committed by Alexey Min
parent e068de2de5
commit 8760409717
No known key found for this signature in database
GPG Key ID: 463F84201DACD7B9
3 changed files with 29 additions and 7 deletions

View File

@ -1,6 +1,6 @@
pkgname=postmarketos-mkinitfs
pkgver=0.8.0
pkgrel=1
pkgrel=2
pkgdesc="Tool to generate initramfs images for postmarketOS"
url="https://postmarketos.org"
# multipath-tools: kpartx
@ -23,6 +23,6 @@ package() {
"$pkgdir/sbin/mkinitfs"
mkdir -p "$pkgdir/etc/postmarketos-mkinitfs/hooks/"
}
sha512sums="8be7f29394f8cd4e1c4b93f018f6314350f7e37e20d242c97284c1b112a106f882318a101bc0c70b391590b969023901580c677ee9f869850e90e69171a44e80 init.sh.in
44571b62e4d326355fa7d96add9a9115a89db3b6ce12c17aa4b0d5bd02d63d5b5d3152305af18795938bc9479d37b44e9a14268efa28a8c114c77ed498a7d65b init_functions.sh
sha512sums="1d49db8a48ad513cc548b8a0ea23cc64518e71c93863155b4e9d2271fb46090506331c03d6955d693c8568c248ecc76b218efe4a6f6bba57c41c5f6d775dc61b init.sh.in
3bcec7b35ced7e87c301f71a892e54aa40983396e2ebaa3c8cbd84c91f711b3ca0e30fbc3104b1a1018ec1af51844ba90a63d380359b51db6242562d21776ed0 init_functions.sh
3f918f8b5967b73e507c2ddf36dccc24fee98298f05ca23e22605400de95137f8877e09769616e7db388557c645fb45c03e1e6b5bab815ec9f853c318f0431f1 mkinitfs.sh"

View File

@ -44,6 +44,9 @@ unlock_root_partition
resize_root_filesystem
mount_root_partition
init="/sbin/init"
setup_bootchart2
# Switch root
killall telnetd mdev msm-fb-refresher 2>/dev/null
umount /boot
@ -53,7 +56,7 @@ umount /dev/pts
umount /dev
# shellcheck disable=SC2093
exec switch_root /sysroot /sbin/init
exec switch_root /sysroot "$init"
echo "ERROR: switch_root failed!"
echo "Looping forever. Install and use the debug-shell hook to debug this."

View File

@ -374,7 +374,7 @@ start_udhcpd() {
udhcpd
}
setup_directfb_tslib(){
setup_directfb_tslib() {
# Set up directfb and tslib
# Note: linux_input module is disabled since it will try to take over
# the touchscreen device from tslib (e.g. on the N900)
@ -385,14 +385,14 @@ setup_directfb_tslib(){
fi
}
start_onscreen_keyboard(){
start_onscreen_keyboard() {
setup_directfb_tslib
osk-sdl -n root -d "$partition" -c /etc/osk.conf -v > /osk-sdl.log 2>&1
unset DFBARGS
unset TSLIB_TSDEVICE
}
start_charging_mode(){
start_charging_mode() {
# Check cmdline for charging mode
chargingmodes="
androidboot.mode=charger
@ -465,6 +465,25 @@ setup_framebuffer() {
set_framebuffer_mode
}
setup_bootchart2() {
if grep -q PMOS_BOOTCHART2 /proc/cmdline; then
if [ -f "/sysroot/sbin/bootchartd" ]; then
# shellcheck disable=SC2034
init="/sbin/bootchartd"
echo "remounting /sysroot as rw for /sbin/bootchartd"
mount -o remount, rw /sysroot
# /dev/null may not exist at the first boot after
# the root filesystem has been created.
[ -c /sysroot/dev/null ] && return
echo "creating /sysroot/dev/null for /sbin/bootchartd"
mknod -m 666 "/sysroot/dev/null" c 1 3
else
echo "WARNING: bootchart2 is not installed."
fi
fi
}
loop_forever() {
while true; do
sleep 1