File project.diff of Package kiwi-templates-SLES12-RPi

--- Images.kiwi.in.orig
+++ Images.kiwi.in
@@ -71,7 +71,7 @@
 #  define BOOTKERNEL default
 #  define KERNEL_CMDLINE_SER "KERNEL_CMDLINE_DEFAULT console=ttyS0,115200n8"
 /* We need YaST to appear on the graphical output, so place tty last */
-#  define KERNEL_CMDLINE_GFX "KERNEL_CMDLINE_DEFAULT console=ttyS0,115200n8 console=tty"
+#  define KERNEL_CMDLINE_GFX "KERNEL_CMDLINE_DEFAULT console=tty"
 #  define EXTRA_PACKAGES PKG_BOOT_TAG(raspberrypi-firmware) \
                          PKG_BOOT_TAG(raspberrypi-firmware-config-rpi3) \
 			 PKG_BOOT_TAG(u-boot-rpi3) \
@@ -382,7 +382,7 @@
            <oem-swap>false</oem-swap>
 #else
            <oem-swap>true</oem-swap>
-           <oem-swapsize>500</oem-swapsize>
+           <oem-swapsize>1500</oem-swapsize>
 #endif
            <oem-skip-verify>true</oem-skip-verify>
         </oemconfig>
@@ -420,6 +420,9 @@
 	<users group="root">
 		<user password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" home="/root" name="root"/>
         </users>
+	<users group="users">
+		<user password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" home="/home/kb" name="kb"/>
+        </users>
 	<repository type="rpm-md">
             <source path="obsrepositories:/"/>
         </repository>
@@ -559,7 +562,9 @@ EXTRA_PACKAGES
 #if IS_FLAVOR_raspberrypi3_aarch64 && IMAGE_TYPE == TYPE_X11
 <!-- Special SLES for rpi3 -->
 #include "packagelist.rpi3.inc"
+#if 0
 <archive name="y2firstboot.tar.gz"/>
+#endif
 #else
 #include "packagelist.inc"
 #endif
--- X11-raspberrypi3_aarch64.kiwi.orig
+++ X11-raspberrypi3_aarch64.kiwi
@@ -18,10 +18,10 @@
   </specification>
   </description>
   <preferences>
-    <type image="oem" boot="oemboot/suse-SLES12" bootkernel="custom" filesystem="btrfs" fsmountoptions="noatime,compress=lzo" bootloader="grub2" firmware="efi" editbootconfig="uboot-image-raspberrypi3_aarch64-setup" editbootinstall="uboot-image-raspberrypi3_aarch64-install" kernelcmdline="loglevel=3 plymouth.enable=0 rootflags=size=100% console=ttyS0,115200n8 console=tty">
+    <type image="oem" boot="oemboot/suse-SLES12" bootkernel="custom" filesystem="btrfs" fsmountoptions="noatime,compress=lzo" bootloader="grub2" firmware="efi" editbootconfig="uboot-image-raspberrypi3_aarch64-setup" editbootinstall="uboot-image-raspberrypi3_aarch64-install" kernelcmdline="loglevel=3 plymouth.enable=0 zswap.enabled=1 rootflags=size=100% console=tty">
       <oemconfig>
         <oem-swap>true</oem-swap>
-        <oem-swapsize>500</oem-swapsize>
+        <oem-swapsize>1500</oem-swapsize>
         <oem-skip-verify>true</oem-skip-verify>
       </oemconfig>
       <systemdisk name="SLES12-SP3-RPi3">
@@ -47,7 +47,7 @@
         <volume name="var/tmp"/>
       </systemdisk>
     </type>
-    <version>2017.05.04</version>
+    <version>2017.06.06</version>
     <packagemanager>zypper</packagemanager>
     <locale>en_US</locale>
     <keytable>us.map.gz</keytable>
@@ -59,6 +59,9 @@
   <users group="root">
     <user password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" home="/root" name="root"/>
   </users>
+  <users group="users">
+    <user password="$1$wYJUgpM5$RXMMeASDc035eX.NbYWFl0" home="/home/kb" name="kb"/>
+  </users>
   <repository type="rpm-md">
     <source path="obsrepositories:/"/>
   </repository>
