View Single Post
Old 11-13-2020, 01:18 PM   #812
rtiangha
Evangelist
rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.rtiangha ought to be getting tired of karma fortunes by now.
 
Posts: 495
Karma: 356531
Join Date: Jul 2016
Location: 'burta, Canada
Device: Kobo Glo HD
Quote:
Originally Posted by PeterT View Post
I thought I'd seen a post by geek1011 regarding a change in Kobo's startup scripts in the newest release. Possibly it might have interfered with ksm's installation
Yeah, I've only peeked at things for about 5 minutes; it looks like /etc/init.d/rcS got reordered a bit, but at a glance, I'm not sure why the old script wouldn't work (I haven't looked at everything else that may have changed, though).

For anyone who has an existing KSM install that they can no longer access, is anyone feeling adventurous and want to try the attached script (unzip first, then place KoboRoot.tgz in .kobo), which I made by rearranging things back to the old order (minus a lot of tshering's old customizations outside the KSM launch stuff; I'm not sure how much of it is still needed and I don't think maintaining backwards compatibility will be easy going forward with all the potential hardware changes coming down the pipe anyway)?

WARNING: If it doesn't work, you may have an unbootable machine, in which case you'd need a way to remove your internal SD card and replace the /etc/init.d/rcS file with a working one from the stock firmware. I can't test it myself because I can't find my damn SD-microSD adapter card so I'd have no way to recover if it didn't work.

Anyway, if this doesn't work, then I'm not sure off the top of my head. I might have time to look closer after NaNoWriMo; I enjoy KSM too and had a lot of customizations that I miss. But I also have a working solution to launch other things via NickelMenu now, so if this is indeed the end of the road for me and KSM on my GloHD, I'm not too choked up.

And here's the script, in case anyone wants to check my math; I basically moved the firmware upgrade stuff back nearer to the bottom where it used to be, and the wifi stuff back to the middle where it used to be, then stuck the KSM launcher stuff in between where it used to live:

Spoiler:
Code:
#!/bin/sh

write_uboot_env() {
	if [ $1 == freescale ] || [ $1 == mx50-ntx ] || [ $1 == mx6sl-ntx ] || [ $1 == mx6sll-ntx ] || [ $1 == mx6ull-ntx ]; then
		dd if=$2 of=/dev/mmcblk0 bs=128k count=1 seek=6
	fi
	sync
}

PRODUCT=`/bin/kobo_config.sh`
[ $PRODUCT != trilogy ] && PREFIX=$PRODUCT-

mount -o remount,noatime,nodiratime /dev/mmcblk0p1 /

PLATFORM=freescale
if [ `dd if=/dev/mmcblk0 bs=512 skip=1024 count=1 | grep -c "HW CONFIG"` == 1 ]; then
	CPU=`ntx_hwconfig -s -p /dev/mmcblk0 CPU`
	PLATFORM=$CPU-ntx
	WIFI=`ntx_hwconfig -s -p /dev/mmcblk0 Wifi`
fi

if [ $PLATFORM == freescale ]; then
	if [ ! -s /lib/firmware/imx/epdc_E60_V220.fw ]; then
		mkdir -p /lib/firmware/imx
		dd if=/dev/mmcblk0 bs=512K skip=10 count=1 | zcat > /lib/firmware/imx/epdc_E60_V220.fw
		sync
	fi
fi

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/lib:
runlevel=S
prevlevel=N
umask 022
export PATH PLATFORM PRODUCT runlevel prevlevel

for i in /proc /dev /root /tmp /sys /mnt/sd /mnt/onboard /mnt/user /var/db /var/lib /var/log /var/run /lib/modules/`uname -r`; do
	[ ! -d $i ] && mkdir -p $i
done;

/bin/mount -t proc  none  /proc
/bin/mount -t tmpfs none -o size=16m /tmp
/bin/mount -t tmpfs none /dev
/bin/mount -t tmpfs none -o size=16k /var/lib
/bin/mount -t tmpfs none -o size=16k /var/log
/bin/mount -t tmpfs none -o size=128k /var/run
/bin/mount -t sysfs none -o size=500k /sys


for i in /var/run/dbus /var/lib/dbus; do
	mkdir -p $i
done

mkfifo /tmp/nickel-hardware-status
rm -rf /etc/udev/rules.d/70-persistent-net.rules
rm -rf /mnt/onboard/.kobo
rm -rf /mnt/onboard/*

echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
/sbin/udevd -d

[ "$(ls -s /etc/udev.tgz | awk '{print $1}')" == 0 ] && rm -rf /etc/udev.tgz
if [ $PLATFORM == freescale ] || [ ! -e /etc/udev.tgz ]; then
	/sbin/udevadm control --env=STARTUP=1
	/sbin/udevadm trigger
	/sbin/udevadm settle --timeout=2
	/sbin/udevadm control --env=STARTUP=
	[ $PLATFORM != freescale ] && tar cpzf /etc/udev.tgz /dev &
else
	tar zxf /etc/udev.tgz -C /
fi

export UBOOT_MMC=/etc/u-boot/$PLATFORM/u-boot.mmc
export UBOOT_RECOVERY=/etc/u-boot/$PLATFORM/u-boot.recovery

find /usr/local/Trolltech/QtEmbedded-4.6.2-arm/lib/ -type f -exec readahead {} \;

FORCE_FACTORY_RESET=0
FS_CORRUPT=0
dosfsck -a -w /dev/mmcblk0p3 || dosfsck -a -w /dev/mmcblk0p3 || dosfsck -a -w /dev/mmcblk0p3 || dosfsck -a -w /dev/mmcblk0p3 || FS_CORRUPT=1
[ ! -s /usr/local/Kobo/pickel ] && FORCE_FACTORY_RESET=1
/usr/local/Kobo/pickel should-factory-reset
if [ $? != 0 ] || [ $FS_CORRUPT == 1 ] || [ $FORCE_FACTORY_RESET == 1 ]; then
	case $PRODUCT in
		kraken|phoenix)
			export COORDINATES="200 740 350 150";;
		snow)
			export COORDINATES="250 -1050 570 150";;
		star|luna)
			export COORDINATES="160 740 400 150";;
		dragon|dahlia)
			export COORDINATES="260 1070 540 130";;
		alyssum)
			export COORDINATES="240 1070 550 150";;
		daylight)
			export COORDINATES="320 1400 730 170";;
		nova)
			export COORDINATES="250 1070 600 150";;
		frost)
			export COORDINATES="350 1400 750 200";;
		storm)
			export COORDINATES="325 1240 610 150";;
		*)
			export COORDINATES="140 600 300 70";;
		
	esac
	sleep 5
	zcat /etc/images/$PREFIX\factory-reset.raw.gz | /usr/local/Kobo/pickel showpic
	/usr/local/Kobo/pickel wait-for-hit $COORDINATES

	write_uboot_env $PLATFORM $UBOOT_RECOVERY
	reboot
fi

mount -t vfat -o noatime,nodiratime,shortname=mixed,utf8 /dev/mmcblk0p3 /mnt/onboard
rm -rf /mnt/onboard/fsck*
rm -rf /mnt/onboard/FSCK*
rm -rf /usr/local/Kobo/db.tgz
chmod u+s /libexec/dbus-daemon-launch-helper

echo -n 8192 > /proc/sys/vm/min_free_kbytes
echo -n 67108864 > /proc/sys/kernel/shmmax

/usr/local/Kobo/pickel can-upgrade
CAN_UPGRADE=$?

if [ ! -e /mnt/onboard/.kobo ]; then
	mkdir -p /mnt/onboard/.kobo
fi

if [ $PLATFORM == freescale ]; then
	INTERFACE=wlan0
	WIFI_MODULE=ar6000
else
	INTERFACE=eth0
	WIFI_MODULE=dhd
	if [ x$WIFI == "xRTL8189" ]; then
		WIFI_MODULE=8189fs
	elif [ x$WIFI == "xRTL8192" ]; then
		WIFI_MODULE=8192es                                                   
	fi  
fi

export INTERFACE
export WIFI_MODULE

export NICKEL_HOME=/mnt/onboard/.kobo
export LD_LIBRARY_PATH=/usr/local/Kobo
export LANG=en_US.UTF-8
#export KOBO_DEBUG_STDOUT=1

/bin/dbus-uuidgen > /var/lib/dbus/machine-id
/bin/dbus-daemon --system &
export DBUS_SESSION_BUS_ADDRESS=`/bin/dbus-daemon --session --print-address --fork`

# ---------------- Tshering: insert menu begin
ksmroot=/adds/kbmenu
export ksmroot
export MODEL_NUMBER=$(cut -f 6 -d ',' /mnt/onboard/.kobo/version | sed -e 's/^[0-]*//')
case $MODEL_NUMBER in
  310|320|330|340|350|360|371|372|373|375|381) #Touch A/B/C, Glo, Mini, Aura HD, Aura, Glo HD, Touch 2.0, Aura ONE, Aura Edition 2 v1, Aura ONE LE
    export mousedriver=libKoboTS.so
    export QWS_MOUSE_PROTO=KoboTS
    ;;
  370) #Aura H2O
    export mousedriver=libKoboTS_h2o.so
    export QWS_MOUSE_PROTO=KoboTS_h2o
    ;;
  *) # 374|376|378|384|377|380 #Aura H2O2v1, Clara HD, Aura H2O2v2, Libra H2O, Forma, Forma 32GB
    export mousedriver=libKoboTS_h2o2.so
    export QWS_MOUSE_PROTO=KoboTS_h2o2
    ;;
