Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resize Rootfs && Version Updates #41

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions builds.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,65 @@

# Builds for GitHub Actions
builds = [
"am62p-bookworm-09.02.00.006",
"am62p-bookworm-09.02.00.006-rt",
"am62-bookworm-09.02.00.006",
"am62-bookworm-09.02.00.006-rt",
"am62lp-bookworm-09.02.00.006",
"am62lp-bookworm-09.02.00.006-rt",
"am62sip-bookworm-09.02.00.006",
"am62sip-bookworm-09.02.00.006-rt",
"am64-bookworm-09.02.00.006",
"am64-bookworm-09.02.00.006-rt",
"am62p-bookworm-09.02.01.006",
"am62p-bookworm-09.02.01.006-rt",
"am62-bookworm-09.02.01.006",
"am62-bookworm-09.02.01.006-rt",
"am62lp-bookworm-09.02.01.006",
"am62lp-bookworm-09.02.01.006-rt",
"am62sip-bookworm-09.02.01.006",
"am62sip-bookworm-09.02.01.006-rt",
"am64-bookworm-09.02.01.006",
"am64-bookworm-09.02.01.006-rt",
]

# List of all valid builds
[am62p-bookworm-09.02.00.006]
[am62p-bookworm-09.02.01.006]
machine = "am62pxx-evm"
bsp_version = "09.02.00.006"
distro_variant = "am62p-bookworm"

[am62p-bookworm-09.02.00.006-rt]
[am62p-bookworm-09.02.01.006-rt]
machine = "am62pxx-evm"
bsp_version = "09.02.00.006-rt"
distro_variant = "am62p-bookworm-rt"

[am62-bookworm-09.02.00.006]
[am62-bookworm-09.02.01.006]
machine = "am62xx-evm"
bsp_version = "09.02.00.006"
distro_variant = "am62-bookworm"

[am62-bookworm-09.02.00.006-rt]
[am62-bookworm-09.02.01.006-rt]
machine = "am62xx-evm"
bsp_version = "09.02.00.006-rt"
distro_variant = "am62-bookworm-rt"

[am62lp-bookworm-09.02.00.006]
[am62lp-bookworm-09.02.01.006]
machine = "am62xx-lp-evm"
bsp_version = "09.02.00.006"
distro_variant = "am62-bookworm"

[am62lp-bookworm-09.02.00.006-rt]
[am62lp-bookworm-09.02.01.006-rt]
machine = "am62xx-lp-evm"
bsp_version = "09.02.00.006-rt"
distro_variant = "am62-bookworm-rt"

[am62sip-bookworm-09.02.00.006]
[am62sip-bookworm-09.02.01.006]
machine = "am62xxsip-evm"
bsp_version = "09.02.00.006"
distro_variant = "am62-bookworm"

[am62sip-bookworm-09.02.00.006-rt]
[am62sip-bookworm-09.02.01.006-rt]
machine = "am62xxsip-evm"
bsp_version = "09.02.00.006-rt"
distro_variant = "am62-bookworm-rt"

[am64-bookworm-09.02.00.006]
[am64-bookworm-09.02.01.006]
machine = "am64xx-evm"
bsp_version = "09.02.00.006"
distro_variant = "am64-bookworm"

[am64-bookworm-09.02.00.006-rt]
[am64-bookworm-09.02.01.006-rt]
machine = "am64xx-evm"
bsp_version = "09.02.00.006-rt"
distro_variant = "am64-bookworm-rt"
Expand Down
8 changes: 8 additions & 0 deletions configs/bdebstrap_configs/am62-bookworm-rt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ mmdebstrap:
- mesa-vulkan-drivers
- libpru-pssp-dev
- pru-pssp
- parted
- e2fsprogs
mirrors:
- http://deb.debian.org/debian
setup-hooks:
Expand Down Expand Up @@ -105,4 +107,10 @@ mmdebstrap:
# Enable ssh to root user without password
- 'chroot "$1" echo "PermitRootLogin yes" >> $1/etc/ssh/sshd_config'
- 'chroot "$1" echo "PermitEmptyPasswords yes" >> $1/etc/ssh/sshd_config'
# Resize Rootfs Service
- 'chroot "$1" mkdir -p /usr/bin'
- 'upload target/resize_rootfs/resize_rootfs.sh /usr/bin/resize_rootfs.sh'
- 'chroot "$1" mkdir -p /etc/systemd/system/'
- 'upload target/resize_rootfs/resize_rootfs.service /etc/systemd/system/resize_rootfs.service'
- '$BDEBSTRAP_HOOKS/enable-units "$1" resize_rootfs'

8 changes: 8 additions & 0 deletions configs/bdebstrap_configs/am62-bookworm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ mmdebstrap:
- mesa-vulkan-drivers
- libpru-pssp-dev
- pru-pssp
- parted
- e2fsprogs
mirrors:
- http://deb.debian.org/debian
setup-hooks:
Expand Down Expand Up @@ -105,4 +107,10 @@ mmdebstrap:
# Enable ssh to root user without password
- 'chroot "$1" echo "PermitRootLogin yes" >> $1/etc/ssh/sshd_config'
- 'chroot "$1" echo "PermitEmptyPasswords yes" >> $1/etc/ssh/sshd_config'
# Resize Rootfs Service
- 'chroot "$1" mkdir -p /usr/bin'
- 'upload target/resize_rootfs/resize_rootfs.sh /usr/bin/resize_rootfs.sh'
- 'chroot "$1" mkdir -p /etc/systemd/system/'
- 'upload target/resize_rootfs/resize_rootfs.service /etc/systemd/system/resize_rootfs.service'
- '$BDEBSTRAP_HOOKS/enable-units "$1" resize_rootfs'