@@ -156,46 +159,10 @@
     <!-- Patterns -->
     <namedCollection name="Minimal"/>
     <namedCollection name="base"/>
-    <namedCollection name="documentation"/>
     <namedCollection name="x11"/>
-    <namedCollection name="Basis-Devel"/>
-    <namedCollection name="SDK-C-C++"/>
-    <namedCollection name="SDK-YaST"/>
-    <namedCollection name="SDK-Doc"/>
-    <!-- AppArmor slows startup down by a long time
-<namedCollection name="apparmor" /> -->
-    <namedCollection name="dhcp_dns_server"/>
-    <namedCollection name="directory_server"/>
-    <namedCollection name="file_server"/>
-    <namedCollection name="gateway_server"/>
-    <!-- Cant use this as tftp conflicts with atftp needed by kiwi-desc-oemboot-requires.
-<namedCollection name="kvm_server" />
-<namedCollection name="kvm_tools" />-->
-    <namedCollection name="lamp_server"/>
-    <namedCollection name="mail_server"/>
-    <namedCollection name="printing"/>
-    <namedCollection name="WBEM"/>
-    <!--<namedCollection name="gcc6" />-->
     <package name="patterns-sles-Minimal"/>
     <package name="patterns-sles-base"/>
-    <package name="patterns-sles-documentation"/>
     <package name="patterns-sles-x11"/>
-    <package name="patterns-sles-Basis-Devel"/>
-    <package name="patterns-sdk-SDK-C-C++"/>
-    <package name="patterns-sdk-SDK-YaST"/>
-    <package name="patterns-sdk-SDK-Doc"/>
-    <!--<package name="patterns-sles-apparmor" />-->
-    <package name="patterns-sles-dhcp_dns_server"/>
-    <package name="patterns-sles-directory_server"/>
-    <package name="patterns-sles-file_server"/>
-    <package name="patterns-sles-gateway_server"/>
-    <!--<package name="patterns-sles-kvm_server" />
-<package name="patterns-sles-kvm_tools" />-->
-    <package name="patterns-sles-lamp_server"/>
-    <package name="patterns-sles-mail_server"/>
-    <package name="patterns-sles-printing"/>
-    <package name="patterns-sles-WBEM"/>
-    <!--<package name="patterns-toolchain-gcc6"/>-->
     <package name="suse-build-key"/>
     <!-- Base packages -->
     <package name="aaa_base-extras"/>
@@ -270,8 +237,6 @@
     <package name="crda"/>
     <package name="wireless-regdb"/>
     <!-- additional packages needed by firstboot -->
-    <package name="SLES_RPI-release-MINI"/>
-    <package name="SLES_RPI-release"/>
     <package name="yast2-users"/>
     <package name="zypper"/>
     <!-- Base: multiple choices -->
@@ -372,12 +337,8 @@
     <!-- Branding -->
     <package name="grub2-branding-SLE" bootinclude="true"/>
     <package name="yast2-branding-SLE"/>
-    <package name="MozillaFirefox-branding-SLE"/>
-    <package name="release-notes-sles"/>
     <!-- Translations -->
     <package name="glib-networking-lang"/>
-    <package name="dirmngr-lang"/>
-    <package name="shared-mime-info-lang"/>
     <package name="gstreamer-lang"/>
     <package name="tcsh-lang"/>
     <package name="gconf2-lang"/>
@@ -385,21 +346,24 @@
     <package name="cpio-lang"/>
     <package name="sharutils-lang"/>
     <package name="xz-lang"/>
-    <package name="parted-lang"/>
     <package name="gpg2-lang"/>
     <package name="sed-lang"/>
-    <package name="findutils-lang"/>
-    <package name="icewm-lang"/>
     <package name="xkeyboard-config-lang"/>
     <package name="gsettings-desktop-schemas-lang"/>
     <package name="psmisc-lang"/>
-    <package name="bash-lang"/>
     <package name="coreutils-lang"/>
     <package name="util-linux-lang"/>
     <package name="at-spi2-core-lang"/>
-    <package name="vorbis-tools-lang"/>
-    <package name="yast2-trans-allpacks"/>
     <package name="desktop-translations"/>
