Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
Add command to install to internal storage and fix user not being added
Browse files Browse the repository at this point in the history
  • Loading branch information
MilkyDeveloper committed Dec 19, 2021
1 parent 156ba96 commit b131f5f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .shellcheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ disable=SC2046
disable=SC2164
disable=SC2103
disable=SC1091
disable=SC2155
disable=SC2155
disable=SC2002
43 changes: 43 additions & 0 deletions bin/install-to-internal-storage
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

echo "What drive would you like to install to? (e.g. /dev/mmcblk0)"
read -r USB
export USB

# Format the USB with GPT
sudo parted $USB mklabel gpt
echo "Writing sotrage, will take a few minutes"
sync

# Create a 65 Mb kernel partition
# Our kernels are only ~10 Mb though
sudo parted -a optimal $USB unit mib mkpart Kernel 1 65

# Add a root partition
sudo parted -a optimal $USB unit mib mkpart Root 65 100%

# Make depthcharge know that this is a real kernel partition
sudo cgpt add -i 1 -t kernel -S 1 -T 5 -P 15 $USB

# Format the root partition as ext4 and mount it to /mnt
sudo mkfs.ext4 ${USB}p2

echo "Writing sotrage, will take a few minutes"
sync

sudo mount ${USB}p2 /mnt

# Copy all files from the USB to the internal storage drive
sudo rsync -a --info=progress2 / /mnt --exclude proc --exclude sys --exclude dev --exclude mnt --exclude media
echo "Writing sotrage, will take a few minutes"
sync

bash <(curl -s https://raw.githubusercontent.com/MilkyDeveloper/cb-linux/main/kernel/kernel.emmc.flags.sh) > cmdline

# Repack the kernel
futility vbutil_kernel --repack bzImage.signed --keyblock /usr/share/vboot/devkeys/kernel.keyblock --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --oldblob bzImage --config cmdline

# Flash the kernel to the partition
sudo dd if=bzImage.signed of=${USB}p1

echo "Done! Use CTRL+D to boot from the internal storage next time."
3 changes: 2 additions & 1 deletion bin/setup-audio
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ echo "Installing Audio (OTB for KBL DA7219 max98357a, see $(which setup-audio) f
export SND_DEVICE=${SND_CARD}${SND_BOARD}

# Copy the firmware and create the correct UCM Files
sudo apt purge pulseaudio
sudo apt purge pulseaudio*
sudo mount -t ext2 -o ro /dev/mmcblk0p3 /mnt
sudo mount -t ext2 -o ro /dev/mmcblk0p3 /mnt || sudo mount -t ext2 -o ro /dev/mmcblk1p3 /mnt
sudo cp -r /mnt/lib/firmware/* /lib/firmware
sudo cp -r /mnt/usr/share/alsa/ucm/${SND_DEVICE} /usr/share/alsa/ucm2/${SND_CARD}
sudo umount /mnt
Expand Down
2 changes: 1 addition & 1 deletion utils/distros/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ EOT
set -e

# Only create a new user and add it to the sudo group if the user doesn't already exist
if runChrootCommand "id $BREATH_USER &>/dev/null"; then
if runChrootCommand "id $BREATH_USER"; then
true
else
runChrootCommand "adduser $BREATH_USER && usermod -aG sudo $BREATH_USER"
Expand Down

0 comments on commit b131f5f

Please sign in to comment.