[-]
[+]
|
Changed |
_service:repo:init-debug
|
@@ -0,0 +1,134 @@
+#!/bin/sh
+#
+# Hybris adaptation bootstrapping initramfs init script.
+#
+# Copyright (c) 2014 Jolla Oy
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License version 2 as published by the
+# Free Software Foundation.
+#
+# Author:
+# - Tom Swindell <t.swindell@rubyx.co.uk>
+# - David Greaves <david@dgreaves.com>
+#
+
+# General logging
+set -x
+exec > /init.log 2>&1
+echo "Running Mer Boat Loader"
+
+set_welcome_msg(){
+cat <<EOF >> /etc/issue.net
+Welcome to the Mer/SailfishOS Boat loader debug init system.
+
+Log so far is in /init.log
+
+EOF
+}
+
+export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
+
+# Default setting is rndis - add mass_storage for a debug boot
+# enable using usb_setup
+USB_FUNCTIONS=rndis
+
+ANDROID_USB=/sys/class/android_usb/android0
+LOCAL_IP=192.168.2.1
+
+DONE_SWITCH=yes
+
+# Minimal mounts for initrd or pre-init debug session
+do_mount_devprocsys()
+{
+ echo "########################## mounting devprocsys"
+ mkdir /dev
+ mount -t devtmpfs devtmpfs /dev
+ # telnetd needs /dev/pts/ entries
+ mkdir /dev/pts
+ mount -t devpts devpts /dev/pts
+
+ mkdir /proc
+ mkdir /sys
+ mount -t sysfs sysfs /sys
+ mount -t proc proc /proc
+}
+
+# Sugar for accessing usb config
+write() {
+ echo -n "$2" > "$1"
+}
+
+# This sets up the USB with whatever USB_FUNCTIONS are set to
+usb_setup() {
+ write $ANDROID_USB/enable 0
+ write $ANDROID_USB/functions ""
+ write $ANDROID_USB/enable 1
+ usleep 500000 # 0.5 delay to attempt to remove rndis function
+ write $ANDROID_USB/enable 0
+ write $ANDROID_USB/idVendor 18D1
+ write $ANDROID_USB/idProduct D001
+ write $ANDROID_USB/iManufacturer "Mer Boat Loader"
+ write $ANDROID_USB/iProduct "$CUSTOMPRODUCT"
+ write $ANDROID_USB/iSerial "$1"
+ write $ANDROID_USB/functions $USB_FUNCTIONS
+ write $ANDROID_USB/enable 1
+}
+# This lets us communicate errors to host (if it needs disable/enable then that's a problem)
+usb_info() {
+ # make sure USB is settled
+ echo "########################## usb_info: $1"
+ sleep 1
+ write $ANDROID_USB/iSerial "$1"
+}
+
+
+run_debug_session() {
+ CUSTOMPRODUCT=$1
+ echo "########################## Debug session : $1"
+ usb_setup "Mer Debug setting up (DONE_SWITCH=$DONE_SWITCH)"
+
+ USB_IFACE=notfound
+ /sbin/ifconfig usb0 $LOCAL_IP && USB_IFACE=usb0
+ /sbin/ifconfig rndis0 $LOCAL_IP && USB_IFACE=rndis0
+ # Report for the logs
+ /sbin/ifconfig
+
+ # Unable to set up USB interface? Reboot.
+ if [ x$USB_IFACE = xnotfound ]; then
+ usb_info "Mer Debug: ERROR: could not setup USB as usb0 or rndis0"
+ dmesg
+ sleep 60 # plenty long enough to check usb on host
+ reboot -f
+ fi
+
+ echo "interface $USB_IFACE" >> /etc/udhcpd.conf
+ # Be explicit about busybox so this works in a rootfs too
+ echo "########################## starting dhcpd"
+ $EXPLICIT_BUSYBOX udhcpd
+
+ set_welcome_msg
+ # Non-blocking telnetd
+ echo "########################## starting telnetd"
+ # We run telnetd on different ports pre/post-switch_root This
+ # avoids problems with an unterminated pre-switch_root telnetd
+ # hogging the port
+ $EXPLICIT_BUSYBOX telnetd -p $TELNET_DEBUG_PORT -l /bin/sh
+}
+
+
+
+# We're in the real rootfs running as init-debug
+EXPLICIT_BUSYBOX="/bin/busybox-static"
+TELNET_DEBUG_PORT=2323
+
+do_mount_devprocsys
+
+run_debug_session "Persistent telnetd"
+
+# If we don't do this then udev will not be able to create /dev/block/*
+rm /dev/block
+
+# Now try to boot the real init
+exec /sbin/init --log-level=debug --log-target=kmsg &> /boot/systemd_stdouterr
+
|
|
Changed |
_service:repo:repo.tar.bzip2
^
|
|
Changed |
_service:repo:rpm.tar.bzip2
^
|
[-]
[+]
|
Changed |
_service:repo:rpmlintrc
^
|
@@ -0,0 +1,3 @@
+from Config import *
+addFilter(".*")
+
|