Update readme, remove old scripts, fix install script

This commit is contained in:
Hal Emmerich 2019-10-20 16:53:13 -05:00
parent 1aec88b67b
commit 843edfd525
5 changed files with 61 additions and 262 deletions

124
README.md
View File

@ -72,55 +72,87 @@ sudo dd if=PrawnOs-*-c201-libre-2GB*.img of=/dev/$USB_DEVICE bs=50M; sync
There are two ways to use PrawnOS. There are two ways to use PrawnOS.
The first option is to boot from the external USB or SD device you wrote the image to. The first option is to boot from the external USB or SD device you wrote the image to, and expand the image to take up the entire boot device.
[click here](#install-to-usb-drive-or-sd-card) [click here](#expand-prawnos)
* Booting from an external device allows you to try PrawnOS without removing Chrome OS or whatever Linux you are running on your internal storage (emmc), but it is a much slower experience as the c201 only has USB 2.0. * Expanding the PrawnOS image allows you to boot PrawnOS from the same USB or SD device that you wrote the image to
* Expansion does _NOT_ support root encryption. For root encryption the filesystem must be written after the encrypted root is created.
The second and, recommended, option is to install it on your internal storage (emmc) The second and recommended option is to install it on a device other than the one you wrote the PrawnOS image to
[click here](#install-to-internal-drive-emmc) [click here](#install-to-internal-drive-emmc-or-to-sd-card-or-usb-drive)
* This is faster, and frees up a USB port. * This lets you install PrawnOS to the internal emmc, an SD card or a USB device
* This allows you to setup root encryption
* Installing to an external device allows you to try PrawnOS without removing Chrome OS or whatever Linux you are running on your internal storage (emmc), but USB drives especially are a much slower experience as the c201 only has USB 2.0.
* If you want to boot from external media, I would suggest using an SD card.
### Install to Internal drive (emmc) ### Install to internal drive (emmc) or to SD card or USB drive
Now on the C201, press `control+u` at boot to boot from the USB drive. Now on the C201, insert the drive you wrote the PrawnOS image to. Press `control+u` at boot to boot from the external drive.
If you are running stock coreboot and haven't flashed Libreboot, you will first have to enable developer mode and enable USB / external device booting. A quick search should get you some good guides, but if you're having issues feel free to open an issue here on github.
If you are running stock coreboot and haven't flashed Libreboot, you will first have to enable developer mode and enable USB booting. A quick search should get you some good guides, but if you're having issues feel free to open an issue here on github.
At the prompt, login as root. The password is blank. At the prompt, login as root. The password is blank.
WARNING! THIS WILL ERASE YOUR INTERNAL EMMC STORAGE (your Chrome OS install or other Linux install and all of the associated user data) Make sure to back up any data you would like to keep before running this. Now insert the other USB device or SD card you would like to install PrawnOS on. If you want to boot from the internal emmc, you have nothing to insert!
Note: If you are installing to an external device, the filesystem portion may take a loooong time (20 minutes). This is because we are reading from one external device (the boot device) and writing to another external device. This more than saturates the USB and/or SD bus.
If you would like to install it to the internal emmc storage run: WARNING! THIS WILL ERASE YOUR INTERNAL EMMC STORAGE (your Chrome OS install or other Linux install and all of the associated user data) OR WHATEVER EXTERNAL DEVICE YOU CHOOSE AS YOUR INSTALL TARGET. Make sure to back up any data you would like to keep before running this.
Run:
``` ```
cd / cd /
./InstallToInternal.sh ./InstallPrawnOS.sh
``` ```
_This will show a bunch of scary red warnings that are a result of the emmc (internal storage) being touchy and the kernel message level being set low for debugging. They don't seem to effect anything long-term._ Choose `Install` and follow the prompts. This will ask what device you want to install to and setup root encryption with a custom initramfs and dmcrypt/LUKS if you want.
#### Setting up root partition encryption
PrawnOS supports encrypting the full root partition with the use of a custom initramfs and dmcrypt/LUKS
Type "Yes" at the prompt, then enter the password you would like to use and verify it
You will then be prompted one more time to enter your encryption password to mount and setup the filesystem
If you are curious how the initramfs, and root partition encryption work on PrawnOS check out the Initramfs and Encryption section in [DOCUMENTATION.md](DOCUMENTATION.md) If you are curious how the initramfs, and root partition encryption work on PrawnOS check out the Initramfs and Encryption section in [DOCUMENTATION.md](DOCUMENTATION.md)
If you run in to any problems please open an issue.
_If you install to the internal emmc this will show a bunch of scary red warnings that are a result of the emmc (internal storage) having a few unwritable (bad) blocks at the beginning of the device and the kernel message level being set low for debugging. They don't effect anything long-term. All C201s have these bad blocks at the beginning of the emmc_
The device will then reboot. If you are running the stock coreboot, you will have to press `control+d` or wait 30 seconds past the beep to boot to the internal storage. After reboot, remove the external media you had booted from originally. If you installed to the internal emmc press `control+d`, if you installed to an external device press `control+u`
If you are running Libreboot, it should boot to the internal storage by default. If it doesn't, turn off the device and remove the flash drive before turning it on again. If you press nothing, it will boot to the internal storage by default.
Now login as root again and run: Now to install the packages, desktop environment, and setup a user
Login as root again and run:
``` ```
cd /InstallResources cd /InstallResources
./InstallPackages.sh ./InstallPackages.sh
``` ```
Which installs either the xfce4 or the lxqt desktop enviroment, sound, trackpad, and Xorg configurations as well as prompts you to make a new user that automatically gets sudo privileges. Which installs either the xfce4 or the lxqt desktop enviroment, sound, trackpad, and Xorg configurations as well as prompts you to make a new user that automatically gets sudo privileges.
If it asks you about terminal encoding and/or locale, just hit enter. The default works for both.
When finished, it will reboot once again placing you at a login screen. When finished, it will reboot once again placing you at a login screen.
Congratulations! Your computer is now a Prawn! https://sprorgnsm.bandcamp.com/track/the-prawn-song Congratulations! Your computer is now a Prawn! https://sprorgnsm.bandcamp.com/track/the-prawn-song
### Expand PrawnOS
Now on the C201, insert the drive you wrote the PrawnOS image to. Press `control+u` at boot to boot from the external drive.
If you are running stock coreboot and haven't flashed Libreboot, you will first have to enable developer mode and enable USB / external device booting. A quick search should get you some good guides, but if you're having issues feel free to open an issue here on github.
At the prompt, login as root. The password is blank.
Run:
```
cd /
./InstallPrawnOS.sh
```
Choose `Expand` at the prompt
If you run in to any problems please open an issue.
Now to install the packages, desktop environment, and setup a user
```
cd /InstallResources
./InstallPackages.sh
```
Which installs either the xfce4 or the lxqt desktop enviroment, sound, trackpad, and Xorg configurations as well as prompts you to make a new user that automatically gets sudo privileges.
When finished, it will reboot.
Press `control+u` at boot once again, and you'll get to a login screen.
Congratulations! Your computer is now a Prawn! https://sprorgnsm.bandcamp.com/track/the-prawn-song
#### If you simply want a basic Linux environment with no desktop environment or window manager:
Skip running `InstallPackages`
Congratulations: you are done! Welcome to PrawnOS. You should probably change the root password and make a user, but I'm not your boss or anything so I'll leave that to you.
#### Connecting to WiFi in a basic environment #### Connecting to WiFi in a basic environment
If you just want a basic environment without xfce or lxqt can skip running InstallPackages.sh. You can connect to WiFi using wpa_supplicant by running the following commands: If you just want a basic environment without xfce or lxqt can skip running InstallPackages.sh. You can connect to WiFi using wpa_supplicant by running the following commands:
``` ```
@ -132,49 +164,11 @@ Login as root, and run
``` ```
dhclient wlan0 dhclient wlan0
``` ```
When that finishes, you should have access to the internet. When that finishes, you should have access to the internet.
### Install To USB drive or SD card
Now on the C201, press `control+u` at boot to boot from the USB drive.
If you are running stock coreboot and haven't flashed Libreboot, you will first have to enable developer mode and enable USB booting. A quick search should get you some good guides, but if you're having issues feel free to open an issue here on github.
When it boots, login as root. The password is blank.
#### If you simply want a basic Linux environment with no desktop environment or window manager:
Make sure it's the only storage device plugged in, and run this script to expand the partition and filesystem to the full USB drive. This will reboot when complete, so you'll have to press `control+u` again to boot to the external media.
```
cd /InstallResources/
./ExpandExternalInstall.sh
```
Congratulations: you are done! Welcome to PrawnOS. You should probably change the root password and make a user, but I'm not your boss or anything so I'll leave that to you.
If you want a quick guide on how to connect to WiFi, check out [this down below](#connecting-to-wifi-in-a-basic-environment)
#### For everyone else, two scripts need to be run.
The first expands the partition and filesystem to use the entire drive.
Make sure you only have one USB or SD storage device plugged into the machine.
This will reboot when complete, so you'll have to press `control+u` again to boot to the external media.
Run:
```
cd /InstallResources/
./ExpandExternalInstall.sh
```
You can verify it worked by running `df -h` after the reboot. The original `/dev/root/` filesystem was only ~2GB
Then run this script which installs either the xfce4 or the lxqt desktop enviroment, sound, trackpad, and Xorg configurations as well as prompts you to make a new user that automatically gets sudo privileges.
If it asks you about terminal encoding and/or locale, just hit enter. The default works for both.
When finished, it will reboot once again placing you at a login screen.
```
./InstallPackages.sh
```
This will take a while; USB 2.0 is slow.
Welcome to PrawnOS. If you like it, I would suggest installing it to your internal storage (emmc).
### Upgrading the kernel ### Upgrading the kernel
The script `UpgradeKernel.sh` located in `/InstallResources` can be ran be used to copy the kernel, modules, and ath9k firmware from a newer version of PrawnOS running on a USB drive or SD card onto an older version of PrawnOS installed on the laptops internal emmc storage. The script `UpgradeKernel.sh` located in `/InstallResources` can be ran be used to copy the kernel, modules, initramfs, and ath9k firmware from a newer version of PrawnOS running on a USB drive or SD card onto an older version of PrawnOS installed on the laptops internal emmc storage.
To use it, write the new PrawnOS image to a USB drive or SD card, boot the laptop to it by pressing `control+u` at boot, navigate to the `/InstallResources` folder, and run the script. To use it, write the new PrawnOS image to a USB drive or SD card, boot the laptop to it by pressing `control+u` at boot, navigate to the `/InstallResources` folder, and run the script.

View File

@ -1,67 +0,0 @@
#!/bin/bash
#Expand PrawnOS to fill the entire external device
# This file is part of PrawnOS (http://www.prawnos.com)
# Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
# PrawnOS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
# PrawnOS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
while true; do
echo "This script will expand PrawnOS to fill the entire external"
echo " storage device it is booted from"
echo "If installing to a USB flash drive, make sure only one USB storage device is plugged in"
read -p "install to: internal external (S)D, external (U)SB Storage: " ESU
case $ESU in
[Ss]* ) TARGET=SD; break;;
[Uu]* ) TARGET=USB; break;;
* ) echo "Please answer S or U";;
esac
done
if [ "$TARGET" = "USB" ]
then
#Make the boot partition fille the whole drive
#Delete the partition
sgdisk -d 2 /dev/sda
#Make new partition map entry, with full size
sgdisk -N 2 /dev/sda
#Set the type to "data"
sgdisk -t 2:0700 /dev/sda
#Name it "properly" - Probably not required, but looks nice
sgdisk -c 2:Root /dev/sda
#Reload the partition mapping
partprobe /dev/sda
#Force the filesystem to fill the new partition
resize2fs -f /dev/sda2
echo "/dev/sda2 / ext4 defaults,noatime 0 1" > /etc/fstab
fi
if [ "$TARGET" = "SD" ]
then
#Make the boot partition fille the whole drive
#Delete the partition
sgdisk -d 2 /dev/mmcblk0
#Make new partition map entry, with full size
sgdisk -N 2 /dev/mmcblk0
#Set the type to "data"
sgdisk -t 2:0700 /dev/mmcblk0
#Name it "properly" - Probably not required, but looks nice
sgdisk -c 2:Root /dev/mmcblk0
#Reload the partition mapping
partprobe /dev/mmcblk0
#Force the filesystem to fill the new partition
resize2fs -f /dev/mmcblk0p2
echo "/dev/mmcblk1p2 / ext4 defaults,noatime 0 1" > /etc/fstab
fi

