Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: seamless boot splash, daemon for disabling keyboard and touchpad, and remove gzip compression on initramfs #215

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
tmp.*
PrawnOS-Shiba-*
PrawnOS-initramfs.cpio.gz
PrawnOS-initramfs.cpio
build
kernel/sources/linux-*.tar.gz
*.dsc
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ To begin with:

`make filesystem` builds the -BASE filesystem image with no kernel

`make initramfs` builds the PrawnOS-initramfs.cpio.gz, which can be found in /build
`make initramfs` builds the PrawnOS-initramfs.cpio, which can be found in /build

`make image` builds the initramfs image, builds the kernel, builds the filesystem if a -BASE image doesn't exist, and combines the two into a new PrawnOS.img using kernel_install

Expand Down
Binary file added filesystem/resources/PrawnOS-1280x800
Binary file not shown.
Binary file added filesystem/resources/PrawnOS-1366x768
Binary file not shown.
1 change: 1 addition & 0 deletions filesystem/resources/splash-recover-cursor.issue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[?25h[?0c
71 changes: 71 additions & 0 deletions filesystem/resources/system.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See systemd-system.conf(5) for details.

[Manager]
#LogLevel=info
#LogTarget=journal-or-kmsg
#LogColor=yes
#LogLocation=no
#LogTime=no
#DumpCore=yes
ShowStatus=no
#CrashChangeVT=no
#CrashShell=no
#CrashReboot=no
#CtrlAltDelBurstAction=reboot-force
#CPUAffinity=1 2
#NUMAPolicy=default
#NUMAMask=
#RuntimeWatchdogSec=0
#RebootWatchdogSec=10min
#ShutdownWatchdogSec=10min
#KExecWatchdogSec=0
#WatchdogDevice=
#CapabilityBoundingSet=
#NoNewPrivileges=no
#SystemCallArchitectures=
#TimerSlackNSec=
#StatusUnitFormat=description
#DefaultTimerAccuracySec=1min
#DefaultStandardOutput=journal
#DefaultStandardError=inherit
#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
#DefaultTimeoutAbortSec=
#DefaultRestartSec=100ms
#DefaultStartLimitIntervalSec=10s
#DefaultStartLimitBurst=5
#DefaultEnvironment=
#DefaultCPUAccounting=no
#DefaultIOAccounting=no
#DefaultIPAccounting=no
#DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=yes
#DefaultTasksAccounting=yes
#DefaultTasksMax=
#DefaultLimitCPU=
#DefaultLimitFSIZE=
#DefaultLimitDATA=
#DefaultLimitSTACK=
#DefaultLimitCORE=
#DefaultLimitRSS=
#DefaultLimitNOFILE=1024:524288
#DefaultLimitAS=
#DefaultLimitNPROC=
#DefaultLimitMEMLOCK=
#DefaultLimitLOCKS=
#DefaultLimitSIGPENDING=
#DefaultLimitMSGQUEUE=
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=
26 changes: 20 additions & 6 deletions initramfs/resources/initramfs-init
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
# You should have received a copy of the GNU General Public License
# along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.

Copy link
Owner

Choose a reason for hiding this comment

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

I see some potential issues for debugging with how the splash is implemented, which would be fixed by the following:

  1. some way to disable the splash and instead get all of the console output/debug echos. Doing this without rebuilding the kernel and initramfs would be nice. I'm not sure if this is possible though...
  2. keep the debug logging if we are not presenting the splash screen
  3. the fix for (2) needs to ensure that if we do enter the rescue_shell, we print out the debug messages

Copy link
Author

@Maccraft123 Maccraft123 Sep 22, 2020

Choose a reason for hiding this comment

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

Splash can be removed with just simple 'clear' shell command
And inserting device with RESCUESHELL label should be enough, it jumps to shell before splash screen

echo In PrawnOS Init

#add this to start shell at desired point
rescue_shell() {
[ "{$1}" != "debug" ] && echo "Something went wrong. Dropping to a shell." > /dev/tty1
[ "{$1}" == "debug" ] && echo "Debug flag detected, entering debug shell" > /dev/tty1
dmesg -n 4
echo "Something went wrong. Dropping to a shell." > /dev/tty1
exec setsid /bin/sh -c 'exec /bin/sh </dev/tty1 >/dev/tty1 2>&1'
}
Expand Down Expand Up @@ -66,14 +65,26 @@ mount -n -t devtmpfs devtmpfs /dev
# get the root device, so we can find the boot partiton
UNPARSED=$(cmdline root)
ROOT_PARTUUID=$(rootpartuuid $UNPARSED)
echo ${ROOT_PARTUUID} > /dev/tty1
BLKID=$(/sbin/blkid | grep $ROOT_PARTUUID )
echo ${BLKID} > /dev/tty1
#If its an mmcblk device, the kernel partiton will p1. If it is a usb device, the partiton will just be 1
#Just want everything before the 1
ROOT_DEV="${BLKID%1:*}"

echo ${ROOT_DEV} > /dev/tty1

# happens when kernel takes its time looking for devices
Copy link
Owner

Choose a reason for hiding this comment

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

I have done many boot tests on veyron-speedy and gru-kevin and have never seen this happen. I'm not convinced it could happen, as we are already booting from the device we are looking for. What situations did you see this happen?

Copy link
Author

Choose a reason for hiding this comment

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

I was testing images on my microSD card and it has happened a few times
It may be due to its old age, or bad quality, either way, it won't hurt i think

if [ -z ${ROOT_DEV} ]
then
sleep 1
# get the root device, so we can find the boot partiton
UNPARSED=$(cmdline root)
ROOT_PARTUUID=$(rootpartuuid $UNPARSED)
BLKID=$(/sbin/blkid | grep $ROOT_PARTUUID )
#If its an mmcblk device, the kernel partiton will p1. If it is a usb device, the partiton will just be 1
ROOT_DEV="${BLKID%1:*}"
# if device is still not seen, bail out
[ -z ${ROOT_DEV} ] && rescue_shell
fi


# label any partition on the system with RESCUESHELL to enter the initramfs rescue shell before mount and root_switch.
# you can do this with "cgpt add -i 1 -l RESCUESHELL /dev/sda" for example to label the first partiton of a usb drive.
Expand All @@ -89,14 +100,17 @@ then
dmesg -n 2
echo "Opening encrypted root partition, this will take 30s..."
cryptsetup --tries 5 luksOpen ${ROOT_DEV}2 luksroot || rescue_shell
dmesg -n 7
mount /dev/mapper/luksroot /newroot
else
# mount the unencrypted root filesystem
[ -d "/newroot" ] || mkdir -p /newroot
mount ${ROOT_DEV}2 /newroot
fi

dmesg -n 1
echo -e '\033[?17;0;0c' > /dev/tty1 # magically make cursor disappear
dd status=none if=/newroot/PrawnOS-$(cat /sys/class/graphics/fb0/virtual_size | tr ',' 'x') of=/dev/fb0 # write splash to framebuffer

umount /sys
umount /proc

Expand Down
10 changes: 5 additions & 5 deletions kernel/resources/arm64/config
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,17 @@ CONFIG_SCHED_AUTOGROUP=y
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="PrawnOS-initramfs.cpio.gz"
CONFIG_INITRAMFS_SOURCE="PrawnOS-initramfs.cpio"
CONFIG_INITRAMFS_ROOT_UID=0
CONFIG_INITRAMFS_ROOT_GID=0
CONFIG_RD_GZIP=y
# CONFIG_RD_GZIP is not set
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
# CONFIG_RD_XZ is not set
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
CONFIG_INITRAMFS_COMPRESSION_GZIP=y
# CONFIG_INITRAMFS_COMPRESSION_NONE is not set
# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set
CONFIG_INITRAMFS_COMPRESSION_NONE=y
CONFIG_BOOT_CONFIG=y
# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
Expand Down Expand Up @@ -7315,7 +7315,7 @@ CONFIG_SBITMAP=y
#
CONFIG_PRINTK_TIME=y
# CONFIG_PRINTK_CALLER is not set
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=2
CONFIG_CONSOLE_LOGLEVEL_QUIET=4
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
# CONFIG_BOOT_PRINTK_DELAY is not set
Expand Down
12 changes: 5 additions & 7 deletions kernel/resources/armhf/config
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@ CONFIG_NET_NS=y
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE="PrawnOS-initramfs.cpio.gz"
CONFIG_INITRAMFS_SOURCE="PrawnOS-initramfs.cpio"
CONFIG_INITRAMFS_ROOT_UID=0
CONFIG_INITRAMFS_ROOT_GID=0
CONFIG_RD_GZIP=y
# CONFIG_RD_BZIP2 is not set
# CONFIG_RD_LZMA is not set
CONFIG_RD_XZ=y
# CONFIG_RD_XZ is not set
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
CONFIG_INITRAMFS_COMPRESSION=".gz"
CONFIG_INITRAMFS_COMPRESSION=""
# CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
Expand Down Expand Up @@ -5275,7 +5275,6 @@ CONFIG_SECURITYFS=y
CONFIG_SECURITY_NETWORK=y
# CONFIG_SECURITY_NETWORK_XFRM is not set
CONFIG_SECURITY_PATH=y
CONFIG_LSM_MMAP_MIN_ADDR=32768
CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR=y
CONFIG_HARDENED_USERCOPY=y
CONFIG_HARDENED_USERCOPY_FALLBACK=y
Expand All @@ -5302,8 +5301,7 @@ CONFIG_INTEGRITY=y
CONFIG_INTEGRITY_AUDIT=y
# CONFIG_IMA is not set
# CONFIG_EVM is not set
CONFIG_DEFAULT_SECURITY_SELINUX=y
Copy link
Owner

Choose a reason for hiding this comment

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

This doesn't actually disable selinux, just changes when it is loaded. Instead of loading selinux then U DAC, it loads U DAC first. If this fixes the issue you are seeing, great, its a win-win.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah, I see, you reverted the change that disabled SElinux and this config change stayed?

# CONFIG_DEFAULT_SECURITY_DAC is not set
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_LSM="yama,loadpin,safesetid,integrity,selinux,smack,tomoyo,apparmor"

#
Expand Down Expand Up @@ -5589,7 +5587,7 @@ CONFIG_SBITMAP=y
#
CONFIG_PRINTK_TIME=y
# CONFIG_PRINTK_CALLER is not set
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=7
CONFIG_CONSOLE_LOGLEVEL_DEFAULT=1
CONFIG_CONSOLE_LOGLEVEL_QUIET=4
CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4
# CONFIG_BOOT_PRINTK_DELAY is not set
Expand Down
2 changes: 1 addition & 1 deletion scripts/BuildScripts/BuildCommon.mk
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ PRAWNOS_KERNEL_PACKAGE_IMAGE := $(PRAWNOS_KERNEL_PACKAGES)/prawnos-linux-image-$
PRAWNOS_KERNEL_PACKAGE_HEADERS := $(PRAWNOS_KERNEL_PACKAGES)/prawnos-linux-headers-$(TARGET)

### INITRAMFS
PRAWNOS_INITRAMFS_IMAGE := $(PRAWNOS_BUILD)/PrawnOS-initramfs.cpio.gz
PRAWNOS_INITRAMFS_IMAGE := $(PRAWNOS_BUILD)/PrawnOS-initramfs.cpio

### ATH9K
PRAWNOS_ATH9K_BUILD := $(PRAWNOS_BUILD_SHARED)/open-ath9k-htc-firmware
Expand Down
25 changes: 25 additions & 0 deletions scripts/BuildScripts/FilesystemScripts/buildFilesystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ cp $build_resources_apt/deb.prawnos.com.gpg.key $outmnt/InstallResources/
chroot $outmnt apt-key add /InstallResources/deb.prawnos.com.gpg.key
chroot $outmnt apt update

#Copy splash screen
cp $build_resources/PrawnOS-* $outmnt/

#Copy /etc/issue
mkdir -p $outmnt/etc/issue.d/
cp $build_resources/splash-recover-cursor.issue $outmnt/etc/issue.d/splash-recover-cursor.issue

#Setup the locale
cp $build_resources/locale.gen $outmnt/etc/locale.gen
chroot $outmnt locale-gen
Expand Down Expand Up @@ -314,6 +321,24 @@ echo -n "127.0.0.1 PrawnOS" > $outmnt/etc/hosts
#Cleanup apt retry
chroot $outmnt rm -f /etc/apt/apt.conf.d/80-retries

#Copy systemd config. This is on the end to make sure that no package overrides this
cp $build_resources/system.conf $outmnt/etc/systemd/

#install hwdb file for iio-sensor-proxy to work
printf 'sensor:modalias:platform:*\n ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1\n' > $outmnt/etc/udev/hwdb.d/61-sensor-local.hwdb
Copy link
Owner

Choose a reason for hiding this comment

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

I see parts of this repeated in the buildFilesystem and the InstallPackages scripts, are both necessary?

Copy link
Author

Choose a reason for hiding this comment

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

When i was testing, when it was only on buildFilesystem or InstallPackages it was either not working on system before installing, or after installing.

Copy link
Author

Choose a reason for hiding this comment

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

oh and it needs to be tested on kevin and bob

chroot $outmnt systemd-hwdb update

#make bootsplash not disappear again
chroot $outmnt systemctl mask plymouth-start
chroot $outmnt dpkg-reconfigure -f noninteractive console-setup
grep -v setfont $outmnt/etc/console-setup/cached_setup_font.sh > /tmp/cached_setup_font.sh
cp /tmp/cached_setup_font.sh $outmnt/etc/console-setup/cached_setup_font.sh

mkdir -p $outmnt/opt/git/
cd $outmnt/opt/git/
rm -rf $outmnt/opt/git/c100pa-daemon
git clone https://github.com/Maccraft123/c100pa-daemon.git $outmnt/opt/git/c100pa-daemon

# do a non-error cleanup
umount -l $outmnt > /dev/null 2>&1
rmdir $outmnt > /dev/null 2>&1
Expand Down
7 changes: 3 additions & 4 deletions scripts/BuildScripts/InitramfsScripts/buildInitramFs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,13 @@ chmod +x $initramfs_src/init
cp $initramfs_src/init $initramfs_src/sbin/init

#compress and install
rm -rf $outmnt/boot/PrawnOS-initramfs.cpio.gz
rm -rf $outmnt/boot/PrawnOS-initramfs.cpio
cd $initramfs_src
ln -s busybox bin/cat
ln -s busybox bin/mount
ln -s busybox bin/sh
ln -s busybox bin/switch_root
ln -s busybox bin/umount

# store for kernel building
find . -print0 | cpio --null --create --verbose --format=newc | gzip --best > $OUT_DIR/PrawnOS-initramfs.cpio.gz

# store for kernel building. gzip is not needed becase kernel + initramfs are gzipped together
find . -print0 | cpio --null --create --verbose --format=newc > $OUT_DIR/PrawnOS-initramfs.cpio
19 changes: 19 additions & 0 deletions scripts/InstallScripts/InstallPackages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,25 @@ do
done
done

#install hwdb file for iio-sensor-proxy to work
printf 'sensor:modalias:platform:*\n ACCEL_MOUNT_MATRIX=-1, 0, 0; 0, -1, 0; 0, 0, -1\n' > /etc/udev/hwdb.d/61-sensor-local.hwdb
systemd-hwdb update
udevadm trigger

#make bootsplash not disappear again
systemctl mask plymouth-start
dpkg-reconfigure -f noninteractive console-setup
grep -v setfont /etc/console-setup/cached_setup_font.sh > /tmp/cached_setup_font.sh
cp /tmp/cached_setup_font.sh /etc/console-setup/cached_setup_font.sh

#daemon for disabling touchpad and keyboard
mkdir -p /opt/git
cd /opt/git/
cd c100pa-daemon
make
make install
systemctl enable c100pa-daemon

usermod -a -G sudo,netdev,input,video,bluetooth $username

dmesg -E
Expand Down