+    <!-- not resolvable
+<package name="dirmngr-lang"/>
+<package name="shared-mime-info-lang"/>
+<package name="parted-lang"/>
+<package name="findutils-lang"/>
+<package name="icewm-lang"/>
+<package name="bash-lang"/>
+<package name="yast2-trans-allpacks"/>
+-->
     <!-- X11/IceWM-specific packages -->
     <package name="icewm"/>
     <package name="icewm-lite"/>
@@ -407,44 +371,12 @@
     <package name="icewm-theme-branding"/>
     <package name="polkit-gnome-lang"/>
     <package name="polkit-default-privs"/>
-    <!-- Needed for aarch64 qemu with efi -->
-    <package name="qemu-ipxe"/>
     <!-- Useful for kinda-embedded systems -->
     <package name="cpupower"/>
-    <!-- SDK -->
-    <package name="sle-sdk-release-POOL"/>
-    <package name="tack"/>
-    <package name="release-notes-sdk"/>
-    <package name="man"/>
-    <package name="man-pages"/>
-    <!-- Toolchain -->
-    <package name="sle-module-toolchain-release-POOL"/>
-    <!-- Pattern not available in SUSE:SLE-12-SP2:GA -->
-    <package name="gcc6"/>
-    <package name="gcc6-c++"/>
-    <package name="cpp6"/>
-    <package name="gcc6-fortran"/>
-    <package name="gcc6-locale"/>
-    <!--<package name="libffi-devel-gcc5"/>-->
-    <package name="libstdc++6-devel-gcc6"/>
-    <!-- Cant use pattern kvm_server, see above -->
-    <package name="bridge-utils"/>
-    <package name="qemu-arm"/>
-    <package name="qemu-uefi-aarch64"/>
-    <package name="tigervnc"/>
-    <package name="libvirt-daemon-qemu"/>
-    <package name="vm-install"/>
-    <package name="virt-install"/>
-    <!-- kvm_tools requires kvm_server... -->
-    <package name="tigervnc"/>
-    <package name="virt-manager"/>
-    <package name="libvirt-daemon-qemu"/>
-    <package name="vm-install"/>
-    <package name="libvirt-daemon-config-network"/>
-    <package name="yast2-vm"/>
-    <package name="sles-kvm_en-pdf"/>
-    <package name="virt-v2v"/>
-    <archive name="y2firstboot.tar.gz"/>
+    <package name="ksh"/>
+    <package name="libqt4-sql-unixODBC"/>
+    <!-- Add device tree override for spidev -->
+    <package name="rpi3-dtb-override"/>
     <!-- custom hook scripts for uboot -->
     <archive name="uboot-setup-raspberrypi3_aarch64.tgz" bootinclude="true"/>
   </packages>
--- config.sh.orig
+++ config.sh
@@ -274,9 +274,9 @@ case "$kiwi_iname" in
 	STARTMODE='onboot'
 	EOF
 	;;
-    *-raspberrypi3_aarch64)
-        # Do not interfere with DHCP setup in yast firstboot
-        ;;
+#    *-raspberrypi3_aarch64)
+#        # Do not interfere with DHCP setup in yast firstboot
+#        ;;
     *)
 	# XXX extend to more boards
 	cat > /etc/sysconfig/network/ifcfg-eth0 <<-EOF
@@ -299,9 +299,9 @@ broken_system_clock=true
 EOF
 
 case "$kiwi_iname" in
-  *-raspberrypi3_aarch64)
-    # Do not interfere with NTP setup in yast firstboot
-    ;;
+#  *-raspberrypi3_aarch64)
+#    # Do not interfere with NTP setup in yast firstboot
+#    ;;
   *)
     for i in 0 1 2 3; do
         echo "server $i.opensuse.pool.ntp.org iburst" >> /etc/ntp.conf
@@ -313,13 +313,13 @@ esac
 # Trigger yast2-firstboot on first boot
 #--------------------------------------
 
