-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bananapi: switch to skiff-init-squashfs and fix u-boot
- update u-boot scripts - use skiff-init-squashfs instead of ramdisk - increase partition sizes - add buildimage - disable smartd BREAKING CHANGE: partition layout change for bananapi Signed-off-by: Christian Stewart <[email protected]>
- Loading branch information
Showing
15 changed files
with
321 additions
and
123 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,14 @@ | ||
# use skiff-init-squashfs | ||
BR2_PACKAGE_SKIFF_INIT_SQUASHFS=y | ||
BR2_PACKAGE_SKIFF_INIT_SQUASHFS_MUTABLE_OVERLAY_SIZE="25%" | ||
BR2_PACKAGE_SKIFF_INIT_SQUASHFS_PATH="/rootfs.squashfs" | ||
BR2_PACKAGE_SKIFF_INIT_SQUASHFS_RESIZE2FS_BIN_PATH="/skiff-init/resize2fs" | ||
BR2_PACKAGE_SKIFF_INIT_SQUASHFS_RESIZE2FS_CONF_PATH="/skiff-init/resize2fs.conf" | ||
BR2_PACKAGE_SKIFF_INIT_SQUASHFS_RESIZE2FS=y | ||
BR2_PACKAGE_SKIFF_INIT_SQUASHFS_ROOT_AS_BOOT=y | ||
# BR2_PACKAGE_SKIFF_INIT_SQUASHFS_ROOT_AS_PERSIST is not set | ||
BR2_PACKAGE_SKIFF_INIT_RESIZE2FS=y | ||
|
||
# BR2_TARGET_ROOTFS_CPIO is not set | ||
BR2_TARGET_ROOTFS_SQUASHFS=y | ||
BR2_TARGET_ROOTFS_SQUASHFS4_LZ4=y |
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,6 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
IMAGES_DIR=${SKIFF_BUILDROOT_DIR}/images | ||
mkdir -p ${IMAGES_DIR}/skiff-init | ||
cp ${SKIFF_CURRENT_CONF_DIR}/resources/resize2fs.conf ${IMAGES_DIR}/skiff-init/resize2fs.conf |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
format Format a SD card and install bootloader. | ||
install Installs to a formatted SD card. | ||
buildimage Builds an image using a loopback device. |
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 @@ | ||
/dev/mmcblk0p2 |
1 change: 1 addition & 0 deletions
1
configs/bananapi/common/root_overlay/etc/systemd/system/smartd.service
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 @@ | ||
/dev/null |
4 changes: 4 additions & 0 deletions
4
...bananapi/common/root_overlay/opt/skiff/scripts/mount-all.pre.d/00skiff-squashfs-mounts.sh
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 @@ | ||
export PERSIST_DEVICE="/dev/mmcblk0p2" | ||
export ROOTFS_DEVICE="/mnt/persist/rootfs" | ||
export ROOTFS_MNT_FLAGS="--rbind" | ||
export ROOTFS_DEVICE_MKDIR="true" |
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,43 @@ | ||
#!/bin/bash | ||
|
||
if [ $EUID != 0 ]; then | ||
echo "This script requires sudo, so it might not work." | ||
fi | ||
|
||
set -e | ||
|
||
if [ -z "$PI_IMAGE" ]; then | ||
echo "Please set PI_IMAGE to the path to the output image." | ||
exit 1 | ||
fi | ||
|
||
if [[ "$PI_IMAGE" != /* ]]; then | ||
# the "make" command is run from the skiff root, | ||
# it's most intuitive to take that as the base path | ||
PI_IMAGE=$SKIFF_ROOT_DIR/$PI_IMAGE | ||
fi | ||
|
||
echo "Allocating sparse image..." | ||
fallocate -l 1.5G $PI_IMAGE | ||
|
||
echo "Setting up loopback device..." | ||
export PI_SD=$(losetup --show -fP $PI_IMAGE) | ||
function cleanup { | ||
echo "Removing loopback device..." || true | ||
sync || true | ||
losetup -d $PI_SD || true | ||
} | ||
trap cleanup EXIT | ||
|
||
if [ -z "${PI_SD}" ] || [ ! -b ${PI_SD} ]; then | ||
echo "Failed to setup loop device." | ||
exit 1 | ||
fi | ||
|
||
# Setup no interactive since we know its a brand new file. | ||
export SKIFF_NO_INTERACTIVE=1 | ||
export DISABLE_CREATE_SWAPFILE=1 | ||
|
||
echo "Using loopback device at ${PI_SD}" | ||
$SKIFF_CURRENT_CONF_DIR/scripts/format_sd.sh | ||
$SKIFF_CURRENT_CONF_DIR/scripts/install_sd.sh |
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
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
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 |
---|---|---|
@@ -1,13 +1,34 @@ | ||
setenv condev "console=ttyS0,115200" | ||
setenv bootargs "root=/dev/initrd rootwait ro ramdisk_size=100000 ${condev} earlyprintk no_console_suspend net.ifnames=0" | ||
setenv dtb_name "sun7i-a20-bananapi.dtb" | ||
setenv condev "console=tty1 console=ttyS0,115200n8" | ||
setenv verify 0 | ||
setenv bootlogo "false" | ||
|
||
setenv dtb_addr_r "0x42000000" | ||
setenv kernel_addr_r "0x40008000" | ||
setenv initramfs_addr_r "0x44000000" | ||
setenv devtype mmc | ||
setenv devnum 0 | ||
setenv bootpart 1 | ||
|
||
mmc dev 0 | ||
fatload mmc 0 ${initramfs_addr_r} rootfs.cpio.uboot | ||
fatload mmc 0 ${kernel_addr_r} zImage | ||
fatload mmc 0 ${dtb_addr_r} sun7i-a20-bananapi.dtb | ||
setenv fdt_addr_r "0x43000000" | ||
setenv kernel_addr_r "0x42000000" | ||
setenv ramdisk_addr_r "0x43400000" | ||
|
||
bootz ${kernel_addr_r} ${initramfs_addr_r} ${dtb_addr_r} | ||
# determine uuid of the boot partition | ||
part uuid ${devtype} ${devnum}:${bootpart} uuid | ||
|
||
# use /init script to deferred mount / | ||
setenv bootmem "root=PARTUUID=${uuid} rw rootwait init=/skiff-init/skiff-init-squashfs" | ||
|
||
# boot args | ||
setenv bootargs "${bootmem} ${condev} no_console_suspend fsck.repair=yes net.ifnames=0" | ||
|
||
# boot from sd card | ||
setenv devnum 0 | ||
mmc dev ${devnum} | ||
|
||
echo "Loading zImage to ${kernel_addr_r}" | ||
load mmc ${devnum}:${bootpart} ${kernel_addr_r} zImage | ||
|
||
echo "Loading dtb to ${fdt_addr_r}" | ||
load mmc ${devnum}:${bootpart} ${fdt_addr_r} ${dtb_name} | ||
|
||
echo "Booting with bootargs: ${bootargs}" | ||
bootz ${kernel_addr_r} - ${fdt_addr_r} |
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 |
---|---|---|
@@ -1,13 +1,34 @@ | ||
setenv condev "console=ttyS0,115200" | ||
setenv bootargs "root=/dev/initrd rootwait ro ramdisk_size=100000 ${condev} earlyprintk no_console_suspend net.ifnames=0" | ||
setenv dtb_name "sun7i-a20-bananapi-m1-plus.dtb" | ||
setenv condev "console=tty1 console=ttyS0,115200n8" | ||
setenv verify 0 | ||
setenv bootlogo "false" | ||
|
||
setenv dtb_addr_r "0x42000000" | ||
setenv kernel_addr_r "0x40008000" | ||
setenv initramfs_addr_r "0x44000000" | ||
setenv devtype mmc | ||
setenv devnum 0 | ||
setenv bootpart 1 | ||
|
||
mmc dev 0 | ||
fatload mmc 0 ${initramfs_addr_r} rootfs.cpio.uboot | ||
fatload mmc 0 ${kernel_addr_r} zImage | ||
fatload mmc 0 ${dtb_addr_r} sun7i-a20-bananapi-m1-plus.dtb | ||
setenv fdt_addr_r "0x43000000" | ||
setenv kernel_addr_r "0x42000000" | ||
setenv ramdisk_addr_r "0x43400000" | ||
|
||
bootz ${kernel_addr_r} ${initramfs_addr_r} ${dtb_addr_r} | ||
# determine uuid of the boot partition | ||
part uuid ${devtype} ${devnum}:${bootpart} uuid | ||
|
||
# use /init script to deferred mount / | ||
setenv bootmem "root=PARTUUID=${uuid} rw rootwait init=/skiff-init/skiff-init-squashfs" | ||
|
||
# boot args | ||
setenv bootargs "${bootmem} ${condev} no_console_suspend fsck.repair=yes net.ifnames=0" | ||
|
||
# boot from sd card | ||
setenv devnum 0 | ||
mmc dev ${devnum} | ||
|
||
echo "Loading zImage to ${kernel_addr_r}" | ||
load mmc ${devnum}:${bootpart} ${kernel_addr_r} zImage | ||
|
||
echo "Loading dtb to ${fdt_addr_r}" | ||
load mmc ${devnum}:${bootpart} ${fdt_addr_r} ${dtb_name} | ||
|
||
echo "Booting with bootargs: ${bootargs}" | ||
bootz ${kernel_addr_r} - ${fdt_addr_r} |
Oops, something went wrong.