8 changes: 8 additions & 0 deletions configs/bdebstrap_configs/am62p-bookworm-rt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ mmdebstrap:
- mesa-vulkan-drivers
- libpru-pssp-dev
- pru-pssp
- parted
- e2fsprogs
mirrors:
- http://deb.debian.org/debian
setup-hooks:
Expand Down Expand Up @@ -105,4 +107,10 @@ mmdebstrap:
# Enable ssh to root user without password
- 'chroot "$1" echo "PermitRootLogin yes" >> $1/etc/ssh/sshd_config'
- 'chroot "$1" echo "PermitEmptyPasswords yes" >> $1/etc/ssh/sshd_config'
# Resize Rootfs Service
- 'chroot "$1" mkdir -p /usr/bin'
- 'upload target/resize_rootfs/resize_rootfs.sh /usr/bin/resize_rootfs.sh'
- 'chroot "$1" mkdir -p /etc/systemd/system/'
- 'upload target/resize_rootfs/resize_rootfs.service /etc/systemd/system/resize_rootfs.service'
- '$BDEBSTRAP_HOOKS/enable-units "$1" resize_rootfs'

8 changes: 8 additions & 0 deletions configs/bdebstrap_configs/am62p-bookworm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ mmdebstrap:
- mesa-vulkan-drivers
- libpru-pssp-dev
- pru-pssp
- parted
- e2fsprogs
mirrors:
- http://deb.debian.org/debian
setup-hooks:
Expand Down Expand Up @@ -105,4 +107,10 @@ mmdebstrap:
# Enable ssh to root user without password
- 'chroot "$1" echo "PermitRootLogin yes" >> $1/etc/ssh/sshd_config'
- 'chroot "$1" echo "PermitEmptyPasswords yes" >> $1/etc/ssh/sshd_config'
# Resize Rootfs Service
- 'chroot "$1" mkdir -p /usr/bin'
- 'upload target/resize_rootfs/resize_rootfs.sh /usr/bin/resize_rootfs.sh'
- 'chroot "$1" mkdir -p /etc/systemd/system/'
- 'upload target/resize_rootfs/resize_rootfs.service /etc/systemd/system/resize_rootfs.service'
- '$BDEBSTRAP_HOOKS/enable-units "$1" resize_rootfs'

8 changes: 8 additions & 0 deletions configs/bdebstrap_configs/am64-bookworm-rt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ mmdebstrap:
- libti-rpmsg-char-dev
- libpru-pssp-dev
- pru-pssp
- parted
- e2fsprogs
mirrors:
- http://deb.debian.org/debian
setup-hooks:
Expand Down Expand Up @@ -73,4 +75,10 @@ mmdebstrap:
# Enable ssh to root user without password
- 'chroot "$1" echo "PermitRootLogin yes" >> $1/etc/ssh/sshd_config'
- 'chroot "$1" echo "PermitEmptyPasswords yes" >> $1/etc/ssh/sshd_config'
# Resize Rootfs Service
- 'chroot "$1" mkdir -p /usr/bin'
- 'upload target/resize_rootfs/resize_rootfs.sh /usr/bin/resize_rootfs.sh'
- 'chroot "$1" mkdir -p /etc/systemd/system/'
- 'upload target/resize_rootfs/resize_rootfs.service /etc/systemd/system/resize_rootfs.service'
- '$BDEBSTRAP_HOOKS/enable-units "$1" resize_rootfs'

8 changes: 8 additions & 0 deletions configs/bdebstrap_configs/am64-bookworm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ mmdebstrap:
- libti-rpmsg-char-dev
- libpru-pssp-dev
- pru-pssp
- parted
- e2fsprogs
mirrors:
- http://deb.debian.org/debian
setup-hooks:
Expand Down Expand Up @@ -73,4 +75,10 @@ mmdebstrap:
# Enable ssh to root user without password
- 'chroot "$1" echo "PermitRootLogin yes" >> $1/etc/ssh/sshd_config'
- 'chroot "$1" echo "PermitEmptyPasswords yes" >> $1/etc/ssh/sshd_config'
# Resize Rootfs Service
- 'chroot "$1" mkdir -p /usr/bin'
- 'upload target/resize_rootfs/resize_rootfs.sh /usr/bin/resize_rootfs.sh'
- 'chroot "$1" mkdir -p /etc/systemd/system/'
- 'upload target/resize_rootfs/resize_rootfs.service /etc/systemd/system/resize_rootfs.service'
- '$BDEBSTRAP_HOOKS/enable-units "$1" resize_rootfs'

14 changes: 14 additions & 0 deletions target/resize_rootfs/resize_rootfs.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Expand the rootfs partition to full size of the boot device.

[Service]
ExecStart=/usr/bin/resize_rootfs.sh
Type=oneshot
RemainAfterExit=yes
TimeoutStopSec=20
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target

20 changes: 20 additions & 0 deletions target/resize_rootfs/resize_rootfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
# This startup script expands the rootfs partition to full size of the boot device.

ROOT_PART=`mount | grep "/ " | cut -f1 -d' ' | cut -d'/' -f3`
BOOT_DEV=${ROOT_PART%p*}

if [[ "$BOOT_DEV" != *"mmc"* ]]; then
# Not booting from EMMC / SD Card. So no need to extend the rootfs.
exit 0
fi

FREE_SPACE=`parted /dev/$BOOT_DEV unit '%' print free | grep 'Free Space' | tail -n1 | awk '{print $3}'`

if [[ ${FREE_SPACE%.*} -gt 0 ]]; then
echo "$FREE_SPACE of /dev/$BOOT_DEV is free. Extending partition #2"
echo ",+" | sfdisk -N 2 /dev/$BOOT_DEV --no-reread
partprobe
resize2fs /dev/$ROOT_PART
fi

Loading