esac

installUpdate="TRUE"
if [ "$isarmhf" == "TRUE" ] && [ "$(sh $ksmroot/onstart/checkinstall.sh)" == "ok" ]; then

  checkscript=$(sh -n $ksmroot/onstart/ksmhome.sh 2>&1)
  if [ "$checkscript" == "" ]; then
    $ksmroot/onstart/ksmhome.sh &
    exit
  fi

fi
# ---------------- Tshering: insert menu end

if [ $CAN_UPGRADE == 1 ] && [ -e /mnt/onboard/.kobo/Kobo.tgz ]; then
	gunzip -t /mnt/onboard/.kobo/Kobo.tgz && tar zxf /mnt/onboard/.kobo/Kobo.tgz -C /usr/local/Kobo/ && ( cat /usr/local/Kobo/revinfo >> /usr/local/Kobo/install.log )
	rm /mnt/onboard/.kobo/Kobo.tgz
	echo "Done upgrading..."
fi
                               
if [ $CAN_UPGRADE == 1 ] && [ -e /mnt/onboard/.kobo/KoboRoot.tgz ]; then
	write_uboot_env $PLATFORM $UBOOT_RECOVERY
	zcat /etc/images/$PREFIX\ghostbuster.raw.gz | /usr/local/Kobo/pickel showpic
	/etc/init.d/update-animator.sh &
	gunzip -t /mnt/onboard/.kobo/KoboRoot.tgz && tar zxf /mnt/onboard/.kobo/KoboRoot.tgz -C / && ( cat /usr/local/Kobo/revinfo >> /usr/local/Kobo/install.log )
	if [ -e /mnt/onboard/.kobo/upgrade ]; then
		/etc/init.d/upgrade-wifi.sh
		rm -rf /mnt/onboard/.kobo/upgrade
	fi
	rm /mnt/onboard/.kobo/KoboRoot.tgz
	killall update-animator.sh
	echo "Done upgrading..."
	zcat /etc/images/$PREFIX\ghostbuster.raw.gz | /usr/local/Kobo/pickel showpic
	zcat /etc/images/$PREFIX\reboot.raw.gz | /usr/local/Kobo/pickel showpic
	write_uboot_env $PLATFORM $UBOOT_MMC
	sync
	reboot
fi

( 
	if [ $PLATFORM == freescale ] || [ $CPU == mx50 ] || [ $CPU == mx6sl ]; then
		usleep 400000; 
	fi
	/etc/init.d/on-animator.sh
) &

(
	/usr/local/Kobo/pickel disable.rtc.alarm

	if [ ! -e /etc/wpa_supplicant/wpa_supplicant.conf ]; then
		cp /etc/wpa_supplicant/wpa_supplicant.conf.template /etc/wpa_supplicant/wpa_supplicant.conf
	fi

	/sbin/hwclock -s -u
) &

/bin/hostname kobo

/usr/local/Kobo/hindenburg &
LIBC_FATAL_STDERR_=1 /usr/local/Kobo/nickel -platform kobo -skipFontLoad &
[ $PLATFORM != freescale ] && rm -rf /dev/mmcblk1* && udevadm trigger &
[ -e /drivers/$PLATFORM/misc/lowmem.ko ] && insmod /drivers/$PLATFORM/misc/lowmem.ko &
Attached Files
File Type: zip KoboRoot.tgz.zip (2.9 KB, 236 views)
rtiangha is offline   Reply With Quote