View File

@ -78,7 +78,7 @@ install() {
fi fi
#cut off the "p" if we are using an sd card or internal emmc, doesn't change TARGET if we are using usb #cut off the "p" if we are using an sd card or internal emmc, doesn't change TARGET if we are using usb
TARGET_NO_P=$(echo $1 | cut -d 'p' -f 1) TARGET_NO_P=$(echo $TARGET | cut -d 'p' -f 1)
if [ ! -e $TARGET_NO_P ]; if [ ! -e $TARGET_NO_P ];
then then
echo "${TARGET_NO_P} does not exist, have you plugged in your target sd card or usb device?" echo "${TARGET_NO_P} does not exist, have you plugged in your target sd card or usb device?"

View File

@ -1,128 +0,0 @@
#!/bin/bash
#Install PrawnOS to the internal emmc, this will partition the internal emmc
#and erase ALL data on it
# This file is part of PrawnOS (http://www.prawnos.com)
# Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
# PrawnOS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# as published by the Free Software Foundation.
# PrawnOS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
RESOURCES=/InstallResources
# Grab the boot device, which is either /dev/sda for usb or /dev/mmcblk0 for an sd card
BOOT_DEVICE=$(mount | head -n 1 | cut -d '2' -f 1)
echo "--------------------------------------------------------------------------------------------------------"
echo "PrawnOS Install To Internal Emmc Script"
echo "Sets up the internal emmc partitions, root encryption, and copies the filesystem from the bootable media"
echo "This script can be quit and re-ran at any point"
echo "--------------------------------------------------------------------------------------------------------"
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
#disable dmesg, writing the partition map tries to write the the first gpt table, which is unmodifiable
dmesg -D
umount /dev/mmcblk2p1 || /bin/true
umount /dev/mmcblk2p2 || /bin/true
echo Writing partition map
DISK_SZ="$(blockdev --getsz /dev/mmcblk2)"
echo Total disk size is: $DISK_SZ
if [ $DISK_SZ = 30785536 ]
then
echo Detected Emmc Type 1
sfdisk /dev/mmcblk2 < $RESOURCES/mmc.partmap
elif [ $DISK_SZ = 30777344 ]
then
echo Detected Emmc Type 2
sfdisk /dev/mmcblk2 < $RESOURCES/mmc_type2.partmap
else
echo ERROR! Not a known EMMC type, please open an issue on github or send SolidHal an email with the Total disk size reported above
echo Try a fallback value? This will allow installation to continue, at the cost of a very small amoutnt of disk space. This may not work.
select yn in "Yes" "No"
do
case $yn,$REPLY in
Yes,*|*,Yes )
echo Trying Emmc Type 2
sfdisk /dev/mmcblk2 < $RESOURCES/mmc_type2.partmap
break
;;
* )
echo "Invalid Option, please enter Yes or No, 1 or 2"
;;
esac
done
fi
dmesg -E
echo Writing kernel partition
dd if=/dev/zero of=/dev/mmcblk2p1 bs=512 count=65536
dd if="$BOOT_DEVICE"1 of=/dev/mmcblk2p1
ROOT_DEV_NAME=mmcblk2p2
CRYPTO=false
#Handle full disk encryption
echo "Would you like to setup full disk encrytion using LUKs/DmCrypt?"
select yn in "Yes" "No"
do
case $yn,$REPLY in
Yes,*|*,Yes )
CRYPTO=true
# Since iteration count is based on cpu power, and the rk3288 isn't as fast as a usual
# desktop cpu, manually supply -i 15000 for security at the cost of a slightly slower unlock
echo "Now to setup the password you would like to use to unlock the encrypted root partition at boot"
cryptsetup -q -y -s 512 luksFormat -i 15000 /dev/$ROOT_DEV_NAME || exit 1
echo "Now unlock the newly created encrypted root partition so we can mount it and install the filesystem"
cryptsetup luksOpen /dev/$ROOT_DEV_NAME luksroot || exit 1
ROOT_DEV_NAME=mapper/luksroot
break
;;
No,*|*,No )
break
;;
* )
echo "Invalid Option, please enter Yes or No, 1 or 2"
;;
esac
done
echo Writing Filesystem, this will take about 4 minutes...
mkfs.ext4 -F -b 1024 /dev/$ROOT_DEV_NAME
mkdir -p /mnt/mmc/
mount /dev/$ROOT_DEV_NAME /mnt/mmc
rsync -ah --info=progress2 --info=name0 --numeric-ids -x / /mnt/mmc/
#Remove the live-fstab and install a base fstab
rm /mnt/mmc/etc/fstab
if [[ $CRYPTO == "true" ]]
then
echo "/dev/mapper/luksroot / ext4 defaults,noatime 0 1" > /mnt/mmc/etc/fstab
else
echo "/dev/mmcblk2p2 / ext4 defaults,noatime 0 1" > /mnt/mmc/etc/fstab
fi
umount /dev/$ROOT_DEV_NAME
echo Running fsck
e2fsck -p -f /dev/$ROOT_DEV_NAME
if [[ $CRYPTO == "true" ]]
then
# unmount and close encrypted storage
cryptsetup luksClose luksroot
fi
echo Rebooting... Please remove the usb drive once shutdown is complete
reboot
fi
echo Exiting

View File

@ -110,7 +110,7 @@ mkdir $outmnt/InstallResources/icons/
cp $build_resources/logo/icons/icon-small.png $outmnt/InstallResources/icons/ cp $build_resources/logo/icons/icon-small.png $outmnt/InstallResources/icons/
cp $build_resources/logo/icons/ascii/* $outmnt/InstallResources/icons/ cp $build_resources/logo/icons/ascii/* $outmnt/InstallResources/icons/
cp scripts/InstallScripts/* $outmnt/InstallResources/ cp scripts/InstallScripts/* $outmnt/InstallResources/
cp scripts/InstallScripts/InstallToInternal.sh $outmnt/ cp scripts/InstallScripts/InstallPrawnOS.sh $outmnt/
chmod +x $outmnt/*.sh chmod +x $outmnt/*.sh
#Setup the chroot for apt #Setup the chroot for apt