forked from SolidHal/PrawnOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
13 changed files
with
6,964 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
devuan-jessie-c201-libre-*GB.img | ||
linux-* | ||
open-ath9k-htc-firmware | ||
debian-stretch-c201-libre-*GB.img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "chromeos-3.14"] | ||
path = chromeos-3.14 | ||
url = https://chromium.googlesource.com/chromiumos/third_party/kernel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
APT::Install-Recommends "false"; | ||
APT::AutoRemove::RecommendsImportant "false"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Dima Krasner ([email protected]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/sh -xe | ||
|
||
# Build fs, image | ||
|
||
|
||
KVER=4.9.30 | ||
|
||
outmnt=$(mktemp -d -p `pwd`) | ||
inmnt=$(mktemp -d -p `pwd`) | ||
|
||
outdev=/dev/loop6 | ||
indev=/dev/loop7 | ||
|
||
#A hacky way to ensure the loops are properly unmounted and the temp files are properly deleted. | ||
#Without this, a reboot is required to properly clean the loop devices and ensure a clean build | ||
cleanuptwice() { | ||
cleanup | ||
cleanup | ||
|
||
} | ||
|
||
cleanup() { | ||
set +e | ||
|
||
umount -l $inmnt > /dev/null 2>&1 | ||
rmdir $inmnt > /dev/null 2>&1 | ||
losetup -d $indev > /dev/null 2>&1 | ||
|
||
umount -l $outmnt > /dev/null 2>&1 | ||
rmdir $outmnt > /dev/null 2>&1 | ||
losetup -d $outdev > /dev/null 2>&1 | ||
} | ||
|
||
trap cleanuptwice INT TERM EXIT | ||
|
||
|
||
create_image() { | ||
# it's a sparse file - that's how we fit a 16GB image inside a 2GB one | ||
dd if=/dev/zero of=$1 bs=$3 count=$4 conv=sparse | ||
parted --script $1 mklabel gpt | ||
cgpt create $1 | ||
cgpt add -i 1 -t kernel -b 8192 -s 65536 -l Kernel -S 1 -T 5 -P 10 $1 | ||
start=$((8192 + 65536)) | ||
end=`cgpt show $1 | grep 'Sec GPT table' | awk '{print $1}'` | ||
size=$(($end - $start)) | ||
cgpt add -i 2 -t data -b $start -s $size -l Root $1 | ||
# $size is in 512 byte blocks while ext4 uses a block size of 1024 bytes | ||
losetup -P $2 $1 | ||
mkfs.ext4 -F -b 1024 -m 0 -O ^has_journal ${2}p2 $(($size / 2)) | ||
|
||
# mount the / partition | ||
mount -o noatime ${2}p2 $5 | ||
} | ||
|
||
# create a 2GB image with the Chrome OS partition layout | ||
create_image debian-stretch-c201-libre-2GB.img $outdev 50M 40 $outmnt | ||
|
||
# INCLUDES=apt-utils,libc6,libdebconfclient0,awk,libz2-1.0,libblzma5,libselinux1,tar,libtinfo5,zlib1g,udev,kmod,net-tools,traceroute,iproute2,isc-dhcp-client,wpasupplicant,iw,alsa-utils,cgpt,vim-tiny,less,psmisc,netcat-openbsd,ca-certificates,bzip2,xz-utils,unscd,lightdm,lightdm-gtk-greeter,xfce4,xorg,ifupdown,nano,wicd,wicd-curses | ||
|
||
# install Debian on it | ||
qemu-debootstrap --arch=armhf --foreign stretch --variant minbase --include=systemd,systemd-sysv,dbus $outmnt http://deb.debian.org/debian | ||
chroot $outmnt passwd -d root | ||
#echo -n debsus > $outmnt/etc/hostname | ||
#install -D -m 644 80disable-recommends $outmnt/etc/apt/apt.conf.d/80disable-recommends | ||
cp -f /etc/resolv.conf $outmnt/etc/ | ||
chroot $outmnt apt update | ||
chroot $outmnt apt install -y udev kmod net-tools inetutils-ping traceroute iproute2 isc-dhcp-client wpasupplicant iw alsa-utils cgpt vim-tiny less psmisc netcat-openbsd ca-certificates bzip2 xz-utils unscd ifupdown nano apt-utils python python-urwid | ||
chroot $outmnt apt-get autoremove --purge | ||
chroot $outmnt apt-get clean | ||
chroot $outmnt apt-get install -d -y wicd-daemon wicd wicd-curses | ||
#sed -i s/^[3-6]/\#\&/g $outmnt/etc/inittab | ||
#sed -i s/'enable-cache hosts no'/'enable-cache hosts yes'/ -i $outmnt/etc/nscd.conf | ||
rm -f $outmnt/etc/resolv.conf | ||
|
||
# put the kernel in the kernel partition, modules in /lib/modules and AR9271 | ||
# firmware in /lib/firmware | ||
dd if=linux-$KVER/vmlinux.kpart of=${outdev}p1 conv=notrunc | ||
make -C linux-$KVER ARCH=arm INSTALL_MOD_PATH=$outmnt modules_install | ||
rm -f $outmnt/lib/modules/3.14.0/{build,source} | ||
install -D -m 644 open-ath9k-htc-firmware/target_firmware/htc_9271.fw $outmnt/lib/firmware/htc_9271.fw | ||
|
||
# create a 16GB image | ||
create_image debian-stretch-c201-libre-16GB.img $indev 512 30785536 $inmnt | ||
|
||
# copy the kernel and / of the 2GB image to the 16GB one | ||
dd if=${outdev}p1 of=${indev}p1 conv=notrunc | ||
cp -a $outmnt/* $inmnt/ | ||
|
||
umount -l $inmnt | ||
rmdir $inmnt | ||
losetup -d $indev | ||
|
||
# move the 16GB image inside the 2GB one | ||
cp -f debian-stretch-c201-libre-16GB.img $outmnt/ | ||
echo "DONE!" | ||
cleanup | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh -xe | ||
|
||
#Build kenerl, wifi firmware | ||
|
||
|
||
KVER=4.9.30 | ||
|
||
# build Linux-libre, with ath9k_htc, dwc2 from Chrome OS and without many useless drivers | ||
[ ! -f linux-libre-$KVER-gnu.tar.lz ] && wget https://www.linux-libre.fsfla.org/pub/linux-libre/releases/$KVER-gnu/linux-libre-$KVER-gnu.tar.lz | ||
[ ! -d linux-$KVER ] && tar --lzip -xvf linux-libre-$KVER-gnu.tar.lz | ||
cd linux-$KVER | ||
make clean | ||
make mrproper | ||
rm -rf drivers/usb/dwc2 | ||
ln -s ../../../chromeos-3.14/drivers/usb/dwc2 drivers/usb/ | ||
patch -p 1 < ../chromeos-dwc2-glue.patch | ||
# reset the minor version number, so out-of-tree drivers continue to work after | ||
# a kernel upgrade | ||
sed s/'SUBLEVEL = .*'/'SUBLEVEL = 0'/ -i Makefile | ||
cp ../config .config | ||
make -j `grep ^processor /proc/cpuinfo | wc -l` CROSS_COMPILE=arm-none-eabi- ARCH=arm zImage modules dtbs | ||
[ ! -h kernel.its ] && ln -s ../kernel.its . | ||
mkimage -D "-I dts -O dtb -p 2048" -f kernel.its vmlinux.uimg | ||
dd if=/dev/zero of=bootloader.bin bs=512 count=1 | ||
vbutil_kernel --pack vmlinux.kpart \ | ||
--version 1 \ | ||
--vmlinuz vmlinux.uimg \ | ||
--arch arm \ | ||
--keyblock /usr/share/vboot/devkeys/kernel.keyblock \ | ||
--signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \ | ||
--config ../cmdline \ | ||
--bootloader bootloader.bin | ||
cd .. | ||
|
||
# build AR9271 firmware | ||
[ ! -d open-ath9k-htc-firmware ] && git clone --depth 1 https://github.com/qca/open-ath9k-htc-firmware.git | ||
cd open-ath9k-htc-firmware | ||
make toolchain | ||
make -C target_firmware | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
diff -rup linux-4.9.95-orig/arch/arm/boot/dts/rk3288.dtsi linux-4.9.95/arch/arm/boot/dts/rk3288.dtsi | ||
--- linux-4.9.95-orig/arch/arm/boot/dts/rk3288.dtsi 2018-04-20 09:21:08.000000000 +0300 | ||
+++ linux-4.9.95/arch/arm/boot/dts/rk3288.dtsi 2018-04-21 17:56:26.360024274 +0300 | ||
@@ -582,6 +582,9 @@ | ||
dr_mode = "host"; | ||
phys = <&usbphy2>; | ||
phy-names = "usb2-phy"; | ||
+ resets = <&cru SRST_USBHOST1_PHY>; | ||
+ reset-names = "phy-full-reset"; | ||
+ snps,need-phy-full-reset-on-wake; | ||
status = "disabled"; | ||
}; | ||
|
||
diff -rup linux-4.9.95-orig/arch/arm/boot/dts/rk3288-veyron.dtsi linux-4.9.95/arch/arm/boot/dts/rk3288-veyron.dtsi | ||
--- linux-4.9.95-orig/arch/arm/boot/dts/rk3288-veyron.dtsi 2018-04-20 09:21:08.000000000 +0300 | ||
+++ linux-4.9.95/arch/arm/boot/dts/rk3288-veyron.dtsi 2018-04-21 17:47:25.796011427 +0300 | ||
@@ -429,6 +429,7 @@ | ||
|
||
&usb_host1 { | ||
status = "okay"; | ||
+ snps,need-phy-for-wake; | ||
}; | ||
|
||
&usb_otg { | ||
@@ -437,6 +438,7 @@ | ||
assigned-clocks = <&cru SCLK_USBPHY480M_SRC>; | ||
assigned-clock-parents = <&usbphy0>; | ||
dr_mode = "host"; | ||
+ snps,need-phy-for-wake; | ||
}; | ||
|
||
&vopb { | ||
diff -rup linux-4.9.95-orig/drivers/base/dd.c linux-4.9.95/drivers/base/dd.c | ||
--- linux-4.9.95-orig/drivers/base/dd.c 2018-04-20 09:21:08.000000000 +0300 | ||
+++ linux-4.9.95/drivers/base/dd.c 2018-04-21 13:01:30.280037034 +0300 | ||
@@ -523,6 +523,9 @@ int driver_probe_device(struct device_dr | ||
|
||
bool driver_allows_async_probing(struct device_driver *drv) | ||
{ | ||
+ if (drv->async_probe) | ||
+ return true; | ||
+ | ||
switch (drv->probe_type) { | ||
case PROBE_PREFER_ASYNCHRONOUS: | ||
return true; | ||
diff -rup linux-4.9.95-orig/drivers/usb/common/common.c linux-4.9.95/drivers/usb/common/common.c | ||
--- linux-4.9.95-orig/drivers/usb/common/common.c 2018-04-20 09:21:08.000000000 +0300 | ||
+++ linux-4.9.95/drivers/usb/common/common.c 2018-04-21 13:36:51.184087441 +0300 | ||
@@ -105,6 +105,30 @@ static const char *const usb_dr_modes[] | ||
[USB_DR_MODE_OTG] = "otg", | ||
}; | ||
|
||
+/** | ||
+ * of_usb_get_dr_mode - Get dual role mode for given device_node | ||
+ * @np: Pointer to the given device_node | ||
+ * | ||
+ * The function gets phy interface string from property 'dr_mode', | ||
+ * and returns the correspondig enum usb_dr_mode | ||
+ */ | ||
+enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) | ||
+{ | ||
+ const char *dr_mode; | ||
+ int err, i; | ||
+ | ||
+ err = of_property_read_string(np, "dr_mode", &dr_mode); | ||
+ if (err < 0) | ||
+ return USB_DR_MODE_UNKNOWN; | ||
+ | ||
+ for (i = 0; i < ARRAY_SIZE(usb_dr_modes); i++) | ||
+ if (!strcmp(dr_mode, usb_dr_modes[i])) | ||
+ return i; | ||
+ | ||
+ return USB_DR_MODE_UNKNOWN; | ||
+} | ||
+EXPORT_SYMBOL_GPL(of_usb_get_dr_mode); | ||
+ | ||
static enum usb_dr_mode usb_get_dr_mode_from_string(const char *str) | ||
{ | ||
int ret; | ||
diff -rup linux-4.9.95-orig/drivers/usb/core/hub.c linux-4.9.95/drivers/usb/core/hub.c | ||
--- linux-4.9.95-orig/drivers/usb/core/hub.c 2018-04-20 09:21:08.000000000 +0300 | ||
+++ linux-4.9.95/drivers/usb/core/hub.c 2018-04-21 17:58:20.456026986 +0300 | ||
@@ -3063,13 +3063,14 @@ static int usb_disable_remote_wakeup(str | ||
} | ||
|
||
/* Count of wakeup-enabled devices at or below udev */ | ||
-static unsigned wakeup_enabled_descendants(struct usb_device *udev) | ||
+unsigned usb_wakeup_enabled_descendants(struct usb_device *udev) | ||
{ | ||
struct usb_hub *hub = usb_hub_to_struct_hub(udev); | ||
|
||
return udev->do_remote_wakeup + | ||
(hub ? hub->wakeup_enabled_descendants : 0); | ||
} | ||
+EXPORT_SYMBOL_GPL(usb_wakeup_enabled_descendants); | ||
|
||
/* | ||
* usb_port_suspend - suspend a usb device's upstream port | ||
@@ -3178,7 +3179,7 @@ int usb_port_suspend(struct usb_device * | ||
* Therefore we will turn on the suspend feature if udev or any of its | ||
* descendants is enabled for remote wakeup. | ||
*/ | ||
- else if (PMSG_IS_AUTO(msg) || wakeup_enabled_descendants(udev) > 0) | ||
+ else if (PMSG_IS_AUTO(msg) || usb_wakeup_enabled_descendants(udev) > 0) | ||
status = set_port_feature(hub->hdev, port1, | ||
USB_PORT_FEAT_SUSPEND); | ||
else { | ||
@@ -3581,7 +3582,7 @@ static int hub_suspend(struct usb_interf | ||
} | ||
if (udev) | ||
hub->wakeup_enabled_descendants += | ||
- wakeup_enabled_descendants(udev); | ||
+ usb_wakeup_enabled_descendants(udev); | ||
} | ||
|
||
if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) { | ||
diff -rup linux-4.9.95-orig/include/linux/device.h linux-4.9.95/include/linux/device.h | ||
--- linux-4.9.95-orig/include/linux/device.h 2018-04-20 09:21:08.000000000 +0300 | ||
+++ linux-4.9.95/include/linux/device.h 2018-04-21 13:06:59.172044851 +0300 | ||
@@ -270,6 +270,7 @@ struct device_driver { | ||
|
||
bool suppress_bind_attrs; /* disables bind/unbind via sysfs */ | ||
enum probe_type probe_type; | ||
+ bool async_probe; | ||
|
||
const struct of_device_id *of_match_table; | ||
const struct acpi_device_id *acpi_match_table; | ||
diff -rup linux-4.9.95-orig/include/linux/of.h linux-4.9.95/include/linux/of.h | ||
--- linux-4.9.95-orig/include/linux/of.h 2018-04-20 09:21:08.000000000 +0300 | ||
+++ linux-4.9.95/include/linux/of.h 2018-04-21 18:03:18.492034069 +0300 | ||
@@ -521,6 +521,8 @@ const char *of_prop_next_string(struct p | ||
|
||
bool of_console_check(struct device_node *dn, char *name, int index); | ||
|
||
+enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); | ||
+ | ||
#else /* CONFIG_OF */ | ||
|
||
static inline void of_core_init(void) | ||
diff -rup linux-4.9.95-orig/include/linux/usb/hcd.h linux-4.9.95/include/linux/usb/hcd.h | ||
--- linux-4.9.95-orig/include/linux/usb/hcd.h 2018-04-20 09:21:08.000000000 +0300 | ||
+++ linux-4.9.95/include/linux/usb/hcd.h 2018-04-21 18:02:33.620033003 +0300 | ||
@@ -640,6 +640,7 @@ extern wait_queue_head_t usb_kill_urb_qu | ||
#define usb_endpoint_out(ep_dir) (!((ep_dir) & USB_DIR_IN)) | ||
|
||
#ifdef CONFIG_PM | ||
+extern unsigned usb_wakeup_enabled_descendants(struct usb_device *udev); | ||
extern void usb_root_hub_lost_power(struct usb_device *rhdev); | ||
extern int hcd_bus_suspend(struct usb_device *rhdev, pm_message_t msg); | ||
extern int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console=tty1 init=/sbin/init root=PARTUUID=%U/PARTNROFF=1 rootfstype=ext4 rootwait rw |
Oops, something went wrong.