├── systemd-initramfs ├── dev │ └── .empty ├── sys │ └── .empty ├── data │ └── .empty ├── init ├── proc │ └── .empty └── sbin │ ├── busybox1 │ └── init ├── rules.d └── 50-firmware.rules ├── tmpfiles.d └── adbd.conf ├── fbterm ├── fbterm-login └── getty@.service ├── system ├── refresher.service ├── adbd.service └── firmware.service ├── mkinicpio ├── install │ └── imgmount ├── mkinitcpio.patch └── hooks │ └── imgmount ├── firmware.sh ├── abootimg.cfg ├── makebootimage.sh ├── xorg ├── xorg.conf ├── PKGBUILD.libdrm └── PKGBUILD.mesa ├── multirom ├── init.noimageboot └── rom_info.txt ├── refresher.c ├── kernel └── 0001-make-ektf3k-driver-report-non-MT-events-too.patch └── README.md /systemd-initramfs/dev/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /systemd-initramfs/sys/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /systemd-initramfs/data/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /systemd-initramfs/init: -------------------------------------------------------------------------------- 1 | sbin/init -------------------------------------------------------------------------------- /systemd-initramfs/proc/.empty: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rules.d/50-firmware.rules: -------------------------------------------------------------------------------- 1 | SUBSYSTEM=="firmware", ACTION=="add", RUN+="/usr/local/sbin/firmware.sh" 2 | -------------------------------------------------------------------------------- /systemd-initramfs/sbin/busybox1: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/crondog/arch-flo/HEAD/systemd-initramfs/sbin/busybox1 -------------------------------------------------------------------------------- /tmpfiles.d/adbd.conf: -------------------------------------------------------------------------------- 1 | w /sys/class/android_usb/android0/functions - - - - adb,rndis 2 | w /sys/class/android_usb/android0/enable - - - - 1 3 | 4 | -------------------------------------------------------------------------------- /fbterm/fbterm-login: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # example: fbterm-login fb1 tty1 3 | export FRAMEBUFFER=/dev/$1 4 | exec /usr/bin/fbterm -r 1 -s 24 -- /usr/bin/login < /dev/$2 5 | -------------------------------------------------------------------------------- /system/refresher.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Before=graphical.target 3 | 4 | [Service] 5 | Type=simple 6 | ExecStart=/bin/refresher 7 | 8 | [Install] 9 | WantedBy=multi-user.target 10 | 11 | -------------------------------------------------------------------------------- /mkinicpio/install/imgmount: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | build () 4 | { 5 | add_runscript 6 | } 7 | 8 | help () 9 | { 10 | cat< /sys/$DEVPATH/loading 6 | cat /lib/firmware/$FIRMWARE > /sys/$DEVPATH/data 7 | echo 0 > /sys/$DEVPATH/loading 8 | else 9 | echo -1 > /sys/$DEVPATH/loading 10 | fi 11 | -------------------------------------------------------------------------------- /system/adbd.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=ADB Daemon 3 | After=systemd-tmpfiles-setup.service 4 | 5 | [Service] 6 | Type=simple 7 | ExecStart=/bin/bash -c '/sbin/adbd 2> /var/log/adbd.err 1> /var/log/adbd.out' 8 | 9 | [Install] 10 | WantedBy=basic.target 11 | Before=network.service 12 | -------------------------------------------------------------------------------- /abootimg.cfg: -------------------------------------------------------------------------------- 1 | pagesize = 0x800 2 | kerneladdr = 0x80208000 3 | ramdiskaddr = 0x82200000 4 | secondaddr = 0x81100000 5 | tagsaddr = 0x80200100 6 | name = 7 | cmdline = console=ttyHSL0,115200,n8 g_serial.n_ports=2 console=tty1 fbcon=rotate:1 androidboot.hardware=flo user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 selinux=0 fsck.mode=skip 8 | -------------------------------------------------------------------------------- /system/firmware.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Load wlan firmware 3 | Wants=network.target 4 | Before=network.target 5 | 6 | [Service] 7 | Type=oneshot 8 | ExecStart=/usr/bin/modprobe wlan 9 | ExecStart=/usr/bin/bash -c 'echo 1 > /sys/module/hci_smd/parameters/hcismd_set;' 10 | 11 | [Install] 12 | WantedBy=multi-user.target 13 | -------------------------------------------------------------------------------- /mkinicpio/mkinitcpio.patch: -------------------------------------------------------------------------------- 1 | --- /usr/bin/mkinitcpio 2014-03-09 06:12:20.000000000 +1100 2 | +++ mkinitcpio 2014-04-25 14:04:21.149124690 +1000 3 | @@ -87,6 +87,8 @@ 4 | resolve_kernver() { 5 | local kernel=$1 offset kver 6 | 7 | + uname -r 8 | + return 0 9 | if [[ -z $kernel ]]; then 10 | uname -r 11 | return 0 12 | -------------------------------------------------------------------------------- /makebootimage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #KERNEL=~/android/system/out/target/product/flo/kernel 4 | KERNEL=~/android/kernel_msm/arch/arm/boot/zImage 5 | INITRAMFS=minimal.initramfs 6 | 7 | ~/android/system/out/host/linux-x86/bin/mkbootimg --kernel $KERNEL --cmdline "console=ttyHSL0,115200,n8 g_serial.n_ports=2 console=tty1 fbcon=rotate:1 androidboot.hardware=flo user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 selinux=0 fsck.mode=skip" --base 0x80200000 --pagesize 2048 --ramdisk_offset 0x02000000 --ramdisk $INITRAMFS --output newboot 8 | -------------------------------------------------------------------------------- /xorg/xorg.conf: -------------------------------------------------------------------------------- 1 | Section "Device" 2 | Identifier "Video Device" 3 | Driver "freedreno" 4 | # Uncomment for addition debug traces in xorg log: 5 | Option "Debug" "true" 6 | # The below two options are not needed if you are using the 7 | # msm drm/kms driver: 8 | Option "fb" "/dev/fb0" 9 | Option "SWCursor" "true" 10 | Option "SWRefresher" "false" 11 | Option "NoAccel" "true" 12 | EndSection 13 | Section "Screen" 14 | Identifier "Screen" 15 | Monitor "Monitor" 16 | Device "Video Device" 17 | EndSection 18 | -------------------------------------------------------------------------------- /systemd-initramfs/sbin/init: -------------------------------------------------------------------------------- 1 | #!/sbin/busybox1 sh 2 | 3 | _PATH="$PATH" 4 | export BB=/sbin/busybox1 5 | 6 | cd / 7 | 8 | $BB mount -t devtmpfs devtmpfs /dev -o mode=0755,nosuid 9 | 10 | $BB mkdir /dev/pts 11 | $BB mkdir /dev/socket 12 | 13 | $BB mount -t proc proc /proc -o nosuid,noexec,nodev 14 | $BB mount -t sysfs sys /sys -o nosuid,noexec,nodev 15 | 16 | $BB mdev -s 17 | 18 | $BB mount -t ext4 /dev/mmcblk0p30 /data 19 | 20 | $BB mknod /dev/loop256 b 7 256 21 | $BB losetup /dev/loop256 /data/arch.img 22 | $BB mount -t ext4 -o rw,noatime /dev/loop256 /data/arch 23 | 24 | $BB mkdir /cache 25 | $BB mount -t ext4 /dev/mmcblk0p23 /cache 26 | 27 | export PATH="${_PATH}" 28 | 29 | #exec /sbin/init2 30 | exec /sbin/busybox1 switch_root /data/arch /sbin/init 31 | -------------------------------------------------------------------------------- /multirom/init.noimageboot: -------------------------------------------------------------------------------- 1 | #!/sbin/busybox1 sh 2 | 3 | ROM_NAME="ArchLinux" 4 | _PATH="$PATH" 5 | export BB=/sbin/busybox1 6 | 7 | cd / 8 | 9 | $BB mount -t devtmpfs devtmpfs /dev -o mode=0755,nosuid 10 | 11 | $BB mkdir /dev/pts 12 | $BB mkdir /dev/socket 13 | 14 | $BB mount -t proc proc /proc -o nosuid,noexec,nodev 15 | $BB mount -t sysfs sys /sys -o nosuid,noexec,nodev 16 | 17 | $BB mdev -s 18 | 19 | $BB mount -t ext4 /dev/mmcblk0p30 /data 20 | 21 | # switch_root works *as long* as the new root is a mountpoint. 22 | # According to the manpage, this can be even bound. Good for us. 23 | $BB mount -o bind "/data/media/0/multirom/roms/${ROM_NAME}/root/" "/data/arch" 24 | 25 | $BB mkdir /cache 26 | $BB mount -t ext4 /dev/mmcblk0p23 /cache 27 | 28 | export PATH="${_PATH}" 29 | 30 | exec /sbin/busybox1 switch_root /data/arch /sbin/init -------------------------------------------------------------------------------- /mkinicpio/hooks/imgmount: -------------------------------------------------------------------------------- 1 | #!/usr/bin/ash 2 | 3 | # You can set these variables manually inside their respective functions if 4 | # you do not wish to boot using MultiROM: 5 | # 6 | # To boot using a loop-mounted image stored in /data as the root FS: 7 | # loop=/path/to/arch.img 8 | # loopfstype=ext4 9 | # 10 | # To boot using a bind-mounted subdirectory of /data as the root FS: 11 | # rootsubdir=/local/arch 12 | # 13 | # loop= and rootsubdir= are relative to /data on Android, not /. 14 | 15 | 16 | run_hook () { 17 | if [ -z "$rootsubdir" ]; then 18 | if [ -z "$loop" ]; then 19 | error "no loop= or rootsubdir= provided on cmdline" 20 | return 1 21 | else 22 | msg "root is an image at: $loop" 23 | mount_handler="img_mount_handler" 24 | fi 25 | else 26 | msg "root is a subdirectory at: $rootsubdir" 27 | mount_handler="dir_mount_handler" 28 | fi 29 | } 30 | 31 | img_mount_handler() { 32 | mkdir /host 33 | mount -t $rootfstype $root /host 34 | mknod /dev/loop256 b 7 256 35 | losetup /dev/loop256 /host/$loop 36 | mount -t $loopfstype -o rw,noatime /dev/loop256 /new_root 37 | } 38 | 39 | dir_mount_handler() { 40 | mkdir /host 41 | mount -t $rootfstype $root /host 42 | mount --bind /host/$rootsubdir /new_root 43 | } 44 | -------------------------------------------------------------------------------- /xorg/PKGBUILD.libdrm: -------------------------------------------------------------------------------- 1 | # $Id: PKGBUILD 204511 2014-01-21 18:58:35Z lcarlier $ 2 | # Maintainer: Jan de Groot 3 | 4 | pkgname=libdrm 5 | pkgver=2.4.52 6 | pkgrel=1 7 | pkgdesc="Userspace interface to kernel DRM services" 8 | arch=(i686 x86_64) 9 | license=('custom') 10 | depends=('glibc' 'libpciaccess') 11 | makedepends=('valgrind') 12 | checkdepends=('cairo') 13 | replaces=('libdrm-new' 'libdrm-nouveau') 14 | #options=(debug !strip) 15 | options=(!strip) 16 | url="http://dri.freedesktop.org/" 17 | source=("libdrm::git://anongit.freedesktop.org/mesa/drm" 18 | COPYING) 19 | sha256sums=('SKIP' 20 | '9631d4f694952e3e6ae5a05534c2e93e994e47d3413677a3a00e45c8cef6db93') 21 | 22 | pkgver(){ 23 | cd $pkgname 24 | git describe --long | sed -r 's/([^-]*-g)/r\1/;s/-/./g' 25 | } 26 | build() { 27 | cd $pkgname 28 | 29 | # pthread is useless in Linux 30 | sed -i "/pthread-stubs/d" configure.ac 31 | autoreconf --force --install 32 | 33 | ./configure --prefix=/usr --enable-freedreno-experimental-api 34 | make 35 | } 36 | 37 | check() { 38 | cd $pkgname 39 | make -k check 40 | } 41 | 42 | package() { 43 | cd $pkgname 44 | make DESTDIR="$pkgdir" install 45 | install -m755 -d "$pkgdir/usr/share/licenses/$pkgname" 46 | install -m644 ../COPYING "$pkgdir/usr/share/licenses/$pkgname/" 47 | } 48 | -------------------------------------------------------------------------------- /fbterm/getty@.service: -------------------------------------------------------------------------------- 1 | # This file is part of systemd. 2 | # 3 | # systemd is free software; you can redistribute it and/or modify it 4 | # under the terms of the GNU Lesser General Public License as published by 5 | # the Free Software Foundation; either version 2.1 of the License, or 6 | # (at your option) any later version. 7 | 8 | [Unit] 9 | Description=Getty on %I 10 | Documentation=man:agetty(8) man:systemd-getty-generator(8) 11 | Documentation=http://0pointer.de/blog/projects/serial-console.html 12 | After=systemd-user-sessions.service plymouth-quit-wait.service 13 | 14 | # If additional gettys are spawned during boot then we should make 15 | # sure that this is synchronized before getty.target, even though 16 | # getty.target didn't actually pull it in. 17 | Before=getty.target 18 | IgnoreOnIsolate=yes 19 | 20 | # On systems without virtual consoles, don't start any getty. Note 21 | # that serial gettys are covered by serial-getty@.service, not this 22 | # unit. 23 | ConditionPathExists=/dev/tty0 24 | 25 | [Service] 26 | # the VT is cleared by TTYVTDisallocate 27 | ExecStart=-/opt/fbterm-login fb0 %I 28 | Type=idle 29 | Restart=always 30 | RestartSec=0 31 | UtmpIdentifier=%I 32 | TTYPath=/dev/%I 33 | TTYReset=yes 34 | TTYVHangup=yes 35 | TTYVTDisallocate=yes 36 | KillMode=process 37 | IgnoreSIGPIPE=no 38 | SendSIGHUP=yes 39 | 40 | # Unset locale for the console getty since the console has problems 41 | # displaying some internationalized messages. 42 | Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION= 43 | 44 | [Install] 45 | WantedBy=getty.target 46 | -------------------------------------------------------------------------------- /refresher.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | struct fb_info{ 20 | int fd; 21 | void *ptr; 22 | struct fb_var_screeninfo var; 23 | struct fb_fix_screeninfo fix; 24 | }; 25 | 26 | void fb_getinfo(struct fb_info *fb_info){ 27 | printf("fb res %dx%d virtual %dx%d, line_len %d\n", 28 | fb_info->var.xres, fb_info->var.yres, 29 | fb_info->var.xres_virtual, fb_info->var.yres_virtual, 30 | fb_info->fix.line_length); 31 | printf("dim %dmm x %dmm\n", fb_info->var.width, fb_info->var.height); 32 | printf("xoffset %d yoffset %d\n", fb_info->var.xoffset, fb_info->var.yoffset); 33 | } 34 | int fb_open(struct fb_info *fb_info){ 35 | 36 | int fd = open("/dev/fb0", O_RDWR); 37 | 38 | if(fd < 0){ 39 | printf("Failed to open fb\n"); 40 | return 1; 41 | } 42 | 43 | memset(fb_info, 0, sizeof(struct fb_info)); 44 | fb_info->fd = fd; 45 | return 0; 46 | } 47 | 48 | 49 | void flip_buffer(struct fb_info *fb_info, int n){ 50 | if( ioctl(fb_info->fd, FBIOPAN_DISPLAY, &fb_info->var) < 0 ){ 51 | perror("Failed FBIOPAN_DISPLAY"); 52 | } 53 | } 54 | int main(int argc, char *argv[]){ 55 | 56 | setpriority(PRIO_PROCESS, 0, -20); 57 | 58 | struct fb_info fb_info; 59 | fb_open(&fb_info); 60 | 61 | while(1){ 62 | flip_buffer(&fb_info,0); 63 | usleep(16666); 64 | } 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /multirom/rom_info.txt: -------------------------------------------------------------------------------- 1 | # This file contains info about ROMs capabilites and boot process. 2 | # It should be placed in ROM's folder (eg. /media/multirom/roms/*rom_name*) 3 | # and must be named "rom_info.txt". 4 | # Make sure you got the syntax correct, as the parser is probably pretty 5 | # dumb. Lines with comments must start with #. Beware the whitespaces. 6 | # If you need to use " character in string, just use it, no need to escape it 7 | # MultiROM searches for first and last " on the line. 8 | # These comments should not be deleted. 9 | 10 | # So far, the only supported ROM type for these files is kexec-based linux 11 | type="kexec" 12 | 13 | # Paths to root of the ROM. 14 | # Both image and folder can be specified at one time, MultiROM will use 15 | # the one which it can find. If both are present, folder is used. 16 | # Must _not_ contain spaces. 17 | # Path is from root of the root partition, but you will usually want 18 | # to use following alias: 19 | # - %m - ROM's folder (eg. /media/multirom/roms/*rom_name*) 20 | root_dir="%m/root" 21 | root_img="%m/root.img" 22 | root_img_fs="ext4" 23 | 24 | # Path to kernel and initrd. Kernel path _must_ be specified. 25 | # Paths are relative to the folder in which is this file 26 | # Those can be outside the root folder/image, or use %r if it is in there: 27 | # kernel_path="%r/boot/vmlinuz" 28 | # If ROM is in images, it will mount the image and load it from there. 29 | # You can use * _at the end of the filename_ as wildcard character. 30 | kernel_path="%r/boot/vmlinuz" 31 | initrd_path="%r/boot/initrd.img" 32 | 33 | # Set up the cmdline 34 | # img_cmdline and dir_cmdline are appended to base_cmdline. 35 | # Several aliases are used: 36 | # - %b - base command line from bootloader. You want this as first thing in cmdline. 37 | # - %d - root device. is either "UUID=..." (USB drive) or "/dev/mmcblk0p9" or "/dev/mmcblk0p10" 38 | # - %r - root fs type 39 | # - %s - root directory, from root of the root device 40 | # - %i - root image, from root of the root device 41 | # - %f - fs of the root image 42 | base_cmdline="%b root=%d rootfstype=%r rw console=tty0 rootflags=defaults,noatime,nodiratime" 43 | img_cmdline="loop=%i loopfstype=%f" 44 | dir_cmdline="rootsubdir=%s" 45 | 46 | -------------------------------------------------------------------------------- /kernel/0001-make-ektf3k-driver-report-non-MT-events-too.patch: -------------------------------------------------------------------------------- 1 | From ad8725fb07407deb688813e075b05e790dac2878 Mon Sep 17 00:00:00 2001 2 | From: Seth Forshee 3 | Date: Tue, 18 Feb 2014 23:07:22 +1100 4 | Subject: [PATCH] make ektf3k driver report non-MT events too 5 | 6 | Change-Id: Ia4f05b33f06d7a8fc74e65330f9c41df8a8ba7a9 7 | --- 8 | drivers/input/touchscreen/ektf3k.c | 8 +++++++- 9 | 1 file changed, 7 insertions(+), 1 deletion(-) 10 | 11 | diff --git a/drivers/input/touchscreen/ektf3k.c b/drivers/input/touchscreen/ektf3k.c 12 | index 4b6a7e7..28fee64 100755 13 | --- a/drivers/input/touchscreen/ektf3k.c 14 | +++ b/drivers/input/touchscreen/ektf3k.c 15 | @@ -967,6 +967,7 @@ static void elan_ktf3k_ts_report_data(struct i2c_client *client, uint8_t *buf) 16 | fbits = fbits >> 1; 17 | idx += 3; 18 | } 19 | + input_mt_report_pointer_emulation(ts->input_dev, true); 20 | input_sync(idev); 21 | } // checksum 22 | else { 23 | @@ -1017,6 +1018,7 @@ static void elan_ktf3k_ts_report_data2(struct i2c_client *client, uint8_t *buf) 24 | fbits = fbits >> 1; 25 | idx += 3; 26 | } 27 | + input_mt_report_pointer_emulation(ts->input_dev, true); 28 | input_sync(idev); 29 | } // checksum 30 | else { 31 | @@ -1542,11 +1544,15 @@ static int elan_ktf3k_ts_probe(struct i2c_client *client, 32 | } 33 | ts->input_dev->name = "elan-touchscreen"; 34 | 35 | - //set_bit(BTN_TOUCH, ts->input_dev->keybit); 36 | + set_bit(BTN_TOUCH, ts->input_dev->keybit); 37 | ts->abs_x_max = pdata->abs_x_max; 38 | ts->abs_y_max = pdata->abs_y_max; 39 | touch_debug(DEBUG_INFO, "[Elan] Max X=%d, Max Y=%d\n", ts->abs_x_max, ts->abs_y_max); 40 | 41 | + input_set_abs_params(ts->input_dev, ABS_X, pdata->abs_y_min, pdata->abs_y_max, 0, 0); // for 800 * 1280 42 | + input_set_abs_params(ts->input_dev, ABS_Y, pdata->abs_x_min, pdata->abs_x_max, 0, 0); // for 800 * 1280 43 | + input_set_abs_params(ts->input_dev, ABS_PRESSURE, 0, MAX_FINGER_PRESSURE, 0, 0); 44 | + 45 | input_mt_init_slots(ts->input_dev, FINGER_NUM); 46 | input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, pdata->abs_y_min, pdata->abs_y_max, 0, 0); // for 800 * 1280 47 | input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, pdata->abs_x_min, pdata->abs_x_max, 0, 0);// for 800 * 1280 48 | -- 49 | 1.8.5.3 50 | 51 | -------------------------------------------------------------------------------- /xorg/PKGBUILD.mesa: -------------------------------------------------------------------------------- 1 | # $Id: PKGBUILD 205069 2014-02-04 11:01:18Z andyrtr $ 2 | # Maintainer: Jan de Groot 3 | # Maintainer: Andreas Radke 4 | 5 | pkgbase=mesa 6 | pkgname=('freedreno-dri' 'mesa' 'mesa-libgl') 7 | pkgver=10.0.3 8 | pkgrel=1 9 | arch=('i686' 'x86_64') 10 | makedepends=('python2' 'libxml2' 'libx11' 'glproto' 'libdrm' 'dri2proto' 'libxxf86vm' 'libxdamage' 11 | 'libvdpau' 'wayland' 'elfutils' 'systemd') 12 | url="http://mesa3d.sourceforge.net" 13 | license=('custom') 14 | options=(debug !strip) 15 | #source=(ftp://ftp.freedesktop.org/pub/mesa/${pkgver}/MesaLib-${pkgver}.tar.bz2 16 | source=("Mesa-10::git://github.com/freedreno/mesa.git" 17 | LICENSE) 18 | md5sums=('SKIP' 19 | '5c65a0fe315dd347e09b1f2826a1df5a') 20 | 21 | prepare(){ 22 | cd ${srcdir}/?esa-* 23 | echo $(cat VERSION | tr "-" "_").$(git rev-list --count HEAD) 24 | } 25 | build() { 26 | cd ${srcdir}/?esa-* 27 | 28 | autoreconf -vfi # our automake is far too new for their build system :) 29 | 30 | ./configure --prefix=/usr \ 31 | --sysconfdir=/etc \ 32 | --with-dri-driverdir=/usr/lib/xorg/modules/dri \ 33 | --with-dri-drivers= --with-gallium-drivers=freedreno,swrast \ 34 | --with-egl-platforms=x11 --enable-gles2 --enable-gles1 \ 35 | --enable-gallium-egl --disable-gallium-llvm --enable-xa --disable-dri3 \ 36 | --enable-gbm 37 | #--enable-debug 38 | make 39 | 40 | # fake installation 41 | mkdir $srcdir/fakeinstall 42 | make DESTDIR=${srcdir}/fakeinstall install 43 | } 44 | 45 | package_freedreno-dri() { 46 | pkgdesc="Mesa drivers for AMD/ATI Radeon" 47 | depends=('mesa-libgl' 'libtxc_dxtn' "mesa=${pkgver}") 48 | conflicts=('xf86-video-ati<6.9.0-6') 49 | 50 | install -m755 -d ${pkgdir}/usr/lib/dri 51 | mkdir -p ${pkgdir}/usr/lib/xorg/modules/dri/ 52 | mv -v ${srcdir}/fakeinstall/usr/lib/xorg/modules/dri/{kgsl,msm}_dri.so ${pkgdir}/usr/lib/xorg/modules/dri/ 53 | 54 | } 55 | 56 | package_mesa() { 57 | pkgdesc="an open-source implementation of the OpenGL specification" 58 | depends=('libdrm' 'wayland' 'libxxf86vm' 'libxdamage' 'systemd' 'elfutils' ) 59 | optdepends=('opengl-man-pages: for the OpenGL API man pages') 60 | provides=('libglapi' 'osmesa' 'libgbm' 'libgles' 'libegl' 'khrplatform-devel') 61 | conflicts=('libglapi' 'osmesa' 'libgbm' 'libgles' 'libegl' 'khrplatform-devel') 62 | replaces=('libglapi' 'osmesa' 'libgbm' 'libgles' 'libegl' 'khrplatform-devel') 63 | 64 | mv -v ${srcdir}/fakeinstall/* ${pkgdir} 65 | # rename libgl/EGL/glesv*.so to not conflict with blobs - may break .pc files ? 66 | mv ${pkgdir}/usr/lib/libGL.so.1.2.0 ${pkgdir}/usr/lib/mesa-libGL.so.1.2.0 67 | mv ${pkgdir}/usr/lib/libEGL.so.1.0.0 ${pkgdir}/usr/lib/mesa-libEGL.so.1.0.0 68 | mv ${pkgdir}/usr/lib/libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib/mesa-libGLESv1_CM.so.1.1.0 69 | mv ${pkgdir}/usr/lib/libGLESv2.so.2.0.0 ${pkgdir}/usr/lib/mesa-libGLESv2.so.2.0.0 70 | 71 | rm ${pkgdir}/usr/lib/lib{GL,EGL,GLESv1_CM,GLESv2}.so* 72 | install -m755 -d "${pkgdir}/usr/share/licenses/mesa" 73 | install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/mesa/" 74 | } 75 | 76 | package_mesa-libgl() { 77 | pkgdesc="Mesa 3-D graphics library" 78 | depends=("mesa=${pkgver}") 79 | provides=("libgl=${pkgver}") 80 | replaces=('libgl') 81 | 82 | # See FS#26284 83 | install -m755 -d "${pkgdir}/usr/lib/xorg/modules/extensions" 84 | ln -s libglx.xorg "${pkgdir}/usr/lib/xorg/modules/extensions/libglx.so" 85 | 86 | #ln -s mesa-libGL.so.1.2.0 ${pkgdir}/usr/lib/libGL.so 87 | #ln -s mesa-libGL.so.1.2.0 ${pkgdir}/usr/lib/libGL.so.1 88 | #ln -s mesa-libGL.so.1.2.0 ${pkgdir}/usr/lib/libGL.so.1.2.0 89 | ln -s mesa-libGL.so.1.2.0 ${pkgdir}/usr/lib/libGL.so 90 | ln -s mesa-libGL.so.1.2.0 ${pkgdir}/usr/lib/libGL.so.1 91 | ln -s mesa-libGL.so.1.2.0 ${pkgdir}/usr/lib/libGL.so.1.2.0 92 | ln -s mesa-libEGL.so.1.0.0 ${pkgdir}/usr/lib/libEGL.so 93 | ln -s mesa-libEGL.so.1.0.0 ${pkgdir}/usr/lib/libEGL.so.1 94 | ln -s mesa-libEGL.so.1.0.0 ${pkgdir}/usr/lib/libEGL.so.1.0.0 95 | ln -s mesa-libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib/libGLESv1_CM.so 96 | ln -s mesa-libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib/libGLESv1_CM.so.1 97 | ln -s mesa-libGLESv1_CM.so.1.1.0 ${pkgdir}/usr/lib/libGLESv1_CM.so.1.1.0 98 | ln -s mesa-libGLESv2.so.2.0.0 ${pkgdir}/usr/lib/libGLESv2.so 99 | ln -s mesa-libGLESv2.so.2.0.0 ${pkgdir}/usr/lib/libGLESv2.so.2 100 | ln -s mesa-libGLESv2.so.2.0.0 ${pkgdir}/usr/lib/libGLESv2.so.2.0.0 101 | 102 | install -m755 -d "${pkgdir}/usr/share/licenses/mesa-libgl" 103 | install -m644 "${srcdir}/LICENSE" "${pkgdir}/usr/share/licenses/mesa-libgl/" 104 | } 105 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arch Linux on Nexus 7 2013 Flo (Native) 2 | 3 | Here are my instructions on getting Arch Linux ARM natively booting on the 4 | Nexus 7 2013 Flo. Ideally this would be booting from a usb stick or a dedicated 5 | partition on the mmc but this is working for me now. 6 | 7 | If you cannot get it booting you will need to 8 | reboot into recovery and check /proc/last_kmsg for the errors. Or try and build 9 | the UART cable (which I failed at) 10 | 11 | ### What's working 12 | 13 | - Wi-Fi 14 | - Bluetooth 15 | - ADB 16 | - USB Reverse Tethering/RNDIS (guest) 17 | - USB OTG (host) 18 | - Framebuffer 19 | - Audio - you need to setup PulseAudio as systemwide. Not sure why it does not work as a normal user. You will also need the alsaucm files from libasound2-data_1.0.27.2-1ubuntu6_all.deb 20 | 21 | ### Bugs/What's not working 22 | 23 | - There is no frambuffer console 24 | - The Software Refresher in the kernel does not work. You will need to run my 25 | refresher app or fix the kernel :) 26 | - The new xa code from x86-video-freedreno-git does not work. gpuaddr in 27 | kgsl_bo_gpuaddr comes back a 0 28 | - Hardware acceleration. Needs LibHybris, we're working on it. 29 | 30 | ### Not tested 31 | 32 | - NFC (if you know how to test it please let @Davideddu know, I have a bunch of NFC tags to test it with. You can tag me in an issue). 33 | 34 | # Setup guides 35 | ## Basic setup and booting with fastboot 36 | 37 | 1. Follow the instuctions at https://github.com/borh/nexus-7-2013-arch-scripts to get a working chroot. 38 | 1. Remove trimslice packages from chroot. 39 | 1. Edit the init script (systemd-initramfs/init) to point to your arch.img. 40 | 1. Build the kernel (instructions below). 41 | 1. Build the initramfs (instructions below). 42 | 1. Edit makebootimage.sh to point to the new kernel and to the initramfs you just built and run it to create an Android boot image. 43 | 1. Use ```fastboot boot ``` to boot the image you just created. 44 | 1. Enjoy ;) 45 | 46 | ## Booting with MultiROM (using an image) 47 | 48 | You will need to follow the guide at http://forum.xda-developers.com/showthread.php?t=2457063 to install MultiROM on your device. 49 | 50 | Also follow the basic guide above to create the chroot, then follow the following steps. 51 | 52 | The init script needs to be modified to support this. You currently can't boot the same boot image via both fastboot and MultiROM. 53 | 54 | 1. Restart adbd as root using ```adb root```; if your ROM doesn't support it, reboot to recovery. 55 | 1. Create a ROM folder for Arch Linux 56 | 57 | ```adb shell mkdir /data/media/0/multirom/roms/``` 58 | 3. Push the provided ```multirom/rom_info.txt``` file. You might want to edit it, it's a plaintext config file documented at https://github.com/Tasssadar/multirom/wiki/Add-support-for-new-ROM-type 59 | 60 | ```adb push multirom/rom_info.txt /data/media/0/multirom/roms//``` 61 | 4. Move your root image to ```/data/media/0/multirom/roms//root.img```` 62 | 5. Edit the init script (systemd-initramfs/init) to point to your new root.img location, then rebuild the initramfs (you don't need to build the boot image for MultiROM). 63 | 6. Make sure you have the kernel zImage in ```/data/media/0/multirom/roms//boot/vmlinuz``` and the initramfs in ```/data/media/0/multirom/roms//boot/initrd.img``` 64 | 7. Mount the image, and copy these files (with the same names) to /boot/ into it. 65 | 66 | ## Booting with MultiROM (directly from /data, no image) 67 | It **is** possible to run the chroot without using an image, and it's even possible to boot it. 68 | 69 | The non-image method has, however, some disadvantages over the image: 70 | 71 | - While using the chroot through Android, some security features such as SELinux (enforces low-level security features), *nosuid* (prevents using sudo), *noexec* (prevents running programs) and *nodev* (prevents devices from being into some mountpoint) need to be disabled on the entire /data partition where the chroot is stored. They are re-enabled on exit, but while it's running they need to be off. I don't think you should worry about this, I just want to make sure you're aware of this behavior. 72 | - There is a bug in my patched chroot script which causes **all** the processes in the chroot to die when **any** of the chroots exits. This happens because the process-killing code in the original script doesn't work outside of an image. I had to replace it with a slower implementation that looks for processes that come from the chroot in /proc and kills them one by one. It's not smart enough to know you're using bash in *that other chroot instance* and that you might need it. To avoid this bug you just have to brutally exit from the chroot (e.g. you close the terminal window); this way the tear-down code will not be executed and the other chroots will keep running. 73 | - You can't use ```df``` to know how much disk space is being taken by the chroot, because this isn't a separate filesystem. You either have to recursively use ```du``` or stay in the mistery. 74 | 75 | Now that you've been warned, you can start installing your chroot. 76 | If you previously followed the image chroot instructions, make sure you delete the old chroot or that you use a different ROM for this chroot. 77 | 78 | 1. Download and use my [patched chroot installation scripts](https://github.com/Davideddu/nexus-7-2013-arch-scripts). Before running them, make sure you edit **both** ```install-arch.sh``` and ```chroot.sh``` and set the ROM name. 79 | 1. Remove trimslice packages from chroot. 80 | 1. Replace the init script ```systemd-initramfs/sbin/init``` with my patched one from ```multirom/init.noimageboot``` and edit it; make sure the ROM name is correct. 81 | 1. Build the initramfs (instructions at the bottom) 82 | 1. Restart adbd as root using ```adb root``` to make it easier to push files; if your ROM doesn't support it, reboot to recovery. 83 | 2. Make sure ```/data/arch``` exists: 84 | 85 | ```mkdir -p /data/arch``` 86 | 6. Make sure you have the kernel zImage in ```/data/media/0/multirom/roms//boot/vmlinuz``` and the initramfs in ```/data/media/0/multirom/roms//boot/initrd.img``` 87 | 7. Also copy these files (with the same names) to /boot/ into the chroot (```/data/media/0/multirom/roms//root/boot/```) 88 | 3. Push the provided ```multirom/rom_info.txt``` file. You might want to edit it, it's a plaintext config file documented at https://github.com/Tasssadar/multirom/wiki/Add-support-for-new-ROM-type. Note that this file doesn't need to be patched, it's the same regardless of how you installed the chroot. 89 | 90 | ```adb push multirom/rom_info.txt /data/media/0/multirom/roms//``` 91 | 92 | Your chroot should now be fully working and bootable, congratulations! ;) 93 | 94 | You should be able to adapt these instructions to boot Arch using fastboot. While it should work out of the box if you simply build the Android boot image and boot it (not tested), you will have to edit ```install-arch.sh```, ```chroot.sh``` and the init script if you want to change the installation directory. Always make sure you have an empty mountpoint in /data/, e.g. ```/data/arch```, otherwise you'll get a kernel panic on boot as ```switch_root``` works only with mountpoints. 95 | 96 | ## Booting from USB with MultiROM (not tested) 97 | You basically have to follow the MultiROM image booting steps, but instead of placing the files into /data/media/0/multirom you will want to put them into a ```multirom``` directory inside of your fat32-formatted USB drive. You will however have to edit the init script, find the USB drive's device (it should be /dev/block/sda1 but don't count on that), mount it and pass the torch to systemd's init. 98 | 99 | This hasn't been tested yet. Detailed instructions will come as soon as I test it. 100 | 101 | ## Getting Wi-Fi working 102 | 103 | A normal Nexus 7 Flo boot will call ```/system/bin/conn_init```, which does a whole lot of verifying your MAC address and then writes out a config with the MAC address in it. Very annoying (especially if you want to spoof it). To get around this you need a copy of the Wi-Fi configs and manually enable the wifi driver since it's not loaded on boot. 104 | 105 | The firmware.service is only needed since the firmware is not loaded in the initramfs. 106 | 107 | 1. Copy ```/system/vendor/firmware``` (android) to ```/usr/lib/firmware``` (arch) (you might want to mount system in the chroot or copy the files to /sdcard, then access them from /media/sdcard in the chroot). 108 | 1. ```rm /usr/lib/firmware/wlan/prima/{WCNSS_qcom_cfg.ini,WCNSS_qcom_wlan_nv.bin}``` ← these are simlinks 109 | 1. ```cp /data/misc/wifi/{WCNSS_qcom_cfg.ini,WCNSS_qcom_wlan_nv.bin} /usr/lib/firmware/wlan/prima/``` ← these are the files which conn_init writes your mac address to - again, use /sdcard or mount /data into the chroot. 110 | 1. Copy the provided ```firmware.service``` to ```/etc/systemd/system/``` 111 | 1. Copy the provided ```firmware.sh``` to ```/usr/local/sbin/``` 112 | 1. Copy the provided ```50-firmware.rules``` to ```/etc/udev/rules.d/``` 113 | 1. ```ln -s /etc/systemd/system/firmware.service /etc/systemd/system/multi-user.target.wants/firmware.service``` 114 | 1. ```ln -s /usr/lib/systemd/system/wpa_supplicant-nl80211@wlan0.service /etc/systemd/system/multi-user.target.wants/wpa_supplicant-nl80211@wlan0.service``` 115 | 1. ```ln -s /lib/systemd/system/dhcpcd.service /etc/systemd/system/multi-user.target.wants/dhcpcd.service``` 116 | 1. ```ln -s /lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service``` 117 | 1. Disable the wpa_supplicant hook in ```/etc/dhcpcd.conf``` by adding ```nohook wpa_supplicant``` at the end. 118 | 119 | ### Setting up shared Wi-Fi configuration between Arch and Android 120 | 121 | 1. Make sure /data is mounted at boot: 122 | 123 | ``` 124 | mkdir /data 125 | echo '/dev/disk/by-partlabel/userdata /data ext4 errors=remount-ro 0 0' >> /etc/fstab 126 | mount /data 127 | ``` 128 | 2. Forcibly symlink the Android wpa_supplicant.conf to the Linux location. 129 | 130 | ``` 131 | ln -fs /data/misc/wifi/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant-nl80211-wlan0.conf 132 | ``` 133 | 1. Create a name for the Android wifi group 134 | 135 | ``` 136 | groupadd -g $(stat -c '%g' /data/misc/wifi) -r android_wifi 137 | ``` 138 | 1. Add your main user to said group, so you can access the control sockets. You will need to manually their path if you want to edit the Wi-Fi network configuration. 139 | 140 | ``` 141 | usermod -aG android_wifi *\* 142 | ``` 143 | 144 | ## Getting fbterm console 145 | 146 | 1. Copy provided ```fbterm/getty@.service``` to ```/etc/systemd/system/``` 147 | 1. Copy ```fbterm/fbterm-login``` to ```/opt/fbterm-login``` and make it executable 148 | 1. ```systemctl enable getty@tty1.service``` 149 | 150 | ```ln -s getty@.service autovt@.service``` to get it on all vt's 151 | 152 | ## Getting Xorg 153 | 154 | Install [xf86-video-freedreno-git](https://aur.archlinux.org/packages/xf86-video-freedreno-git) (AUR). Use the xorg.conf included (xorg directory). 155 | 156 | Instead of filling the AUR with crap you can use the mesa and libdrm PKGBUILDs included in the ```xorg``` directory. Always use the git versions as they have the latest freedreno fixes. 157 | 158 | ## Refreshing (refresher.c) 159 | 160 | Since the ```MSMFB_SW_REFRESHER``` does not seem to be working, I wrote this instead. 161 | Just compile it inside of the chroot (do not crosscompile it on your computer), copy it to ```/bin/refresher``` and make it executable. 162 | 163 | You can use the included systemd unit file for the refresher: 164 | Copy the provided ```systemd/refresher.service``` to ```/etc/systemd/system/refresher.service```. 165 | 166 | ### Step-by-step 167 | 1. Push ```refresher.c``` to your tablet. Actually, if I were you, I'd probably clone the entire ```arch-flo``` repo to the tablet. Android works, don't bother booting Arch yet if you don't want to. 168 | 1. Make sure ```gcc``` is installed. 169 | 1. ```$ gcc -o refresher refresher.c``` 170 | 1. ```# cp refresher /bin/refresher``` 171 | 1. ```# chmod +x /bin/refresher``` 172 | 1. ```# cp path-to/arch-flo/systemd/refresher.service /etc/systemd/system/refresher.service``` 173 | 1. ```# systemctl enable refresher.service``` 174 | 175 | From now on you'll be able to use xinit like you would on your computer, without doing weird stuff. 176 | 177 | ## Serial console 178 | 179 | USB serial works. I had some problems connecting with the Android Composite Gadget, however just using the ```USB_G_SERIAL``` kernel config seems to work (it's enabled by default in the patched kernel). 180 | 181 | To enable it, run 182 | 183 | ``` 184 | systemctl enable serial-getty@ttyGS0.service 185 | ``` 186 | 187 | and then you will be able to connect to the device via minicom or similar on /dev/ttyACM0. 188 | 189 | Getting kernel console boot messages is still a no go as the device is registered too late to work. 190 | 191 | ## Enabling ADB and RNDIS (reverse USB tethering) 192 | 193 | 1. Create this link for ADB to be able to find the shell, etc. 194 | ``` 195 | ln -s / /system 196 | ``` 197 | 1. Add the included systemd-tmpfiles config files. They go in ```/etc/tmpfiles.d```, and require a reboot to apply them. 198 | 199 | ADB shell works, but you will need to set the size ($COLUMNS and $LINES) and terminal type ($TERM) manually. 200 | 201 | To use RNDIS, plug the Nexus into a computer and bridge the virtual ethernet adapter with your local network. Then, bring up the link and get an address as usual. The interface name should be 'usb0'. 202 | 203 | # Kernel 204 | 205 | You can use the kernel from here: https://github.com/crondog/kernel_msm. Use the **mr1** branch. 206 | 207 | ## Building the kernel 208 | 209 | A guide to build kernels for Nexus devices can be obtained from Google: http://source.android.com/source/building-kernels.html 210 | 211 | Just make sure you use the patched fork provided above instead of the default repository, or that you apply the patches below, otherwise you will likely have issues. 212 | 213 | ## Getting touchscreen working 214 | 215 | Apply provided ```0001-make-ektf3k-driver-report-non-MT-events-too.patch```. 216 | 217 | ## Kernel configuration 218 | I used the following additional configs to get this working. Some might not be 219 | necessary but it helps with debugging 220 | 221 | *Required for display/graphics:* 222 | 223 | - CONFIG_FB_MSM_DEFAULT_DEPTH_BGRA8888 (with RGBA patch from robclark) 224 | - CONFIG_DRM=y 225 | - CONFIG_MSM_KGSL_DRM=y 226 | 227 | *Required for Wi-Fi/network:* 228 | 229 | - CONFIG_ANDROID_PARANOID_NETWORK=n 230 | - CONFIG_MODULES=y 231 | - CONFIG_PRIMA_WLAN=y 232 | - CONFIG_WCNSS_CORE=y 233 | 234 | *Required for USB serial:* 235 | 236 | - CONFIG_USB_G_SERIAL=y 237 | 238 | *Required to boot:* 239 | 240 | - CONFIG_FHANDLE=y 241 | - CONFIG_DEVTMPFS=y 242 | - CONFIG_UTS_NS=y 243 | - CONFIG_IPC_NS=y 244 | - CONFIG_USER_NS=y 245 | - CONFIG_PID_NS=y 246 | - CONFIG_NET_NS=y 247 | - CONFIG_DEVPTS_MULTIPLE_INSTANCES=y 248 | - CONFIG_FANOTIFY=y 249 | - CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y 250 | - CONFIG_SECURITY_SELINUX_BOOTPARAM=y 251 | 252 | *Debugging:* 253 | 254 | - CONFIG_DETECT_HUNG_TASK=y 255 | - CONFIG_DEBUG_SPINLOCK=y 256 | - CONFIG_DEBUG_MUTEXES=y 257 | - CONFIG_DEBUG_ATOMIC_SLEEP=y 258 | - CONFIG_STACKTRACE=y 259 | - CONFIG_DEBUG_BUGVERBOSE=y 260 | - CONFIG_LOG_BUF_SHIFT=21 261 | - CONFIG_PANIC_TIMEOUT=0 262 | 263 | If you use the kernel at https://github.com/crondog/kernel_msm (mr1 branch), there is a default configuration named flo_defconfig which contains most of the needed options. 264 | 265 | # Building the initramfs 266 | ## Manually 267 | 268 | Make sure *abootimg* is installed. 269 | 270 | 1. Edit makebootimage.sh and correct paths 271 | 1. *cd systemd-initramfs; find . | cpio -o -H newc | gzip > ../minimal.initramfs* 272 | 1. *./makebootimage.sh* 273 | 274 | 275 | ## Using mkinitcpio 276 | 1. Copy ```zImage``` to ```/boot``` 277 | 1. Copy modules to ```/lib/modules/`uname -r```` 278 | 1. Apply ```mkinitcpio.patch``` 279 | 1. Copy ```hooks/imgmount``` and ```install/imgmount``` to ```/lib/initcpio``` 280 | 1. ```sudo mkinitcpio -p linux``` 281 | 1. ```abootimg --create boot.img -f bootimg.cfg -k /boot/zImage -r /boot/initramfs-linux.img``` 282 | 283 | --------------------------------------------------------------------------------