Created
January 12, 2019 18:34
-
-
Save jasenmichael/be79db53dc120ef40237f82e221b88ed to your computer and use it in GitHub Desktop.
script to make a berryboot squashed image from a normal rasberrypi image
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
#!/bin/bash | |
# usage | |
# ./make-berryboot-squashimage.sh /full/path/to/your-image-to-squash.img | |
# install dependencies | |
# sudo apt-get install kpartx | |
# sudo apt-get install squashfs-tools | |
img="${1##*/}" | |
echo 'squashin dis img -' $img | |
# mount img | |
kpartx -av $1 | |
sudo mkdir /mnt/bb | |
sudo mount /dev/mapper/loop0p2 /mnt/bb | |
sudo sed -i 's/^\/dev\/mmcblk/#\0/g' /mnt/bb/etc/fstab | |
sudo sed -i 's/^PARTUUID/#\0/g' /mnt/bb/etc/fstab | |
sudo rm -f /mnt/bb/etc/console-setup/cached_UTF-8_del.kmap.gz | |
sudo rm -f /mnt/bb/etc/systemd/system/multi-user.target.wants/apply_noobs_os_config.service | |
sudo rm -f /mnt/bb/etc/systemd/system/multi-user.target.wants/raspberrypi-net-mods.service | |
sudo rm -f /mnt/bb/etc/rc3.d/S01resize2fs_once | |
sudo mksquashfs /mnt/bb /home/me/dev/berryboot-imgs/img/bb-$img -comp lzo -e lib/modules | |
sudo umount /mnt/bb | |
sudo rm -rf /mnt/bb | |
sudo kpartx -d $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment