[-]
[+]
|
Changed |
_service:repo:droid-hal-ace.spec
|
|
[-]
[+]
|
Changed |
_service:repo:droid-hal-grouper.spec
^
|
|
[-]
[+]
|
Changed |
_service:repo:droid-hal-hammerhead.spec
^
|
|
[-]
[+]
|
Changed |
_service:repo:droid-hal-i9305.spec
^
|
|
[-]
[+]
|
Changed |
_service:repo:droid-hal-maguro.spec
^
|
|
[-]
[+]
|
Changed |
_service:repo:droid-hal-mako.spec
^
|
|
[-]
[+]
|
Changed |
_service:repo:droid-hal-n7000.spec
^
|
|
[-]
[+]
|
Changed |
_service:repo:droid-hal-nuc.spec
^
|
|
[-]
[+]
|
Changed |
_service:repo:droid-hal-p3110.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="repo">
<param name="initrepo">lbt/android</param>
<param name="branch">android-ia</param>
- <param name="service">github</param>
+ <param name="service">github</param>
</service>
</services>
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:repo:apply-permissions.c
^
|
@@ -0,0 +1,243 @@
+/**
+ * apply-permissions: Fix ownership/group/permissions in extracted CM releases
+ *
+ * Contact: Thomas Perl <thomas.perl@jolla.com>
+ *
+ * Copyright (c) 2013, Jolla Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Jolla Ltd. nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ **/
+
+
+
+#include <dirent.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "android_filesystem_config.h"
+/* CM > 10.2 use capabilities - this checks that */
+#ifdef CAP_SETUID
+#define CM_USES_CAP 1
+#endif
+
+struct context {
+ // Options
+ int verbose;
+ int debug;
+ int simulate;
+
+ // Statistics
+ struct {
+ int dirs;
+ int files;
+ } count;
+
+ // Global state
+ char *base;
+ int strip;
+};
+
+// Callback for visiting each node in a directory tree walk
+typedef void (*visitor_t)(const char *path, struct stat *st, void *user_data);
+
+// Walk the tree at root, call visitor(path, user_data) for each node
+void walk(const char *root, visitor_t visitor, void *user_data);
+
+// Lookup the symbolic names of a UID or GID from the Android system
+const char *android_uid_name(unsigned uid);
+
+
+
+#define FAIL_IF(x) do { \
+ if ((x)) { \
+ fprintf(stderr, "Error: %s (%s:%d)\n", #x, __FILE__, __LINE__); \
+ exit(3); \
+ } \
+} while (0)
+
+
+
+
+void apply_android_perms(const char *filename, struct stat *st, void *user_data)
+{
+ struct context *ctx = (struct context *)user_data;
+
+ unsigned uid = 0;
+ unsigned gid = 0;
+ unsigned mode = 0;
+ #ifdef CM_USES_CAP
+ uint64_t capa = 0;
+ #endif
+ const char *tuid = NULL;
+ const char *tgid = NULL;
+
+ // Strip leading components, e.g. "../system/foo" -> "system/foo"
+ const char *filename_fs = filename + ctx->strip;
+
+ #ifdef CM_USES_CAP
+ fs_config(filename_fs, S_ISDIR(st->st_mode), &uid, &gid, &mode, &capa);
+ #else
+ fs_config(filename_fs, S_ISDIR(st->st_mode), &uid, &gid, &mode);
+ #endif
+ tuid = android_uid_name(uid);
+ tgid = android_uid_name(gid);
+
+ if (ctx->verbose) {
+ printf("chmod %04o %s\n", mode, filename);
+ }
+
+ if (!ctx->simulate && chmod(filename, mode) != 0) {
+ fprintf(stderr, "Cannot 'chmod %04o %s': %s\n", mode, filename, strerror(errno));
+ exit(2);
+ }
+
+ if (ctx->verbose) {
+ printf("chown %d:%d %s\n", uid, gid, filename);
+ }
+
+ if (!ctx->simulate && chown(filename, uid, gid) != 0) {
+ fprintf(stderr, "Cannot 'chown %s:%s %s': %s\n", tuid, tgid, filename, strerror(errno));
+ exit(2);
+ }
+
+ if (ctx->debug) {
+ fprintf(stderr, "%04o %5d:%5d %8s:%8s %s\n", mode, uid, gid, tuid, tgid, filename_fs);
+ }
+
+ if (S_ISDIR(st->st_mode)) {
+ ctx->count.dirs++;
+ } else {
+ ctx->count.files++;
+ }
+}
+
+
+int main(int argc, char *argv[])
+{
+ static struct context ctx;
+
+ if (argc < 2) {
+ printf("Usage: %s [-v] [-d] [-s] path1 [...]\n\n", argv[0]);
+ printf(" -v .... verbose (log chmod/chown commands)\n");
+ printf(" -d .... debug (detailed permissions output)\n");
+ printf(" -s .... simulate (don't run chown/chmod)\n");
+ printf("\n");
+ printf(" Example: %s system\n", argv[0]);
+ printf("\n");
+ return 1;
+ }
+
+ int i = 1;
+
+ while (i < argc && argv[i][0] == '-') {
+ if (strcmp(argv[i], "-v") == 0) {
+ ctx.verbose = 1;
+ } else if (strcmp(argv[i], "-d") == 0) {
+ ctx.debug = 1;
+ } else if (strcmp(argv[i], "-s") == 0) {
+ ctx.simulate = 1;
+ }
+
+ i++;
+ }
+
+ while (i < argc) {
+ ctx.base = argv[i++];
+
+ // strip trailing slashes
+ char *last = ctx.base + strlen(ctx.base) - 1;
+ while (*last == '/') *last-- = '\0';
+
+ last = strrchr(ctx.base, '/');
+ if (last != NULL) {
+ // Number of characters to strip to get Android-relative
+ // path name, e.g. "../../something/system/foo" -> "system/foo"
+ // ^--------------^
+ // strip this
+ ctx.strip = last - ctx.base + 1;
+ } else {
+ // No slash in the path means we have a relative path like "system"
+ ctx.strip = 0;
+ }
+
+ walk(ctx.base, apply_android_perms, &ctx);
+ }
+
+ if (ctx.verbose) {
+ fprintf(stderr, "Updated permissions of %d files and %d directories\n",
+ ctx.count.files, ctx.count.dirs);
+ }
+
+ return 0;
+}
|
[-]
[+]
|
Changed |
_service:repo:build-from-android
^
|
@@ -0,0 +1,55 @@
+#!/bin/sh
+# droid-hal-device build script from Android tree
+# Copyright (c) 2014 Jolla Ltd.
+# Contact: Thomas Perl <thomas.perl@jolla.com>
+
+if [ ! -d out ]; then
+ echo "Run this script in the Android build tree (containing out/)"
+ exit 1
+fi
+
+# Available products
+PRODUCTS=$(for d in out/target/product/*; do echo "$(basename $d) "; done)
+
+if [ ! -z "$1" ]; then
+ # use "rpm/build-from-android <device>" to select a device
+ DEVICE=$1
+elif [ -z "$PRODUCTS" ]; then
+ echo "No device files found in out/target/product/ - exiting"
+ exit 2
+elif [ $(echo $PRODUCTS | wc -w) != 1 ]; then
+ echo "More than one product found:"
+ echo ""
+ echo " $PRODUCTS"
+ echo ""
+ echo "Use $0 <device> to build for that device"
+ exit 3
+else
+ DEVICE=$(echo $PRODUCTS | tr -d ' ')
+fi
+
+SPECFILE=rpm/droid-hal-${DEVICE}.spec
+if [ ! -f "$SPECFILE" ]; then
+ echo "Cannot find $SPECFILE, available spec files:"
+ for f in rpm/droid-hal-*.spec; do
+ echo " $f"
+ done
+ exit 4
+fi
+
+SOURCEDIR=out/target/product/$DEVICE
+if [ ! -d "$SOURCEDIR" ]; then
+ echo "Cannot find $SOURCEDIR, available directories:"
+ for d in out/target/product/*; do
+ echo " $d"
+ done
+ exit 4
+fi
+
+if ! which mb2 >/dev/null 2>&1; then
+ echo "Required tool 'mb2' not found"
+ exit 5
+fi
+
+echo "Building for $DEVICE using mb2"
+mb2 -s $SPECFILE build
|
[-]
[+]
|
Changed |
_service:repo:droid-hal-device.inc
^
|
@@ -0,0 +1,667 @@
+# This file should be %%included into a device specific spec file
+# where macros are defined:
+# device: should be the CM codename
+# vendor: determine the directory used for ./device/<vendor>/<device>
+# device_pretty: User-visible model name of the device
+# vendor_pretty: User-visible manufacturer name of the device
+# hadk_make_target: the target used when running make in the HABUILD_SDK on the OBS. Defaults to "hybris-hal"
+# device_target_cpu: Used for native builds. Normally the nested droid build env will do an old-fashioned cross-compile and produce non-x86 binaries (default armv7hl). This can be set to tell OBS what arch the binaries are. Eg Android for Intel arch must set this.
+
+%define __provides_exclude_from ^%{_libexecdir}/droid-hybris/.*$
+%define android_root .
+%define rel_date %(date +'%%Y%%m%%d%%H%%M')
+
+# On the OBS this package should be built in the i486 scheduler against
+# mer/sailfish *_i486 targets.
+# The prjconf should have an ExportFilter like this (mer/sailfish has this):
+# ExportFilter: \.armv7hl\.rpm$ armv8el
+# We lie about our architecture and allows OBS to cross-publish this 486 cross-built spec to the armv7hl repos
+%if 0%{?device_target_cpu:1}
+%define my_target_cpu %{device_target_cpu}
+%else
+%define _target_cpu armv7hl
+%endif
+
+# Support build info extracted from OBS builds too
+%if 0%{?_obs_build_project:1}
+%define _build_flavour %(echo %{_obs_build_project} | awk -F : '{if (NF == 3) print $3; else if (NF == 2) print strdevel; else print strunknown}' strdevel=devel strunknown=unknown)
+%else
+%define _build_flavour unknown
+%endif
+
+%define _obs_build_count %(echo %{release} | awk -F . '{if (NF >= 3) print $3; else print $1 }')
+%define _obs_commit_count %(echo %{release} | awk -F . '{if (NF >= 2) print $2; else print $1 }')
+
+%if %{_build_flavour} == release
+%define _version_appendix (%{_target_cpu})
+%else
+%define _version_appendix (%{_target_cpu},%{_build_flavour})
+%endif
+
+%define board_mapping_dir %{_datadir}/ssu/board-mappings.d
+%define board_mapping_file %{board_mapping_dir}/05-%{vendor}-%{device}.ini
+
+# Don't run strip
+%define __strip /bin/true
+
+Summary: Droid HAL package for %{device}
+License: BSD-3-Clause
+Name: droid-hal-%{device}
+Version: 0.0.6
+Release: %{rel_date}
+Provides: droid-hal
+Provides: flash-partition
+# The repo sync service on OBS prepares a 'source tarball' of the rpm
+# dir since we currently have a complex setup with subdirs which OBS
+# doesn't like. This is not a problem for local builds.
+Source0: rpm.tar.bzip2
+Source1: makefstab
+Source2: usergroupgen.c
+Source3: makeudev
+Source4: apply-permissions.c
+Source5: makefile
+Source7: device-%{vendor}-%{device}-configs
+Source8: hybris.conf
+Source10: droid-hal-device.inc
+# This is copied from libhybris and should be kept in-sync:
+Source11: extract-headers.sh
+Source12: init-debug
+# This is not copied from libhybris and should not be kept in-sync:
+Source13: device-configs-all
+Source14: droid.kmap
+Source15: us.kmap
+# Ths actual droid source from the repo service when run on OBS.
+# local builds don't mind if this is missing
+Source40: repo.tar.bzip2
+# Reserve Source50 onwards
+# Allow device specific sources to be defined using dhd_sources
+%{?dhd_sources}
+
+Group: System
+#BuildArch: noarch
+# Note that oneshot is not in mer-core (yet)
+BuildRequires: oneshot
+BuildRequires: systemd
+BuildRequires: qt5-qttools-kmap2qmap >= 5.1.0+git5
+BuildRequires: repomd-pattern-builder
+# These are only required if building on OBS
+%if 0%{?_obs_build_project:1}
+BuildRequires: ubu-trusty
+BuildRequires: sudo-for-abuild
+%endif
+%systemd_requires
+%{_oneshot_requires_post}
+
+%description
+%{summary}.
+
+################
+%package devel
+Group: Development/Tools
+# Requires: %%{name} = %%{version}-%%{release}
+Provides: droid-hal-devel
+Summary: Development files for droid-hal device: %{device}
+
+%description devel
+Device specific droid headers for %{device}.
+Needed by libhybris
+
+################
+%package sailfish-config
+Provides: droid-hal-sailfish-config
+Group: System
+BuildArch: noarch
+Requires: %{name} = %{version}-%{release}
+Requires: oneshot
+Requires: dconf
+Summary: Per device configuration for sailfish for droid-hal device: %{device}
+
+%description sailfish-config
+Configure sailfish eg naturally landscape devices like mako
+
+################
+%package kernel
+Provides: droid-hal-kernel
+Group: System
+Summary: Kernel for droid-hal device: %{device}
+
+%description kernel
+Just the kernel - mainly useful if you want to make a custom img
+
+################
+%package kernel-modules
+Provides: droid-hal-kernel-modules
+Requires: kmod
+Group: System
+Summary: Kernel modules for droid-hal device: %{device}
+
+%description kernel-modules
+Just the kernel modules
+
+################
+%package img-boot
+Provides: droid-hal-img-boot
+Group: System
+Requires: flash-partition
+Requires: oneshot
+%{_oneshot_requires_post}
+Summary: Boot img for droid-hal device: %{device}
+
+%description img-boot
+The boot.img for device
+
+################
+%package img-recovery
+Provides: droid-hal-img-recovery
+Group: System
+BuildArch: noarch
+Summary: Recovery image for droid-hal device: %{device}
+
+%description img-recovery
+The recovery.img for device
+
+################
+%package pulseaudio-settings
+Summary: PulseAudio settings for %{device} hw
+Requires: pulseaudio >= 4.0
+Requires: pulseaudio-modules-nemo-parameters >= 4.0.11
+Requires: pulseaudio-modules-nemo-stream-restore >= 4.0.11
+Requires: pulseaudio-modules-nemo-mainvolume >= 4.0.11
+Requires: pulseaudio-modules-droid >= 4.0.6
+Requires: pulseaudio-policy-enforcement >= 4.0.8
+Provides: pulseaudio-settings
+
+%description pulseaudio-settings
+%{summary}.
+
+################
+%package policy-settings
+Summary: Policy settings for %{device} hw
+Requires: ohm >= 1.1.16
+Requires: ohm-plugins-misc
+Requires: ohm-plugins-dbus
+Requires: ohm-plugin-telephony
+Requires: ohm-plugin-signaling
+Requires: ohm-plugin-media
+Requires: ohm-plugin-accessories
+Requires: ohm-plugin-resolver
+Requires: ohm-plugin-ruleengine
+Requires: ohm-plugin-profile
+Requires: pulseaudio-modules-nemo-common >= 4.0.11
+Requires: pulseaudio-policy-enforcement >= 4.0.8
+Requires: policy-settings-common >= 0.2.0
+Obsoletes: ohm-config <= 1.1.15
+# ohm-configs-default should not be installed ever, thus no version
+# specification defined here.
+Obsoletes: ohm-configs-default
+Provides: ohm-configs > 1.1.15
+Provides: policy-settings
+
|
[-]
[+]
|
Changed |
_service:repo:droid.kmap
^
|
@@ -0,0 +1,11 @@
+keycode 114 = VolumeDown
+keycode 115 = VolumeUp
+keycode 163 = MediaNext
+keycode 164 = MediaTogglePlayPause
+keycode 165 = MediaPrevious
+keycode 166 = MediaStop
+keycode 168 = AudioRewind
+keycode 200 = MediaPlay
+keycode 201 = MediaPause
+keycode 208 = AudioForward
+keycode 256 = ToggleCallHangup
\ No newline at end of file
|
[-]
[+]
|
Changed |
_service:repo:hybris.conf
^
|
@@ -0,0 +1,2 @@
+# Ensure that we can find hybris libs from any hybris-enabled binary
+HYBRIS_LD_LIBRARY_PATH=/usr/libexec/droid-hybris/system/lib:/vendor/lib:/system/lib
|
[-]
[+]
|
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:makefile
^
|
@@ -0,0 +1,18 @@
+# Path to the Android sources
+ANDROID_ROOT ?= ..
+
+# List of local tools we need to build
+TOOLS := apply-permissions usergroupgen
+
+# Include directories
+CFLAGS += -I$(ANDROID_ROOT)/system/core/include/private/
+
+# C99 support
+CFLAGS += -std=c99
+
+all: $(TOOLS)
+
+clean:
+ rm -f $(TOOLS)
+
+.PHONY: all clean
|
[-]
[+]
|
Changed |
_service:repo:makefstab
^
|
@@ -0,0 +1,129 @@
+#!/usr/bin/perl -w
+use File::Basename;
+
+# Modify to handle both fstab and .rc files
+
+my @files;
+my @skip;
+my $args = "";
+my $outputdir=".";
+while (@ARGV) {
+ $_ = shift @ARGV;
+ if (/^--/) {
+ $args=$_; next;
+ }
+
+ if ($args eq "--files") {
+ push @files, $_;
+ } elsif ($args eq "--skip") {
+ push @skip, $_;
+ } elsif ($args eq "--outputdir") {
+ $outputdir=$_;
+ } else {
+ print "Unrecognised args; not part of --files or --skip\n";
+ exit 1;
+ }
+}
+
+for my $file (@files) {
+ open(FILE, "<$file") or die "Can't read from $file\n";
+ next if $file =~ /goldfish/;
+
+ while (<FILE>) {
+ next if /^\s*#/ or /^\s*$/;
+
+ chomp;
+ my ($cmd, $src, $mnt_point, $type, $mnt_flagsandoptions, $fs_mgr_flags);
+
+ if (basename($file) =~ /.rc$/ ) { # mount commands from rc files
+ next unless /^\s*mount\s+/;
+ my $tmpopts;
+ ($cmd, $type, $src, $mnt_point, $tmpopts) = split(" ", $_, 5);
+ $tmpopts ||= ""; # hush in case there are no options
+ # Now extract wait and check options into $fs_mgr_flags as I think they#re none-standard
+ my @opts = split(/ /, $tmpopts);
+
+ $fs_mgr_flags = "";
+ $mnt_flagsandoptions = "";
+ while (@opts) {
+ my $opt = shift @opts;
+ if ($opt =~ /^wait/) {
+ # systemd waits for devices by default so just strip this option
+ # See core/init/builtins.c ~ line 446
+ } else {
+ $mnt_flagsandoptions = "$mnt_flagsandoptions $opt";
+ }
+ }
+ # and convert ' ' to ,:
+ $fs_mgr_flags =~ s/\s+/,/g;
+ $mnt_flagsandoptions =~ s/\s+/,/g;
+
+ } elsif ( basename($file) =~ /^fstab/ ) { # /dev... from fstab files
+ ($src, $mnt_point, $type, $mnt_flagsandoptions, $fs_mgr_flags) = split;
+ } else {
+ print "Can't process file $file. Not an fstab.* or a *.rc\n";
+ exit 1;
+ };
+
+ # droid init.c converts mtd@xxxx to /dev/block/mtdblock%d using
+ # mtd_name_to_number(xxxx) and loop@xxxx to a loopback mount on
+ # file xxxx (I think)
+ next if grep( /^$mnt_point$/, @skip) ;
+
+ # emmc doesn't work. It may be nice to generate these in a
+ # disabled state.
+ next if $type =~ /emmc/ ;
+
+ # From: http://www.freedesktop.org/software/systemd/man/systemd.unit.html :
+ # For unit names reflecting paths
+ # Example: a device unit dev-sda.device == /dev/sda Given a
+ # path, "/" is replaced by "-",
+ ($unitname = $mnt_point) =~ tr(/)(-) ;
+ # and all unprintable characters and the "-" are replaced by
+ # C-style "\x20" escapes.
+ ###### FIXME - not implemented #####
+ # The initial and ending "/" is removed from all paths during
+ # transformation. This escaping is reversible.
+ $unitname =~ s/^-//;
+ $unitname =~ s/-$//;
+ if (-f "$unitname.mount" ) {
+ print "Error, $unitname.mount already exists\n";
+ exit 1;
+ }
+ open(UNIT, ">$outputdir/$unitname.mount") or die "Couldn't write to $outputdir/$unitname.mount\n";
+
+ $secontext = "";
+ if ($mnt_flagsandoptions =~ s/(context=[^,]*)//) {
+ $secontext = $1;
+ }
+ # tidy up in case we left leading,trailing or paired ,s
+ $mnt_flagsandoptions =~ s/,,/,/;
+ $mnt_flagsandoptions =~ s/^,//;
+ $mnt_flagsandoptions =~ s/,$//;
+
+ print UNIT <<"END" ;
+[Unit]
+Description=Droid mount for $mnt_point
+Before=local-fs.target systemd-modules-load.service
+
+[Mount]
+What=$src
+Where=$mnt_point
+Type=$type
+Options=$mnt_flagsandoptions
+# Options had SELinux context option: $secontext
+
+# Default is 90 which makes mount period too long in case of
+# errors so drop it down a notch.
+TimeoutSec=10
+
+[Install]
+WantedBy=local-fs.target
+
+# From $file :
+# $_
+END
+ print "Wrote $unitname.unit\n";
+ close UNIT;
+ }
+}
|
[-]
[+]
|
Changed |
_service:repo:makeudev
^
|
@@ -0,0 +1,141 @@
+#!/usr/bin/perl -w
+
+use File::Basename;
+
+# When testing this can help:
+# udevadm info --query=all --name=/dev/graphics/fb0
+# udevadm test /devices/virtual/graphics/fb0
+
+# From the droid-default-rules in droid-system-packager rpm in
+# /lib/udev/rules.d/990-droid-default.rules we get a list of
+# subsystem/symlink-dirs which may be referenced
+# The key is the target dir created by the udev rule; the value
+# is the subsystem.
+my %std_subsystem_links = (
+ "graphics" => "graphics",
+ "block" => "block",
+ "dri" => "drm",
+ "oncrpc" => "oncrpc",
+ "adsp" => "adsp",
+ "msm_camera" => "msm_camera",
+ "mtd" => "mtd",
+ "block" => "block",
+ );
+
+print "# Generated by the Mer uevent to udev rule generator
+# in the droid-hal-* package
+#
+# This file contains udev rules derived from the uevent.rc
+# The original rc file contents are included preceded by #:
+#
+#
+";
+my $file="";
+while (<>) {
+ if ($file ne $ARGV) { # Note where the original .rc entries are from
+ $file = $ARGV;
+ print "################\n# From ".basename($file)."\n\n";
+ }
+ print "#:$_"; # after including them
+ next if /^\w*#/ or /^\w*$/ ; # skip comments and blank lines
+
+ # Android .rc files for ueventd /sys are :
+ # <devicepath_or_glob> <attr> <perms> <owner> <group>
+ # This is because uevent only allows a single simple glob within the path
+ # Udev handles this by simply concatenating with a /
+ # However udev builtins only operate on /dev nodes (AFAICT)
+ # Matching is done on events without the /sys/ (which is a userspace
+ # convention) but chmod/chown needs the /sys
+ # FIXME: consider replacing chmod/chown with an all-in-one to avoid extra exec()s
+ if (m{^/sys/}) {
+ print "# sys rule\n";
+ s{^/sys/}{};
+ my ($dev, $key, $mode, $owner, $group) = split;
+ print qq{DEVPATH=="$dev/$key", RUN+="/bin/chmod $mode /sys/\$devpath;", RUN+="/bin/chown $owner /sys/\$devpath;", RUN+="/bin/chgrp $group /sys/\$devpath;"\n} ;
+ next;
+ }
+
+ # Android .rc files for ueventd /dev are :
+ # <devicepath_or_glob> <perms> <owner> <group>
+ if ( s{^/dev/}{} ) { # udev doesn't care about /dev ... ever
+ my ($dev, $mode, $owner, $group) = split;
+
+ # Handle the Mer/Hybris rename of /dev/log
+ if ($dev =~ m{^log/}) {
+ print "# Mer/hybris renames /dev/log to /dev/alog (handling as a symlink)\n";
+ $dev =~ s{^log/}{alog/};
+ print qq{SYMLINK=="$dev", MODE="$mode", GROUP="$group", OWNER="$owner"\n} ;
+ next;
+ }
+
+ # For most cases without a / make a plain rule
+ if ($dev !~ m{/}) {
+ print qq{KERNEL=="$dev", MODE="$mode", GROUP="$group", OWNER="$owner"\n} ;
+ next;
+ }
+
+ # skip /dev/input/ because otherwise directories in /dev/input/ get
+ # 660 permissions and groups do not have proper permissions to
+ # access those.
+ # FIXME: better handled by Mer override of droid permissions in udev rules?
+ next if m{^input/} ;
+
+ # handle any specific nodes here
+
+ # Remaining nodes with more depth are assumed to be subsystems
+ if ($dev =~ m{^([^/\s]*)/([^\s]*)}) {
+ my $sub = $1;
+ my $rest = $2;
+
+ # Handle the known symlinks generated by:
+ # SUBSYSTEM=="graphics", SYMLINK+="$env{SUBSYSTEM}/%k"
+ if (defined $std_subsystem_links{$sub}) {
+ print "# Known droid dir $std_subsystem_links{$sub}/ is for subsystem $sub\n";
+ print qq{SYMLINK=="$dev", MODE="$mode", GROUP="$group", OWNER="$owner"\n} ;
+ print qq{SUBSYSTEM=="$std_subsystem_links{$sub}", KERNEL=="$rest", MODE="$mode", GROUP="$group", OWNER="$owner"\n} ;
+ next;
+ }
+
+ # udev requires that "bus" is literally replaced with "subsystem"
+ # but we ignore it in usb anyway
+ # I wonder if we should reparse bus/* after stripping bus/ ???
+ $sub = "subsystem" if $sub eq "bus";
+
+ # handle /dev/bus/usb*
+ if ( $rest =~ m{^usb/(.*)} ) {
+ print "# usb rule\n";
+ print qq{SUBSYSTEM=="usb", KERNEL=="$1", MODE="$mode", GROUP="$group", OWNER="$owner"\n} ;
+ next;
+ }
+
+ # Any Multi-level devices need to be handled above as per usb
+ if ($rest =~ m{/}) {
+ die "Can't handle unknown multi-level devices\n$_\n";
+ }
+
+ # handle any unknowns
+ print "# Standard subsystem rule\n";
+ print qq{SUBSYSTEM=="$1", KERNEL=="$2", MODE="$mode", GROUP="$group", OWNER="$owner"\n} ;
+ next;
+ }
+ }
+
+ if (m{^mtd@}) {
+ print STDERR "WARNING \@mtd support not yet implemented (see system/core/init/ueventd.c\n";
+ }
+
+ print "# WARNING rule in comment above was not converted\n";
+ print STDERR "WARNING Rule not converted: $_\n";
+}
+
+# Some tests:
+# Make a little helper fn()
+# tdev() { udevadm info --query=all --name=$1; udevadm test $(udevadm info --query=path --name=$1); grep $1 /lib/udev/rules.d/999-android-system.rules; ls -laF $1; }
+
+# tdev /dev/android_adb
+# tdev /dev/graphics/fb0
+# tdev /dev/bus/usb/001/001
+# tdev /dev/cam
+
+# filter out relevant lines
+# tdev /dev/android_adb 2>&1 | grep 999
|
|
Changed |
_service:repo:repo.tar.bzip2
^
|
|
Changed |
_service:repo:rpm.tar.bzip2
^
|
[-]
[+]
|
Changed |
_service:repo:rpmlintrc
^
|
@@ -0,0 +1,3 @@
+from Config import *
+addFilter(".*")
+
|
[-]
[+]
|
Changed |
_service:repo:us.kmap
^
|
@@ -0,0 +1,99 @@
+# us.map
+keymaps 0-2,4-6,8-9,12
+alt_is_meta
+strings as usual
+
+keycode 1 = Escape
+keycode 2 = one exclam
+keycode 3 = two at at nul nul
+keycode 4 = three numbersign
+ control keycode 4 = Escape
+keycode 5 = four dollar dollar Control_backslash
+keycode 6 = five percent
+ control keycode 6 = Control_bracketright
+keycode 7 = six asciicircum
+ control keycode 7 = Control_asciicircum
+keycode 8 = seven ampersand braceleft Control_underscore
+keycode 9 = eight asterisk bracketleft Delete
+keycode 10 = nine parenleft bracketright
+keycode 11 = zero parenright braceright
+keycode 12 = minus underscore backslash Control_underscore Control_underscore
+keycode 13 = equal plus
+keycode 14 = Delete
+keycode 15 = Tab
+ shift keycode 15 = Meta_Tab
+
+# qwerty-layout
+keycode 16 = q
+keycode 17 = w
+keycode 18 = e
+keycode 19 = r
+keycode 20 = t
+keycode 21 = y
+keycode 22 = u
+keycode 23 = i
+keycode 24 = o
+keycode 25 = p
+#
+keycode 30 = a
+keycode 31 = s
+keycode 32 = d
+keycode 33 = f
+keycode 34 = g
+keycode 35 = h
+keycode 36 = j
+keycode 37 = k
+keycode 38 = l
+#
+keycode 44 = z
+keycode 45 = x
+keycode 46 = c
+keycode 47 = v
+keycode 48 = b
+keycode 49 = n
+keycode 50 = m
+#
+
+keycode 26 = bracketleft braceleft
+ control keycode 26 = Escape
+keycode 27 = bracketright braceright asciitilde Control_bracketright
+keycode 28 = Return
+ alt keycode 28 = Meta_Control_m
+keycode 29 = Control
+keycode 39 = semicolon colon
+keycode 40 = apostrophe quotedbl
+ control keycode 40 = Control_g
+keycode 41 = grave asciitilde
+ control keycode 41 = nul
+keycode 42 = Shift
+keycode 43 = backslash bar
+ control keycode 43 = Control_backslash
+keycode 51 = comma less
+keycode 52 = period greater
+keycode 53 = slash question
+ control keycode 53 = Control_underscore
+ control shift keycode 53 = Delete
+keycode 54 = Shift
+keycode 56 = Alt
+keycode 57 = space
+ control keycode 57 = nul
+keycode 58 = Caps_Lock
+keycode 86 = less greater bar
+keycode 97 = Control
+
+#
+# The four cursor keys
+#
+keycode 103 = Up
+keycode 105 = Left
+keycode 106 = Right
+keycode 108 = Down
+#
+# The six edit keys
+#
+keycode 110 = Insert
+keycode 102 = Home # Find
+keycode 104 = PageUp # Prior
+keycode 111 = Remove
+keycode 107 = End # Select
+keycode 109 = PageDown # Next
|
[-]
[+]
|
Changed |
_service:repo:usergroupgen.c
^
|
@@ -0,0 +1,63 @@
+/*
+ * Contact: Carsten Munk <carsten.munk@jollamobile.com>
+ *
+ * Copyright (c) 2013, Jolla Ltd.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the <organization> nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "android_filesystem_config.h"
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ if (argc != 2 || (strcmp(argv[1], "remove") != 0 &&
+ strcmp(argv[1], "add") != 0)) {
+ fprintf(stderr, "Usage: %s [add|remove]\n", argv[0]);
+ return 1;
+ }
+
+ int add = (strcmp(argv[1], "add") == 0);
+
+ printf("#!/bin/sh\n");
+ for (int i = 0; i < android_id_count; i++) {
+ if (android_ids[i].aid == 0) {
+ /* Skip creating/removing the root user */
+ continue;
+ } else if (add) {
+ /* Add groups before users */
+ printf("groupadd -g %i %s\n", android_ids[i].aid,
+ android_ids[i].name);
+ printf("useradd -M -N -s /sbin/nologin -d / -u %i -g %i %s\n",
+ android_ids[i].aid, android_ids[i].aid,
+ android_ids[i].name);
+ } else {
+ /* Remove groups after users */
+ printf("userdel -f %s\n", android_ids[i].name);
+ printf("groupdel %s\n", android_ids[i].name);
+ }
+ }
+
+ return 0;
+}
|