Initial commit

This commit is contained in:
crondog 2014-02-18 23:22:50 +11:00 committed by crondog
commit ebf1078b43
7 changed files with 259 additions and 0 deletions

View File

@ -0,0 +1,50 @@
From ad8725fb07407deb688813e075b05e790dac2878 Mon Sep 17 00:00:00 2001
From: Seth Forshee <seth.forshee@canonical.com>
Date: Tue, 18 Feb 2014 23:07:22 +1100
Subject: [PATCH] make ektf3k driver report non-MT events too
Change-Id: Ia4f05b33f06d7a8fc74e65330f9c41df8a8ba7a9
---
drivers/input/touchscreen/ektf3k.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/input/touchscreen/ektf3k.c b/drivers/input/touchscreen/ektf3k.c
index 4b6a7e7..28fee64 100755
--- a/drivers/input/touchscreen/ektf3k.c
+++ b/drivers/input/touchscreen/ektf3k.c
@@ -967,6 +967,7 @@ static void elan_ktf3k_ts_report_data(struct i2c_client *client, uint8_t *buf)
fbits = fbits >> 1;
idx += 3;
}
+ input_mt_report_pointer_emulation(ts->input_dev, true);
input_sync(idev);
} // checksum
else {
@@ -1017,6 +1018,7 @@ static void elan_ktf3k_ts_report_data2(struct i2c_client *client, uint8_t *buf)
fbits = fbits >> 1;
idx += 3;
}
+ input_mt_report_pointer_emulation(ts->input_dev, true);
input_sync(idev);
} // checksum
else {
@@ -1542,11 +1544,15 @@ static int elan_ktf3k_ts_probe(struct i2c_client *client,
}
ts->input_dev->name = "elan-touchscreen";
- //set_bit(BTN_TOUCH, ts->input_dev->keybit);
+ set_bit(BTN_TOUCH, ts->input_dev->keybit);
ts->abs_x_max = pdata->abs_x_max;
ts->abs_y_max = pdata->abs_y_max;
touch_debug(DEBUG_INFO, "[Elan] Max X=%d, Max Y=%d\n", ts->abs_x_max, ts->abs_y_max);
+ input_set_abs_params(ts->input_dev, ABS_X, pdata->abs_y_min, pdata->abs_y_max, 0, 0); // for 800 * 1280
+ input_set_abs_params(ts->input_dev, ABS_Y, pdata->abs_x_min, pdata->abs_x_max, 0, 0); // for 800 * 1280
+ input_set_abs_params(ts->input_dev, ABS_PRESSURE, 0, MAX_FINGER_PRESSURE, 0, 0);
+
input_mt_init_slots(ts->input_dev, FINGER_NUM);
input_set_abs_params(ts->input_dev, ABS_MT_POSITION_X, pdata->abs_y_min, pdata->abs_y_max, 0, 0); // for 800 * 1280
input_set_abs_params(ts->input_dev, ABS_MT_POSITION_Y, pdata->abs_x_min, pdata->abs_x_max, 0, 0);// for 800 * 1280
--
1.8.5.3

107
README Normal file
View File

@ -0,0 +1,107 @@
# Arch Linux on Nexus 7 Flo Native
Here are my instructions on getting Arch Linux ARM natively booting on the
Nexus 7 Flo. Ideally this would be booting from a usb stick or a dedicated
partition on the mmc but this is working for me now. Once I get a bluetooth
keyboard I will try to get it working from a usb stick.
## BUGS!!!
There is no frambuffer console :(
If you cannot get it booting you will need to
reboot into recovery and check /proc/last_kmsg for the errors. Or try and build
the UART cable (which I failed at)
There is only xf86-video-fbdev working and no DRM or anything fancy
The Software Refresher in the kernel does not work. You will need to run my
refresher app or fix the kernel :)
1: I roughly followed the instructions form
https://github.com/borh/nexus-7-2013-arch-scripts to get a working chroot
first.
2: Edit the init script to point to your arch.img or partition
3: Edit and Run makebootimage.sh
4: fastboot boot newboot
5: ???
6: Profit
## To get WiFi Working
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. To get around this you need a copy of the wifi
configs and manually enable the wifi driver since it does not start on boot.
The firmware.service is only needed since I do not load the firmware in the
initramfs (which I am haven't done yet)
1: Copy /system/vendor/firmware [android] to /usr/lib/firmware [arch]
2: rm /usr/lib/firmware/wlan/prima/{WCNSS_qcom_cfg.ini,WCNSS_qcom_wlan_nv.bin} <-- these are simlinks
3: 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
4: Copy firmware.service to /etc/systemd/system/
5: ln -s /etc/systemd/system/firmware.service /etc/systemd/system/multi-user.target.wants/firmware.service
6: Create a wpa_supplicant-nl80211@wlan0.service with your wpa_supplicant.conf
details
7: ln -s /etc/systemd/system/dhcpcd.service /etc/systemd/system/multi-user.target.wants/dhcpcd.service
8: ln -s /etc/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service
NOTE: The wifi drivers are really flakey. You might have better luck with a
static ip. If anything fails reboot into recovery and check /proc/last_kmsg
## To get X working
Since there is no framebuffer console you cannot start X manually (unless you
are able to get ssh working, see above) Auto login is your friend.
Be sure to install a window manager or something first and then follow
https://wiki.archlinux.org/index.php/Automatic_login_to_virtual_console and
https://wiki.archlinux.org/index.php/Start_X_at_Login
Your .xinitrc should contain something like
~/refresher &
exec awesome
## Refreshing (refresher.c)
Since the MSMFB_SW_REFRESHER does not seem to be working i wrote this instead.
Just compile and put in you ~/ or whereever so xinit can run it.
# Kernel stuff
## To get Touchscreen working
Apply 0001-make-ektf3k-driver-report-non-MT-events-too.patch
## Kernel configs
I used the following additional configs to get this working. Some might not be
necessary but it helps with debugging
I havent figured out how to get fbdev working with RGBA8888 so use RGB565 for
now
CONFIG_FB_MSM_DEFAULT_DEPTH_RGB565=y
CONFIG_FHANDLE=y
CONFIG_DEVTMPFS=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
CONFIG_FANOTIFY=y
CONFIG_FANOTIFY_ACCESS_PERMISSIONS=y
CONFIG_DETECT_HUNG_TASK=y
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_ATOMIC_SLEEP=y
CONFIG_STACKTRACE=y
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
## Build initramfs
1: Edit makebootimage.sh with paths
2: cd systemd-initramfs; find . | cpio -o -H newc | gzip > ../minimal.initramfs
3: ./makebootimage.sh

6
makebootimage.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
KERNEL=~/android/system/out/target/product/flo/kernel
INITRAMFS=minimal.initramfs
~/android/system/out/host/linux-x86/bin/mkbootimg --kernel $KERNEL --cmdline "console=ttyHSL0,115200,n8 console=tty1 androidboot.hardware=flo user_debug=31 msm_rtb.filter=0x3F ehci-hcd.park=3 selinux=0" --base 0x80200000 --pagesize 2048 --ramdisk_offset 0x02000000 --ramdisk $INITRAMFS --output newboot

65
refresher.c Normal file
View File

@ -0,0 +1,65 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <getopt.h>
#include <time.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <linux/fb.h>
struct fb_info{
int fd;
void *ptr;
struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;
};
void fb_getinfo(struct fb_info *fb_info){
printf("fb res %dx%d virtual %dx%d, line_len %d\n",
fb_info->var.xres, fb_info->var.yres,
fb_info->var.xres_virtual, fb_info->var.yres_virtual,
fb_info->fix.line_length);
printf("dim %dmm x %dmm\n", fb_info->var.width, fb_info->var.height);
printf("xoffset %d yoffset %d\n", fb_info->var.xoffset, fb_info->var.yoffset);
}
int fb_open(struct fb_info *fb_info){
int fd = open("/dev/fb0", O_RDWR);
if(fd < 0){
printf("Failed to open fb\n");
return 1;
}
fb_info->fd = fd;
return 0;
}
void flip_buffer(struct fb_info *fb_info, int n){
if( ioctl(fb_info->fd, FBIOPAN_DISPLAY, &fb_info->var) < 0 ){
printf("Failed FBIOPAN_DISPLAY\n");
}
}
int main(int argc, char *argv[]){
setpriority(PRIO_PROCESS, 0, -20);
struct fb_info fb_info;
fb_open(&fb_info);
while(1){
flip_buffer(&fb_info,0);
usleep(16666);
}
return 0;
}

1
systemd-initramfs/init Symbolic link
View File

@ -0,0 +1 @@
sbin/init

BIN
systemd-initramfs/sbin/busybox1 Executable file

Binary file not shown.

30
systemd-initramfs/sbin/init Executable file
View File

@ -0,0 +1,30 @@
#!/sbin/busybox1 sh
_PATH="$PATH"
export BB=/sbin/busybox1
cd /
$BB mount -t devtmpfs devtmpfs /dev -o mode=0755,nosuid
$BB mkdir /dev/pts
$BB mkdir /dev/socket
$BB mount -t proc proc /proc -o nosuid,noexec,nodev
$BB mount -t sysfs sys /sys -o nosuid,noexec,nodev
$BB mdev -s
$BB mount -t ext4 /dev/mmcblk0p30 /data
$BB mknod /dev/loop256 b 7 256
$BB losetup /dev/loop256 /data/arch.img
$BB mount -t ext4 -o rw,noatime /dev/loop256 /data/arch
$BB mkdir /cache
$BB mount -t ext4 /dev/mmcblk0p23 /cache
export PATH="${_PATH}"
#exec /sbin/init2
exec /sbin/busybox1 switch_root /data/arch /sbin/init