Skip to content

Commit

Permalink
[script] add components to bump to v0.1.5
Browse files Browse the repository at this point in the history
v0.1.5 has several exciting changes

- Add dumb-suid as a wrapper for suid bash scripts
- Fix pulseaudio
- Add splash screen
- Fix several problems with read-only-fs
  • Loading branch information
htruong committed Mar 3, 2018
1 parent 72f745b commit 0dfe17e
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 36 deletions.
25 changes: 22 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
Version alpha0.1.0 2018-02-24
Version alpha0.1.5 2018-03-02
--

- Initial release.
What's new:

- Audio has very minimal stuttering: Pulseaudio problem solved
- Crankshaft is now overall much more polished experience
- The "plug phone in" interface has been revamped
- You can turn off the system with the power button
- Park mode (The "car sleep" icon) - Connect phone to wake it up
- Smaller binaries
- Splash screens/no more "rainbow" screen

Release notes:

- Qt5 has been rebuilt with many enhancements
- You can use mouse and keyboard (almost...)
- More information on debugging with X11/Wayland to come later

Version alpha0.1.1 2018-02-28
--
Expand All @@ -19,6 +33,11 @@ What's new:
Release notes:

- To mount system read/wite, put a jumper on GPIO4/Ground (Pin 07-09)
- Pulseaudio produces choppier audio even compared to previous one when two streams are played at the same time.
- Pulseaudio produces choppier audio even compared to previous one when two streams are played at the same time

Version alpha0.1.0 2018-02-24
--

- Initial release


22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,24 @@ Release Highlights