-case "$kiwi_iname" in
-  *-raspberrypi3_aarch64)
-    touch /var/lib/YaST2/reconfig_system
-    # Use our own workflow
-    baseUpdateSysConfig /etc/sysconfig/firstboot FIRSTBOOT_CONTROL_FILE /etc/YaST2/firstboot-rpi3.xml
-    ;;
-esac
+#case "$kiwi_iname" in
+#  *-raspberrypi3_aarch64)
+#    touch /var/lib/YaST2/reconfig_system
+#    # Use our own workflow
+#    baseUpdateSysConfig /etc/sysconfig/firstboot FIRSTBOOT_CONTROL_FILE /etc/YaST2/firstboot-rpi3.xml
+#    ;;
+#esac
 
 # Link firmware in place (REMOVE ONCE FIXED IN bcm43xx-firmware)
 case "$kiwi_iname" in
@@ -359,6 +359,19 @@ if [[ "$kiwi_iname" == *"-raspberrypi3"
 # Avoid running out of DMA pages for smsc95xx (bsc#1012449)
 vm.min_free_kbytes = 2048
 EOF
+
+    cat > /etc/modules-load.d/i2c-dev.conf <<EOF
+# Load i2c user space device driver
+i2c-dev
+EOF
+
+    cat > /etc/modules-load.d/spidev.conf <<EOF
+# Load SPI user space device driver
+spidev
+EOF
+
+    # XXX Needed until we solve the kernel module situation with hid-multitouch
+    echo "allow_unsupported_modules 1" > /etc/modprobe.d/10-unsupported-modules.conf
 fi
 
 #======================================
@@ -1288,6 +1301,55 @@ if [[ "$kiwi_iname" == *"-raspberrypi3_a
     echo -e 'add_drivers+=" bcm2835-sdhost bcm2835_dma mmc_block "\nomit_drivers+=" sdhci-iproc "' >  /etc/dracut.conf.d/raspberrypi_modules.conf
 fi
 
+echo "LANG=en_US.utf8" > /etc/locale.conf
+
+# Auto-Login
+
+systemctl disable xdm.service
+cat > /etc/systemd/system/xinit@.service <<EOF
+[Unit]
+Description=Xinit on %I
+Conflicts=getty@%i.service
+After=systemd-user-sessions.service getty@%i.service plymouth-quit.service
+
+[Service]
+ExecStart=/bin/bash -c "/usr/bin/xinit /root/start_kb -- -ac"
+ExecStop=/bin/bash -c "/usr/bin/pkill start_kb"
+StandardInput=tty
+StandardOutput=tty
+StandardError=tty
+TTYPath=/dev/%I
+Restart=always
+
+[Install]
+WantedBy=graphical.target
+EOF
+systemctl enable xinit@tty7
+
+cat > /root/start_kb <<EOF
+#!/bin/bash
+
+exec runuser -l kb -c 'DISPLAY=:0 /usr/bin/icewm'
+EOF
+chmod +x /root/start_kb
+
+cat >> /etc/polkit-default-privs.loc* <<EOF
+org.freedesktop.login1.set-wall-message yes:yes:yes
+org.freedesktop.login1.reboot yes:yes:yes
+org.freedesktop.login1.reboot-multiple-sessions yes:yes:yes
+org.freedesktop.login1.power-off yes:yes:yes
+org.freedesktop.login1.power-off-multiple-sessions yes:yes:yes
+EOF
+/sbin/set_polkit_default_privs
+
+# Give proper permissions to kb user for external devices
+cat > /etc/udev/rules.d/90-kb.rules <<EOF
+SUBSYSTEM=="i2c-dev", GROUP="dialout"
+SUBSYSTEM=="spidev", GROUP="dialout"
+EOF
+usermod -a -G dialout kb
+
+
 #======================================
 # Umount kernel filesystems
 #--------------------------------------
--- packagelist.rpi3.inc.orig
+++ packagelist.rpi3.inc
@@ -1,47 +1,11 @@
 <!-- Patterns -->
 <namedCollection name="Minimal" />
 <namedCollection name="base" />
-<namedCollection name="documentation" />
 <namedCollection name="x11" />
-<namedCollection name="Basis-Devel" />
-<namedCollection name="SDK-C-C++" />
-<namedCollection name="SDK-YaST" />
-<namedCollection name="SDK-Doc" />
-<!-- AppArmor slows startup down by a long time
-<namedCollection name="apparmor" /> -->
-<namedCollection name="dhcp_dns_server" />
-<namedCollection name="directory_server" />
-<namedCollection name="file_server" />
-<namedCollection name="gateway_server" />
-<!-- Cant use this as tftp conflicts with atftp needed by kiwi-desc-oemboot-requires.
-<namedCollection name="kvm_server" />
-<namedCollection name="kvm_tools" />-->
-<namedCollection name="lamp_server" />
-<namedCollection name="mail_server" />
-<namedCollection name="printing" />
-<namedCollection name="WBEM" />
-<!--<namedCollection name="gcc6" />-->
 
 <package name="patterns-sles-Minimal" />
 <package name="patterns-sles-base" />
-<package name="patterns-sles-documentation" />
 <package name="patterns-sles-x11" />
-<package name="patterns-sles-Basis-Devel" />
-<package name="patterns-sdk-SDK-C-C++" />
-<package name="patterns-sdk-SDK-YaST" />
-<package name="patterns-sdk-SDK-Doc" />
-<!--<package name="patterns-sles-apparmor" />-->
-<package name="patterns-sles-dhcp_dns_server" />
-<package name="patterns-sles-directory_server" />
-<package name="patterns-sles-file_server" />
-<package name="patterns-sles-gateway_server" />
-<!--<package name="patterns-sles-kvm_server" />
-<package name="patterns-sles-kvm_tools" />-->
-<package name="patterns-sles-lamp_server" />
-<package name="patterns-sles-mail_server" />
-<package name="patterns-sles-printing" />
-<package name="patterns-sles-WBEM" />
-<!--<package name="patterns-toolchain-gcc6"/>-->
 
 <package name="suse-build-key"/>
 
@@ -116,8 +80,6 @@
 <package name="wireless-regdb"/>
 
 <!-- additional packages needed by firstboot -->
-<package name="SLES_RPI-release-MINI"/>
-<package name="SLES_RPI-release"/>
 <package name="yast2-users"/>
 <package name="zypper"/>
 
@@ -215,13 +177,9 @@
 <!-- Branding -->
 <package name="grub2-branding-SLE" bootinclude="true"/>
 <package name="yast2-branding-SLE"/>
-<package name="MozillaFirefox-branding-SLE"/>
-<package name="release-notes-sles"/>
 
 <!-- Translations -->
 <package name="glib-networking-lang"/>
-<package name="dirmngr-lang"/>
-<package name="shared-mime-info-lang"/>
 <package name="gstreamer-lang"/>
 <package name="tcsh-lang"/>
 <package name="gconf2-lang"/>
@@ -229,22 +187,26 @@
 <package name="cpio-lang"/>
 <package name="sharutils-lang"/>
 <package name="xz-lang"/>
-<package name="parted-lang"/>
 <package name="gpg2-lang"/>
 <package name="sed-lang"/>
-<package name="findutils-lang"/>
-<package name="icewm-lang"/>
 <package name="xkeyboard-config-lang"/>
 <package name="gsettings-desktop-schemas-lang"/>
 <package name="psmisc-lang"/>
-<package name="bash-lang"/>
 <package name="coreutils-lang"/>
 <package name="util-linux-lang"/>
 <package name="at-spi2-core-lang"/>
-<package name="vorbis-tools-lang"/>
-<package name="yast2-trans-allpacks"/>
 <package name="desktop-translations"/>
 
+<!-- not resolvable
+<package name="dirmngr-lang"/>
+<package name="shared-mime-info-lang"/>
+<package name="parted-lang"/>
+<package name="findutils-lang"/>
+<package name="icewm-lang"/>
+<package name="bash-lang"/>
+<package name="yast2-trans-allpacks"/>
+-->
+
 <!-- X11/IceWM-specific packages -->
 <package name="icewm"/>
 <package name="icewm-lite"/>
@@ -254,46 +216,11 @@
 <package name="polkit-gnome-lang"/>
 <package name="polkit-default-privs"/>
 
-<!-- Needed for aarch64 qemu with efi -->
-<package name="qemu-ipxe"/>
-
 <!-- Useful for kinda-embedded systems -->
 <package name="cpupower"/>
 
-<!-- SDK -->
-<package name="sle-sdk-release-POOL"/>
-<package name="tack"/>
-<package name="release-notes-sdk"/>
-<package name="man"/>
-<package name="man-pages"/>
-
-<!-- Toolchain -->
-<package name="sle-module-toolchain-release-POOL"/>
-
-<!-- Pattern not available in SUSE:SLE-12-SP2:GA -->
-<package name="gcc6"/>
-<package name="gcc6-c++"/>
-<package name="cpp6"/>
-<package name="gcc6-fortran"/>
-<package name="gcc6-locale"/>
-<!--<package name="libffi-devel-gcc5"/>-->
-<package name="libstdc++6-devel-gcc6"/>
-
-<!-- Cant use pattern kvm_server, see above -->
-<package name="bridge-utils" />
-<package name="qemu-arm" />
-<package name="qemu-uefi-aarch64" />
-<package name="tigervnc" />
-<package name="libvirt-daemon-qemu" />
-<package name="vm-install" />
-<package name="virt-install" />
-
-<!-- kvm_tools requires kvm_server... -->
-<package name="tigervnc" />
-<package name="virt-manager" />
-<package name="libvirt-daemon-qemu" />
-<package name="vm-install" />
-<package name="libvirt-daemon-config-network" />
-<package name="yast2-vm" />
-<package name="sles-kvm_en-pdf" />
-<package name="virt-v2v" />
+<package name="ksh"/>
+<package name="libqt4-sql-unixODBC"/>
+
+<!-- Add device tree override for spidev -->
+<package name="rpi3-dtb-override"/>
--- pre_checkin.sh.orig
+++ pre_checkin.sh
@@ -116,7 +116,7 @@ for arch in armv6 armv7 aarch64; do
         $CPP $image_type_info -DIS_FLAVOR_$flavor=1 -DFLAVOR_TYPE=$flavor -P Images.kiwi.in -o $t
         # replace defines that cpp would ignore
         # do not use 'quiet' here so we get kiwi output
-        sed -i "s/FLAVOR_TYPE/$flavor/g;s/IMAGE_TYPE/$image_type/g;s/IMAGE_TYPE_STRING/$image_type_string/g;s/ARCH/$arch/g;s/KERNEL_CMDLINE_DEFAULT/loglevel=3 plymouth.enable=0 rootflags=size=100%/g" $t
+        sed -i "s/FLAVOR_TYPE/$flavor/g;s/IMAGE_TYPE/$image_type/g;s/IMAGE_TYPE_STRING/$image_type_string/g;s/ARCH/$arch/g;s/KERNEL_CMDLINE_DEFAULT/loglevel=3 plymouth.enable=0 zswap.enabled=1 rootflags=size=100%/g" $t
         # this will abort if there's an error (see set -e)
         xmllint --format $t --output $i.kiwi || break
         rm -f $t
--- uboot-image-install.in.orig
+++ uboot-image-install.in
@@ -161,6 +161,12 @@ if [ -f "boot/vc/bootcode.bin" -a "$is_e
 	mount /dev/mapper/$PART ./mnt-pi
 	( cd boot/vc; tar c . ) | ( cd ./mnt-pi/; tar x )
 	umount ./mnt-pi
+
+	# Copy device tree
+	mount /dev/mapper/${PART/p1/p2} ./mnt-pi
+	cp boot/*dtb mnt-pi/
+	umount ./mnt-pi
+
 	rmdir ./mnt-pi
 	# "kpartx -dv $diskname" does not work if $diskname
 	# is longer than 64 characters
--- uboot-image-raspberrypi3_aarch64-install.orig
+++ uboot-image-raspberrypi3_aarch64-install
@@ -161,6 +161,12 @@ if [ -f "boot/vc/bootcode.bin" -a "$is_e
 	mount /dev/mapper/$PART ./mnt-pi
 	( cd boot/vc; tar c . ) | ( cd ./mnt-pi/; tar x )
 	umount ./mnt-pi
+
+	# Copy device tree
+	mount /dev/mapper/${PART/p1/p2} ./mnt-pi
+	cp boot/*dtb mnt-pi/
+	umount ./mnt-pi
+
 	rmdir ./mnt-pi
 	# "kpartx -dv $diskname" does not work if $diskname
 	# is longer than 64 characters