From d0403b14e3c28c8c2e3d4e4052b5dd6b61aea879 Mon Sep 17 00:00:00 2001 From: SolidHal Date: Wed, 5 Sep 2018 18:35:33 -0500 Subject: [PATCH] Cleaned up image creation, made functional installation scripts Cleaned up build files, resources, scripts. Made the image use a partition map to fix mmc issues Signed-off-by: SolidHal --- .gitignore | 5 +- README.md | 26 ++++---- TODO.txt | 13 ---- blank_kernel | Bin 65535 -> 0 bytes buildLibrean.sh => buildPrawnOS.sh | 6 +- .../BuildResources/80disable-recommends | 0 cmdline => resources/BuildResources/cmdline | 0 config => resources/BuildResources/config | 0 .../BuildResources/kernel.its | 0 ...Add-the-appropriate-clock-references.patch | 0 .../patches-tested}/chromeos-dwc2-glue.patch | 0 ...-efi-Add-support-for-IGNOREME-GPT-si.patch | 0 ...D-partition-with-gpt-command-line-op.patch | 0 ...rockchip-dwc2-usb-partial-power-down.patch | 0 ...-ARM-DTSI-rk3288-Missing-GRF-handles.patch | 0 ...DTSI-rk3288-Add-missing-SPI2-pinctrl.patch | 0 ...3288-Adding-cells-addresses-and-size.patch | 0 ...3288-Adding-missing-EDP-power-domain.patch | 0 ...rk3288-Adding-missing-VOPB-registers.patch | 0 ...-rk3288-Fixed-the-SPDIF-node-address.patch | 0 ...-DTSI-rk3288-Define-the-VPU-services.patch | 0 ...veyron-Enable-the-Video-encoding-MMU.patch | 0 ...288-prefer-vdpu-for-vcodec-clock-sou.patch | 0 ...rs-drm-rockchip-Enable-IRQ-on-unbind.patch | 0 ...he-dependency-to-the-clk_mali-symbol.patch | 0 ...hip-power-domain-export-idle-request.patch | 0 .../BuildResources/sources.list | 0 .../InstallResources}/50-synaptics.conf | 0 .../InstallResources}/default.pa | 0 .../InstallResources}/default.sh | 0 .../InstallResources}/headphone-acpi-toggle | 0 resources/InstallResources/mmc.partmap | 9 +++ .../InstallResources}/sound.sh | 0 .../InstallScripts/InstallPackages.sh | 18 +++--- scripts/InstallScripts/InstallToInternal.sh | 27 ++++++++ scripts/InstallScripts/InstallToUSB.sh | 5 ++ scripts/InstallScripts/runonce.sh | 46 ++++++++++++++ buildDebianFs.sh => scripts/buildDebianFs.sh | 58 ++++++------------ buildKernel.sh => scripts/buildKernel.sh | 25 +++++--- .../buildNewKernelIntoFS.sh | 0 .../crossmenuconfig.sh | 0 41 files changed, 149 insertions(+), 89 deletions(-) delete mode 100644 TODO.txt delete mode 100644 blank_kernel rename buildLibrean.sh => buildPrawnOS.sh (51%) mode change 100644 => 100755 rename 80disable-recommends => resources/BuildResources/80disable-recommends (100%) rename cmdline => resources/BuildResources/cmdline (100%) rename config => resources/BuildResources/config (100%) rename kernel.its => resources/BuildResources/kernel.its (100%) rename {patches-tested => resources/BuildResources/patches-tested}/DTS/0025-ARM-DTSI-rk3288-Add-the-appropriate-clock-references.patch (100%) rename {patches-tested => resources/BuildResources/patches-tested}/chromeos-dwc2-glue.patch (100%) rename {patches-tested => resources/BuildResources/patches-tested}/kernel/0001-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch (100%) rename {patches-tested => resources/BuildResources/patches-tested}/kernel/0002-Do-not-force-GUID-partition-with-gpt-command-line-op.patch (100%) rename {patches-tested => resources/BuildResources/patches-tested}/kernel/rockchip-dwc2-usb-partial-power-down.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/DTS/0006-ARM-DTSI-rk3288-Missing-GRF-handles.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/DTS/0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/DTS/0009-ARM-DTSI-rk3288-Adding-cells-addresses-and-size.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/DTS/0010-ARM-DTSI-rk3288-Adding-missing-EDP-power-domain.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/DTS/0011-ARM-DTSI-rk3288-Adding-missing-VOPB-registers.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/DTS/0012-ARM-DTSI-rk3288-Fixed-the-SPDIF-node-address.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/DTS/for_video/0020-ARM-DTSI-rk3288-Define-the-VPU-services.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/DTS/for_video/0024-ARM-DTSI-rk3288-veyron-Enable-the-Video-encoding-MMU.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/kernel/0003-clk-rockchip-rk3288-prefer-vdpu-for-vcodec-clock-sou.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/kernel/0007-drivers-drm-rockchip-Enable-IRQ-on-unbind.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/kernel/for_video/0004-Remove-the-dependency-to-the-clk_mali-symbol.patch (100%) rename {patches-untested => resources/BuildResources/patches-untested}/kernel/for_video/0006-soc-rockchip-power-domain-export-idle-request.patch (100%) rename sources.list => resources/BuildResources/sources.list (100%) rename {os_configs => resources/InstallResources}/50-synaptics.conf (100%) rename {os_configs => resources/InstallResources}/default.pa (100%) rename {os_configs => resources/InstallResources}/default.sh (100%) rename {os_configs => resources/InstallResources}/headphone-acpi-toggle (100%) create mode 100644 resources/InstallResources/mmc.partmap rename {os_configs => resources/InstallResources}/sound.sh (100%) rename Install.sh => scripts/InstallScripts/InstallPackages.sh (62%) mode change 100644 => 100755 create mode 100755 scripts/InstallScripts/InstallToInternal.sh create mode 100644 scripts/InstallScripts/InstallToUSB.sh create mode 100755 scripts/InstallScripts/runonce.sh rename buildDebianFs.sh => scripts/buildDebianFs.sh (65%) rename buildKernel.sh => scripts/buildKernel.sh (62%) rename buildNewKernelIntoFS.sh => scripts/buildNewKernelIntoFS.sh (100%) rename crossmenuconfig.sh => scripts/crossmenuconfig.sh (100%) diff --git a/.gitignore b/.gitignore index 84dd89f..c436d91 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -devuan-jessie-c201-libre-*GB.img linux-* open-ath9k-htc-firmware -debian-stretch-c201-libre-*GB.img -librean-stretch-c201-libre-*GB.img - +PrawnOS-Alpha-c201-libre-2GB.img diff --git a/README.md b/README.md index f6e5c2a..19fd1d1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Librean +# PrawnOS A build system for making blobless debian and mainline kernel for the Asus c201 Chromebook @@ -8,15 +8,15 @@ No blobs, anywhere. Support for Aetheros AR271 usb wifi dongles through the open source firmware Minimal toolset intended as a based, including tools to setup a wifi connection Sources from only main, not contrib or non-free which keeps Debian libre -TODO: basic graphical desktop like xfce +Currently PrawnOS supports lxqt, with plans to include xfce as an option in the future ### why -Combined with libreboot,an AR271 wifi dongle, and a libre OS (like Debian, the one built by this) the asus c201 is a fully libre machine with no blobs, or microcode. +Combined with libreboot, an AR271 wifi dongle, and a libre OS (like Debian, the one built by this) the asus c201 is a fully libre machine with no blobs, or microcode. ### Dependencies -Librean has been tested on Debian 9 Stretch (in a vm) +Building PrawnOS has been tested on Debian 9 Stretch (in a vm) These packages are required: ``` @@ -26,7 +26,7 @@ These packages are required: u-boot-tools \ gcc make libc-dev wget g++ cmake \ binfmt-support qemu-user-static debootstrap \ - lzip libssl-dev libncurses-dev flex bison + lzip libssl-dev libncurses-dev flex bison sudo patch ``` ### Build @@ -36,22 +36,20 @@ Run the kernel one then the fs one. ### Install Write the 2GB image to a flash drive, which contains the full 15GB (acutally 14.7GB) to write to the internal storage. We can do this since the 15GB image is a sparse file. ``` -sudo dd if=debian-stretch-c201-libre-2GB.img of=/dev/$USB_DEVICE bs=50M +sudo dd if=PrawnOs-Alpha-c201-libre-2GB.img of=/dev/$USB_DEVICE bs=50M ``` Now on the C201, login as root. The password is blank. Write the 15GB image to the internal storage For me this was /dev/mmcblk2 but it may be /dev/mmcblk1 for you depending on what device it assigns to sdcards -``` -dd if=/debian-stretch-c201-libre-2GB.img of=/dev/$DEVICE bs=50M -``` +WIP -Reboot. Run /Install.sh which will install xfce, wicd, and some device configurations. This will reboot one last time when done. +Reboot. Run /Install.sh which will install lxqt, wicd, and some device configurations. This will reboot one last time when done. ``` /Install.sh ``` -You should now be greeted by the xfce login screen. +You should now be greeted by a login screen. If you just want a basic enviroment without xfce upu can skip running Install.sh but I recommend installing wicd-curses for wifi configuration. @@ -69,15 +67,15 @@ Check out the instructions here: https://github.com/SolidHal/AsusC201-usb-wifi-f ### Troubleshooting -The pulse audio mixer will only run if you are logged in as a non root account. This is an issue (feature?) of pulse audio +The pulse audio mixer will only run if you are logged in as a non-root account. This is an issue (feature?) of pulse audio ### Credits and Legal Information -Thanks to dimkr for his great devsus scripts, from which Librean took much inspiration +Thanks to dimkr for his great devsus scripts, from which PrawnOS took much inspiration https://github.com/dimkr/devsus Because of this started as a fork of devsus, much of this repos history can be found at https://github.com/SolidHal/devsus/tree/hybrid_debian -Librean is free and unencumbered software released under the terms of the GNU +PrawnOS is free and unencumbered software released under the terms of the GNU General Public License, version 2; see COPYING for the license text. For a list of its authors and contributors, see AUTHORS. diff --git a/TODO.txt b/TODO.txt deleted file mode 100644 index 7e29fe2..0000000 --- a/TODO.txt +++ /dev/null @@ -1,13 +0,0 @@ -Investigate CONFIG_DRM_PANEL_LVDS vs CONFIG_DRM_PANEL_SIMPLE - -CONFIG_DRM_DW_HDMI_I2S_AUDIO vs CONFIG_DRM_DW_HDMI_AHB_AUDIO - - CONFIG_IIO_CROS_EC_SENSORS_CORE vs CONFIG_IIO_CROS_EC_ACCEL_LEGACY -(probably the first??) -tried the first, didn't change anything obvious. Further testing required. - -Enable boot logo? Device Drivers->Graphics support->Bootup logo - - -Added: -better sound support? HDMI support? diff --git a/blank_kernel b/blank_kernel deleted file mode 100644 index 5dfddf075bed03499414ae453f0d6f30fe79da3d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 65535 zcmeIufdBvi0Dz$VsTV1P3IhfV7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd z0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwA zz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEj zFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r z3>YwAz<>b*1`HT5V8DO@0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@ t0|pEjFkrxd0RsjM7%*VKfB^#r3>YwAz<>b*1`HT5V8DO@0|pEjFwg)F00961 diff --git a/buildLibrean.sh b/buildPrawnOS.sh old mode 100644 new mode 100755 similarity index 51% rename from buildLibrean.sh rename to buildPrawnOS.sh index 0c042f5..64839ec --- a/buildLibrean.sh +++ b/buildPrawnOS.sh @@ -5,6 +5,8 @@ #Get sudo sudo echo "Thanks." #Build kernel WITHOUT SUDO, building the kernel with sudo is bad practice -./buildKernel.sh +#Once, sometime in the kernel version 2 days building the kernel with sudo broke the +#The system it was built on +#./scripts/buildKernel.sh #build os WITH sudo, debootstrap requires sudo -sudo ./buildDebian.sh +sudo ./scripts/buildDebianFs.sh diff --git a/80disable-recommends b/resources/BuildResources/80disable-recommends similarity index 100% rename from 80disable-recommends rename to resources/BuildResources/80disable-recommends diff --git a/cmdline b/resources/BuildResources/cmdline similarity index 100% rename from cmdline rename to resources/BuildResources/cmdline diff --git a/config b/resources/BuildResources/config similarity index 100% rename from config rename to resources/BuildResources/config diff --git a/kernel.its b/resources/BuildResources/kernel.its similarity index 100% rename from kernel.its rename to resources/BuildResources/kernel.its diff --git a/patches-tested/DTS/0025-ARM-DTSI-rk3288-Add-the-appropriate-clock-references.patch b/resources/BuildResources/patches-tested/DTS/0025-ARM-DTSI-rk3288-Add-the-appropriate-clock-references.patch similarity index 100% rename from patches-tested/DTS/0025-ARM-DTSI-rk3288-Add-the-appropriate-clock-references.patch rename to resources/BuildResources/patches-tested/DTS/0025-ARM-DTSI-rk3288-Add-the-appropriate-clock-references.patch diff --git a/patches-tested/chromeos-dwc2-glue.patch b/resources/BuildResources/patches-tested/chromeos-dwc2-glue.patch similarity index 100% rename from patches-tested/chromeos-dwc2-glue.patch rename to resources/BuildResources/patches-tested/chromeos-dwc2-glue.patch diff --git a/patches-tested/kernel/0001-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch b/resources/BuildResources/patches-tested/kernel/0001-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch similarity index 100% rename from patches-tested/kernel/0001-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch rename to resources/BuildResources/patches-tested/kernel/0001-block-partitions-efi-Add-support-for-IGNOREME-GPT-si.patch diff --git a/patches-tested/kernel/0002-Do-not-force-GUID-partition-with-gpt-command-line-op.patch b/resources/BuildResources/patches-tested/kernel/0002-Do-not-force-GUID-partition-with-gpt-command-line-op.patch similarity index 100% rename from patches-tested/kernel/0002-Do-not-force-GUID-partition-with-gpt-command-line-op.patch rename to resources/BuildResources/patches-tested/kernel/0002-Do-not-force-GUID-partition-with-gpt-command-line-op.patch diff --git a/patches-tested/kernel/rockchip-dwc2-usb-partial-power-down.patch b/resources/BuildResources/patches-tested/kernel/rockchip-dwc2-usb-partial-power-down.patch similarity index 100% rename from patches-tested/kernel/rockchip-dwc2-usb-partial-power-down.patch rename to resources/BuildResources/patches-tested/kernel/rockchip-dwc2-usb-partial-power-down.patch diff --git a/patches-untested/DTS/0006-ARM-DTSI-rk3288-Missing-GRF-handles.patch b/resources/BuildResources/patches-untested/DTS/0006-ARM-DTSI-rk3288-Missing-GRF-handles.patch similarity index 100% rename from patches-untested/DTS/0006-ARM-DTSI-rk3288-Missing-GRF-handles.patch rename to resources/BuildResources/patches-untested/DTS/0006-ARM-DTSI-rk3288-Missing-GRF-handles.patch diff --git a/patches-untested/DTS/0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch b/resources/BuildResources/patches-untested/DTS/0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch similarity index 100% rename from patches-untested/DTS/0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch rename to resources/BuildResources/patches-untested/DTS/0007-RK3288-DTSI-rk3288-Add-missing-SPI2-pinctrl.patch diff --git a/patches-untested/DTS/0009-ARM-DTSI-rk3288-Adding-cells-addresses-and-size.patch b/resources/BuildResources/patches-untested/DTS/0009-ARM-DTSI-rk3288-Adding-cells-addresses-and-size.patch similarity index 100% rename from patches-untested/DTS/0009-ARM-DTSI-rk3288-Adding-cells-addresses-and-size.patch rename to resources/BuildResources/patches-untested/DTS/0009-ARM-DTSI-rk3288-Adding-cells-addresses-and-size.patch diff --git a/patches-untested/DTS/0010-ARM-DTSI-rk3288-Adding-missing-EDP-power-domain.patch b/resources/BuildResources/patches-untested/DTS/0010-ARM-DTSI-rk3288-Adding-missing-EDP-power-domain.patch similarity index 100% rename from patches-untested/DTS/0010-ARM-DTSI-rk3288-Adding-missing-EDP-power-domain.patch rename to resources/BuildResources/patches-untested/DTS/0010-ARM-DTSI-rk3288-Adding-missing-EDP-power-domain.patch diff --git a/patches-untested/DTS/0011-ARM-DTSI-rk3288-Adding-missing-VOPB-registers.patch b/resources/BuildResources/patches-untested/DTS/0011-ARM-DTSI-rk3288-Adding-missing-VOPB-registers.patch similarity index 100% rename from patches-untested/DTS/0011-ARM-DTSI-rk3288-Adding-missing-VOPB-registers.patch rename to resources/BuildResources/patches-untested/DTS/0011-ARM-DTSI-rk3288-Adding-missing-VOPB-registers.patch diff --git a/patches-untested/DTS/0012-ARM-DTSI-rk3288-Fixed-the-SPDIF-node-address.patch b/resources/BuildResources/patches-untested/DTS/0012-ARM-DTSI-rk3288-Fixed-the-SPDIF-node-address.patch similarity index 100% rename from patches-untested/DTS/0012-ARM-DTSI-rk3288-Fixed-the-SPDIF-node-address.patch rename to resources/BuildResources/patches-untested/DTS/0012-ARM-DTSI-rk3288-Fixed-the-SPDIF-node-address.patch diff --git a/patches-untested/DTS/for_video/0020-ARM-DTSI-rk3288-Define-the-VPU-services.patch b/resources/BuildResources/patches-untested/DTS/for_video/0020-ARM-DTSI-rk3288-Define-the-VPU-services.patch similarity index 100% rename from patches-untested/DTS/for_video/0020-ARM-DTSI-rk3288-Define-the-VPU-services.patch rename to resources/BuildResources/patches-untested/DTS/for_video/0020-ARM-DTSI-rk3288-Define-the-VPU-services.patch diff --git a/patches-untested/DTS/for_video/0024-ARM-DTSI-rk3288-veyron-Enable-the-Video-encoding-MMU.patch b/resources/BuildResources/patches-untested/DTS/for_video/0024-ARM-DTSI-rk3288-veyron-Enable-the-Video-encoding-MMU.patch similarity index 100% rename from patches-untested/DTS/for_video/0024-ARM-DTSI-rk3288-veyron-Enable-the-Video-encoding-MMU.patch rename to resources/BuildResources/patches-untested/DTS/for_video/0024-ARM-DTSI-rk3288-veyron-Enable-the-Video-encoding-MMU.patch diff --git a/patches-untested/kernel/0003-clk-rockchip-rk3288-prefer-vdpu-for-vcodec-clock-sou.patch b/resources/BuildResources/patches-untested/kernel/0003-clk-rockchip-rk3288-prefer-vdpu-for-vcodec-clock-sou.patch similarity index 100% rename from patches-untested/kernel/0003-clk-rockchip-rk3288-prefer-vdpu-for-vcodec-clock-sou.patch rename to resources/BuildResources/patches-untested/kernel/0003-clk-rockchip-rk3288-prefer-vdpu-for-vcodec-clock-sou.patch diff --git a/patches-untested/kernel/0007-drivers-drm-rockchip-Enable-IRQ-on-unbind.patch b/resources/BuildResources/patches-untested/kernel/0007-drivers-drm-rockchip-Enable-IRQ-on-unbind.patch similarity index 100% rename from patches-untested/kernel/0007-drivers-drm-rockchip-Enable-IRQ-on-unbind.patch rename to resources/BuildResources/patches-untested/kernel/0007-drivers-drm-rockchip-Enable-IRQ-on-unbind.patch diff --git a/patches-untested/kernel/for_video/0004-Remove-the-dependency-to-the-clk_mali-symbol.patch b/resources/BuildResources/patches-untested/kernel/for_video/0004-Remove-the-dependency-to-the-clk_mali-symbol.patch similarity index 100% rename from patches-untested/kernel/for_video/0004-Remove-the-dependency-to-the-clk_mali-symbol.patch rename to resources/BuildResources/patches-untested/kernel/for_video/0004-Remove-the-dependency-to-the-clk_mali-symbol.patch diff --git a/patches-untested/kernel/for_video/0006-soc-rockchip-power-domain-export-idle-request.patch b/resources/BuildResources/patches-untested/kernel/for_video/0006-soc-rockchip-power-domain-export-idle-request.patch similarity index 100% rename from patches-untested/kernel/for_video/0006-soc-rockchip-power-domain-export-idle-request.patch rename to resources/BuildResources/patches-untested/kernel/for_video/0006-soc-rockchip-power-domain-export-idle-request.patch diff --git a/sources.list b/resources/BuildResources/sources.list similarity index 100% rename from sources.list rename to resources/BuildResources/sources.list diff --git a/os_configs/50-synaptics.conf b/resources/InstallResources/50-synaptics.conf similarity index 100% rename from os_configs/50-synaptics.conf rename to resources/InstallResources/50-synaptics.conf diff --git a/os_configs/default.pa b/resources/InstallResources/default.pa similarity index 100% rename from os_configs/default.pa rename to resources/InstallResources/default.pa diff --git a/os_configs/default.sh b/resources/InstallResources/default.sh similarity index 100% rename from os_configs/default.sh rename to resources/InstallResources/default.sh diff --git a/os_configs/headphone-acpi-toggle b/resources/InstallResources/headphone-acpi-toggle similarity index 100% rename from os_configs/headphone-acpi-toggle rename to resources/InstallResources/headphone-acpi-toggle diff --git a/resources/InstallResources/mmc.partmap b/resources/InstallResources/mmc.partmap new file mode 100644 index 0000000..28c33de --- /dev/null +++ b/resources/InstallResources/mmc.partmap @@ -0,0 +1,9 @@ +label: gpt +label-id: EBA5A923-2F33-7C4E-AC9A-1555FD600D19 +device: /dev/mmcblk2 +unit: sectors +first-lba: 34 +last-lba: 30785502 + +/dev/mmcblk2p1 : start= 20480, size= 65536, type=FE3A2A5D-4F32-41A7-B725-ACCC3285A309, uuid=89B31CDB-1147-5241-8271-C1ADBB9BBB44, name="Kernel", attrs="GUID:49,51,52,54,56" +/dev/mmcblk2p2 : start= 86016, size= 30699486, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=63DB8E49-63C4-984E-90A0-8AC3222C4771, name="Root" diff --git a/os_configs/sound.sh b/resources/InstallResources/sound.sh similarity index 100% rename from os_configs/sound.sh rename to resources/InstallResources/sound.sh diff --git a/Install.sh b/scripts/InstallScripts/InstallPackages.sh old mode 100644 new mode 100755 similarity index 62% rename from Install.sh rename to scripts/InstallScripts/InstallPackages.sh index c910abf..0282b50 --- a/Install.sh +++ b/scripts/InstallScripts/InstallPackages.sh @@ -1,19 +1,23 @@ #!/bin/sh -xe -#Setup locales +DIR=/InstallResources + +#Setup locales, crda apt install -y locales -#Install xfce, wicd +dpkg-reconfigure locale +apt install -y crda +locale-gen +#Install lxqt, wicd apt install -y xorg acpi-support lightdm tasksel dpkg librsvg2-common xorg xserver-xorg-input-libinput alsa-utils anacron avahi-daemon eject iw libnss-mdns xdg-utils lxqt wicd-daemon wicd wicd-curses wicd-gtk xserver-xorg-input-synaptics #Copy in acpi, pulse audio, trackpad settings, funtion key settings -cp -rf /os_configs/default.pa /etc/pulse/default.pa +cp -rf $DIR/default.pa /etc/pulse/default.pa mkdir /etc/acpi -cp -rf /os_configs/sound.sh /etc/acpi/sound.sh +cp -rf $DIR/sound.sh /etc/acpi/sound.sh mkdir /etc/acpi/events -cp -rf /os_configs/headphone-acpi-toggle /etc/acpi/events/headphone-acpi-toggle +cp -rf $DIR/headphone-acpi-toggle /etc/acpi/events/headphone-acpi-toggle mkdir /etc/X11/xorg.conf.d/ -cp -rf /os_configs/50-synaptics.conf /etc/X11/xorg.conf.d/ +cp -rf $DIR/50-synaptics.conf /etc/X11/xorg.conf.d/ -locale-gen echo " Enter new username: " read username diff --git a/scripts/InstallScripts/InstallToInternal.sh b/scripts/InstallScripts/InstallToInternal.sh new file mode 100755 index 0000000..1499e2c --- /dev/null +++ b/scripts/InstallScripts/InstallToInternal.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +#Install PrawnOS to the internal emmc, this will partition the internal emmc +#and erase ALL data on it + + +RESOURCES=/InstallResources + +read -p "This will ERASE ALL DATA ON THE INTERNAL STORAGE (EMMC) and reboot when finished, do you want to continue? [Y/n]" -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]] +then + echo Writing partition map + sfdisk /dev/mmcblk2 < $RESOURCES/mmc.partmap + echo Writing kernel partition + dd if=/dev/sda1 of=/dev/mmcblk2p1 + echo Writing Filesystem, this will take a moment... + #Set the post install script to run after reboot + ./$RESOURCES/runonce.sh $RESOURCES/InstallPackages.sh + dd if=/dev/sda2 of=/dev/mmcblk2p2 bs=50M + echo Expanding Filesystem + e2fsck -p /dev/mmcblk2p2 + resize2fs /dev/mmcblk2p2 + echo Rebooting... Please remove the usb drive once shutdown is complete +fi + +echo Exiting diff --git a/scripts/InstallScripts/InstallToUSB.sh b/scripts/InstallScripts/InstallToUSB.sh new file mode 100644 index 0000000..34f335b --- /dev/null +++ b/scripts/InstallScripts/InstallToUSB.sh @@ -0,0 +1,5 @@ + +#!/bin/bash + +#Install PrawnOS to an external device, the first usb by default + diff --git a/scripts/InstallScripts/runonce.sh b/scripts/InstallScripts/runonce.sh new file mode 100755 index 0000000..dfc72f7 --- /dev/null +++ b/scripts/InstallScripts/runonce.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +if [[ $# -eq 0 ]]; then + echo "Schedules a command to be run after the next reboot." + echo "Usage: $(basename $0) " + echo " $(basename $0) -p " + echo " $(basename $0) -r " +else + REMOVE=0 + COMMAND=${!#} + SCRIPTPATH=$PATH + + while getopts ":r:p:" optionName; do + case "$optionName" in + r) REMOVE=1; COMMAND=$OPTARG;; + p) SCRIPTPATH=$OPTARG;; + esac + done + + SCRIPT="${HOME}/.$(basename $0)_$(echo $COMMAND | sed 's/[^a-zA-Z0-9_]/_/g')" + + if [[ ! -f $SCRIPT ]]; then + echo "PATH=$SCRIPTPATH" >> $SCRIPT + echo "cd $(pwd)" >> $SCRIPT + echo "logger -t $(basename $0) -p local3.info \"COMMAND=$COMMAND ; USER=\$(whoami) ($(logname)) ; PWD=$(pwd) ; PATH=\$PATH\"" >> $SCRIPT + echo "$COMMAND | logger -t $(basename $0) -p local3.info" >> $SCRIPT + echo "$0 -r \"$(echo $COMMAND | sed 's/\"/\\\"/g')\"" >> $SCRIPT + chmod +x $SCRIPT + fi + + CRONTAB="${HOME}/.$(basename $0)_temp_crontab_$RANDOM" + ENTRY="@reboot $SCRIPT" + + echo "$(crontab -l 2>/dev/null)" | grep -v "$ENTRY" | grep -v "^# DO NOT EDIT THIS FILE - edit the master and reinstall.$" | grep -v "^# ([^ ]* installed on [^)]*)$" | grep -v "^# (Cron version [^$]*\$[^$]*\$)$" > $CRONTAB + + if [[ $REMOVE -eq 0 ]]; then + echo "$ENTRY" >> $CRONTAB + fi + + crontab $CRONTAB + rm $CRONTAB + + if [[ $REMOVE -ne 0 ]]; then + rm $SCRIPT + fi +fi diff --git a/buildDebianFs.sh b/scripts/buildDebianFs.sh similarity index 65% rename from buildDebianFs.sh rename to scripts/buildDebianFs.sh index b76855a..80381b9 100755 --- a/buildDebianFs.sh +++ b/scripts/buildDebianFs.sh @@ -6,37 +6,31 @@ KVER=4.17.2 #Ensure Sudo -if [[ $UID != 0 ]]; then - echo "Please run this script with sudo:" +if [ ! $UID = "0" ] +then + echo "Please run this script with sudo, or as root:" echo "sudo $0 $*" exit 1 fi outmnt=$(mktemp -d -p `pwd`) -inmnt=$(mktemp -d -p `pwd`) outdev=/dev/loop4 -indev=/dev/loop5 + +install_resources=resources/InstallResources +build_resources=resources/BuildResources #A hacky way to ensure the loops are properly unmounted and the temp files are properly deleted. #Without this, a reboot is sometimes required to properly clean the loop devices and ensure a clean build 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 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 @@ -64,7 +58,7 @@ create_image() { } # create a 2GB image with the Chrome OS partition layout -create_image librean-stretch-c201-libre-2GB.img $outdev 50M 40 $outmnt +create_image PrawnOS-Alpha-c201-libre-2GB.img $outdev 50M 40 $outmnt # install Debian on it export LC_ALL="en_US.UTF-8" #Change this as necessary if not US @@ -73,18 +67,18 @@ qemu-debootstrap --arch armhf stretch --include locales,init $outmnt http://deb. chroot $outmnt passwd -d root #Place the config files and installer script and give them the proper permissions -echo -n librean > $outmnt/etc/hostname -cp -R os_configs/ $outmnt/os_configs/ -cp Install.sh $outmnt/Install.sh -chmod +x $outmnt/os_configs/sound.sh -chmod +x $outmnt/Install.sh +echo -n PrawnOS-Alpha > $outmnt/etc/hostname +cp -R $install_resources/ $outmnt/InstallResources/ +cp scripts/InstallScripts/* $outmnt/InstallResources/ +cp scripts/InstallScripts/InstallToInternal.sh $outmnt/ +chmod +x $outmnt/*.sh -#install -D -m 644 80disable-recommends $outmnt/etc/apt/apt.conf.d/80disable-recommends #This should fix the issue of crda being installed but unconfigured causing regulatory.db firmware loading errors in dmesg +install -D -m 644 $build_resources/80disable-recommends $outmnt/etc/apt/apt.conf.d/80disable-recommends #This should fix the issue of crda being installed but unconfigured causing regulatory.db firmware loading errors in dmesg #Setup the chroot for apt #This is what https://wiki.debian.org/EmDebian/CrossDebootstrap suggests cp /etc/hosts $outmnt/etc/ -cp sources.list $outmount/etc/apt/sources.list +cp $build_resources/sources.list $outmount/etc/apt/sources.list #Setup the locale cp /etc/locale.gen $outmnt/etc/ @@ -98,33 +92,19 @@ chroot $outmnt apt-get autoremove --purge chroot $outmnt apt-get clean #Download the packages to be installed by Install.sh: TODO: potentially dpkg-reconfigure locales? -chroot $outmnt apt-get install -y -d xorg acpi-support lightdm tasksel dpkg librsvg2-common xorg xserver-xorg-input-libinput alsa-utils anacron avahi-daemon eject iw libnss-mdns xdg-utils lxqt wicd-daemon wicd wicd-curses wicd-gtk xserver-xorg-input-synaptics +chroot $outmnt apt-get install -y -d xorg acpi-support lightdm tasksel dpkg librsvg2-common xorg xserver-xorg-input-libinput alsa-utils anacron avahi-daemon eject iw libnss-mdns xdg-utils lxqt wicd-daemon wicd wicd-curses wicd-gtk xserver-xorg-input-synaptics crda #Cleanup hosts rm -rf $outmnt/etc/hosts #This is what https://wiki.debian.org/EmDebian/CrossDebootstrap suggests -echo -n "127.0.0.1 librean" > $outmnt/etc/hosts +echo -n "127.0.0.1 PrawnOS-Alpha" > $outmnt/etc/hosts # 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 +dd if=build/linux-$KVER/vmlinux.kpart of=${outdev}p1 conv=notrunc +make -C build/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/ath9k_htc/htc_9271-1.4.0.fw +install -D -m 644 build/open-ath9k-htc-firmware/target_firmware/htc_9271.fw $outmnt/lib/firmware/ath9k_htc/htc_9271-1.4.0.fw -# create a 15GB image -create_image librean-stretch-c201-libre-15GB.img $indev 512 30777343 $inmnt - -# copy the kernel and / of the 2GB image to the 15GB one -dd if=${outdev}p1 of=${indev}p1 conv=notrunc -cp -a $outmnt/* $inmnt/ - -#Cleanup the 15GB image -umount -l $inmnt -rmdir $inmnt -losetup -d $indev - -# move the 15GB image inside the 2GB one -cp -f librean-stretch-c201-libre-15GB.img $outmnt/ echo "DONE!" cleanup diff --git a/buildKernel.sh b/scripts/buildKernel.sh similarity index 62% rename from buildKernel.sh rename to scripts/buildKernel.sh index 501eddf..2afcc3e 100755 --- a/buildKernel.sh +++ b/scripts/buildKernel.sh @@ -6,6 +6,10 @@ KVER=4.17.2 TEST_PATCHES=false +ROOT_DIR=`pwd` +RESOURCES=$ROOT_DIR/resources/BuildResources + +cd build # 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 && FRESH=true @@ -13,18 +17,18 @@ cd linux-$KVER make clean make mrproper #Apply the usb and mmc patches if unapplied -[ "$FRESH" = true ] && for i in ../patches-tested/*.patch; do patch -p1 < $i; done -[ "$FRESH" = true ] && for i in ../patches-tested/DTS/*.patch; do patch -p1 < $i; done -[ "$FRESH" = true ] && for i in ../patches-tested/kernel/*.patch; do patch -p1 < $i; done +[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/*.patch; do patch -p1 < $i; done +[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/DTS/*.patch; do patch -p1 < $i; done +[ "$FRESH" = true ] && for i in $RESOURCES/patches-tested/kernel/*.patch; do patch -p1 < $i; done #Apply all of the rockMyy patches that make sense -[ "$TEST_PATCHES" = true ] && for i in ../patches-untested/kernel/*.patch; do patch -p1 < $i; done -[ "$TEST_PATCHES" = true ] && for i in ../patches-untested/DTS/*.patch; do patch -p1 < $i; done +[ "$TEST_PATCHES" = true ] && for i in $RESOURCES/patches-untested/kernel/*.patch; do patch -p1 < $i; done +[ "$TEST_PATCHES" = true ] && for i in $RESOURCES/patches-untested/DTS/*.patch; do patch -p1 < $i; done # 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 +# a kernel upgrade **TODO - is this needed? +# sed s/'SUBLEVEL = .*'/'SUBLEVEL = 0'/ -i Makefile +cp $RESOURCES/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 . +[ ! -h kernel.its ] && ln -s $RESOURCES/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 \ @@ -33,7 +37,7 @@ vbutil_kernel --pack vmlinux.kpart \ --arch arm \ --keyblock /usr/share/vboot/devkeys/kernel.keyblock \ --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk \ - --config ../cmdline \ + --config $RESOURCES/cmdline \ --bootloader bootloader.bin cd .. @@ -44,3 +48,4 @@ cd open-ath9k-htc-firmware make toolchain make -C target_firmware cd .. +cd $ROOT_DIR diff --git a/buildNewKernelIntoFS.sh b/scripts/buildNewKernelIntoFS.sh similarity index 100% rename from buildNewKernelIntoFS.sh rename to scripts/buildNewKernelIntoFS.sh diff --git a/crossmenuconfig.sh b/scripts/crossmenuconfig.sh similarity index 100% rename from crossmenuconfig.sh rename to scripts/crossmenuconfig.sh