[Full Changelog](https://github.com/htruong/crankshaft/blob/master/CHANGELOG.md)

**Version alpha0.1.1 2018-02-28**
**Version alpha0.1.5 2018-03-02**

What's new:

- Raspbian Lite no longer resizes the FS on first time startup
- Faster startup time
- File system is now mounted read only -> Better SD card longevity
- Hopefully less cracks on audio output
- Allows `wpa_supplicant.conf` to be put in `precompiled`
- Allows screen flipping when putting a jumper on GPIO21/Ground
(Pin 39-40 - that's the last row of pins)
- Audio has very minimal stuttering: Pulseaudio problem solved
- Crankshaft is now overall much more polished experience
- The "plug phone in" interface has been revamped
- You can turn off the system with the power button
- Park mode (The "car sleep" icon) - Connect phone to wake it up
- Smaller binaries
- Splash screens/no more "rainbow" screen

Release notes:

- To mount system read/wite, put a jumper on GPIO4/Ground (Pin 07-09)
- Pulseaudio produced choppier audio even compared to previous one when two streams are played at the same time.
- Qt5 has been rebuilt with many enhancements
- You can use mouse and keyboard (almost...)
- More information on debugging with X11/Wayland to come later


Want to report a problem?
--
Expand Down
3 changes: 3 additions & 0 deletions make-crankshaft.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ set_up_loopdevs() {
mkdir ${TEMP_CHROOT_DIR}/usr/local/lib/
mkdir ${TEMP_CHROOT_DIR}/etc/pulse/
mkdir ${TEMP_CHROOT_DIR}/etc/wpa_supplicant/
mkdir ${TEMP_CHROOT_DIR}/opt/crankshaft/

cp precompiled/autoapp ${TEMP_CHROOT_DIR}/usr/local/bin/
cp precompiled/libaasdk.so ${TEMP_CHROOT_DIR}/usr/local/lib/
Expand All @@ -144,6 +145,8 @@ set_up_loopdevs() {

cp precompiled/autoapp.service ${TEMP_CHROOT_DIR}/etc/systemd/system/
cp precompiled/autoapp_brightness.service ${TEMP_CHROOT_DIR}/etc/systemd/system/
cp precompiled/splashscreen.service ${TEMP_CHROOT_DIR}/etc/systemd/system/
cp precompiled/opt/* ${TEMP_CHROOT_DIR}/opt/crankshaft/

cp precompiled/openauto.rules ${TEMP_CHROOT_DIR}/etc/udev/rules.d/

Expand Down
4 changes: 4 additions & 0 deletions precompiled/opt/power_off.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

sleep 3
shutdown -h now
4 changes: 4 additions & 0 deletions precompiled/opt/sleep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

echo 1 > /sys/class/backlight/rpi_backlight/bl_power
vcgencmd display_power 0
Binary file added precompiled/opt/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions precompiled/opt/wake_up.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

vcgencmd display_power 1
echo 0 > /sys/class/backlight/rpi_backlight/bl_power
10 changes: 4 additions & 6 deletions precompiled/pulseaudio_daemon.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@

default-fragments = 2
default-fragment-size-msec = 5
deferred-volume-safety-margin-usec = 1
; flat-volumes = no
realtime-scheduling = no
default-sample-rate = 48000
resample-method = speex-fixed-1
default-fragments = 10
default-fragment-size-msec = 10

12 changes: 12 additions & 0 deletions precompiled/splashscreen.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Unit]
Description=Splash screen
DefaultDependencies=no
After=local-fs.target

[Service]
ExecStart=/usr/bin/fbi -d /dev/fb0 --noverbose -a /opt/crankshaft/splash.png
StandardInput=tty
StandardOutput=tty

[Install]
WantedBy=sysinit.target
17 changes: 13 additions & 4 deletions scripts/customize-image-pi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ print_banner() {
get_deps() {
apt update
#apt upgrade
apt install -y libprotobuf10 libpulse0 libboost-log1.62.0 libboost-test1.62.0 libboost-thread1.62.0 libboost-date-time1.62.0 libboost-chrono1.62.0 libboost-atomic1.62.0 libpulse-mainloop-glib0 libfontconfig1 pulseaudio
apt install -y libprotobuf10 libpulse0 libboost-log1.62.0 libboost-test1.62.0 libboost-thread1.62.0 libboost-date-time1.62.0 libboost-chrono1.62.0 libboost-atomic1.62.0 libpulse-mainloop-glib0 libfontconfig1 libinput10 libxkbcommon0 pulseaudio fbi
apt clean
#update raspi firmware
SKIP_WARNING=1 rpi-update
Expand All @@ -35,15 +35,23 @@ mark_script_run() {

house_keeping() {
# we don't need to resize the root part
sed -i 's/ quiet init\=.*$//' /boot/cmdline.txt

sed -i 's/ init\=.*$//' /boot/cmdline.txt
echo "disable_splash=1" >> /boot/config.txt


# make sure everything has the right owner
chown -R root:staff /usr/local/
chown -R root:staff /opt/crankshaft/
chown root:staff /etc/systemd/system/autoapp.service
chown root:staff /etc/systemd/system/autoapp_brightness.service
chown root:staff /etc/systemd/system/splashscreen.service
chown root:staff /etc/udev/rules.d/openauto.rules
#chown root:staff /etc/pulse/daemon.conf

cat /root/pulseaudio_daemon.conf >> /etc/pulse/daemon.conf

chmod u+s /opt/crankshaft/dumb_suid

sed -i 's/load-module module-udev-detect/load-module module-udev-detect tsched=0/' /etc/pulse/default.pa

if [ -f /etc/wpa_supplicant/wpa_supplicant.conf ]; then
chown root:staff /etc/wpa_supplicant/wpa_supplicant.conf
Expand All @@ -52,6 +60,7 @@ house_keeping() {
fi

# enable the startup actions
systemctl enable splashscreen.service
systemctl enable autoapp.service
systemctl enable autoapp_brightness.service

Expand Down
25 changes: 12 additions & 13 deletions scripts/read-only-fs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

# CREDIT TO THESE TUTORIALS:
# Ladyada's readonly fs script
# petr.io/en/blog/2015/11/09/read-only-raspberry-pi-with-jessie
# hallard.me/raspberry-pi-read-only
# k3a.me/how-to-make-raspberrypi-truly-read-only-reliable-and-trouble-free
Expand Down Expand Up @@ -113,16 +114,14 @@ echo "Removing unwanted packages..."
# dphys-swapfile xserver-common lightdm fake-hwclock
# Let's keep dbus...that includes avahi-daemon, a la 'raspberrypi.local',
# also keeping xserver & lightdm for GUI login (WIP, not working yet)
apt-get remove -y --force-yes --purge triggerhappy cron logrotate \
apt-get remove -y --force-yes --purge triggerhappy \
dphys-swapfile fake-hwclock
apt-get -y --force-yes autoremove --purge

# Replace log management with busybox (use logread if needed)
echo "Installing busybox-syslogd..."
apt-get -y --force-yes install busybox-syslogd; dpkg --purge rsyslog

echo "Configuring system..."

sed -i "s/#Storage=auto/Storage=volatile/" /etc/systemd/journald.conf

# Install boot-time R/W jumper test if requested
if [ $INSTALL_RW_JUMPER -ne 0 ]; then
apt-get install -y --force-yes wiringpi
Expand All @@ -146,14 +145,14 @@ if [ \`gpio -g read $INVERT_PIN\` -eq 0 ] ; then
echo "lcd_rotate=2" >> /boot/config.txt
reboot
fi
else
grep "lcd_rotate=2" /boot/config.txt >/dev/null
if [ \$? -eq 0 ]; then
# There, need to restore
mount -o remount,rw /boot
sed -i 's/^lcd_rotate=2//g' /boot/config.txt
reboot
fi
#else
# grep "lcd_rotate=2" /boot/config.txt >/dev/null
# if [ \$? -eq 0 ]; then
# # There, need to restore
# mount -o remount,rw /boot
# sed -i 's/^lcd_rotate=2//g' /boot/config.txt
# reboot
# fi
fi
exit 0
EOF
Expand Down
13 changes: 13 additions & 0 deletions src/dumb_suid/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CC=gcc
CFLAGS=-I. -O3
PROG=dumb_suid

all: $(PROG)

$(PROG): $(PROG).c
$(CC) $(CFLAGS) -o $(PROG) $(PROG).c

.PHONY: clean

clean:
rm $(PROG)
24 changes: 24 additions & 0 deletions src/dumb_suid/dumb_suid.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>

// HACK: Will fix later
//
// This program is a wrapper to suid scripts in /opt/crankshaft
// Because we can't suid the bash scripts
//
// This is probably a dumb and dangerous idea but it works for now

int main( int argc, char **argv )
{
setuid( 0 );
char scriptname[50];
strcpy (scriptname, "/opt/crankshaft/");
strncat(scriptname, argv[1], 50);
printf("Executing '%s' with suid 0!\n", scriptname);
system( scriptname );

return 0;
}

0 comments on commit 0dfe17e

Please sign in to comment.