-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rpi: Add resize-rootfs=r0 (expand rootfs)
:Release Notes: A service to expand the rootfs :Detailed Notes: Expand the rootfs as whole SD card. This service will be executed on the first boot only. (Creates /var/luna/preferences/rootfs-resized) :Testing Performed: See PLAT-80165 :QA Notes: N/A :Issues Addressed: [PLAT-76087] [FOTA] Expand rootfs size and mount partitions for libostree [PLAT-80165] [OSE] CCC: rpi: add resize-rootfs=r0 (expand rootfs) Change-Id: I06b830f58f04cfe35ebd8c9794d8c96b1d10d387
- Loading branch information
Showing
5 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
meta-webos-raspberrypi/recipes-bsp/resize-rootfs/files/resize-rootfs.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,24 @@ | ||
# @@@LICENSE | ||
# | ||
# Copyright (c) 2019 LG Electronics, Inc. | ||
# | ||
# LICENSE@@@ | ||
|
||
[Unit] | ||
Description=webos - "%n" | ||
DefaultDependencies=no | ||
Conflicts=shutdown.target | ||
Before=sysinit.target | ||
After=systemd-remount-fs.service local-fs.target | ||
Requires=local-fs.target | ||
ConditionPathExists=!/var/luna/preferences/rootfs_resized | ||
|
||
[Service] | ||
Type=oneshot | ||
RemainAfterExit=yes | ||
ExecStart=/etc/systemd/system/scripts/resize-rootfs.sh | ||
StandardOutput=tty | ||
StandardError=tty | ||
|
||
[Install] | ||
WantedBy=local-fs.target |
53 changes: 53 additions & 0 deletions
53
meta-webos-raspberrypi/recipes-bsp/resize-rootfs/files/resize-rootfs.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,53 @@ | ||
#!/bin/sh | ||
# Copyright (c) 2019 LG Electronics, Inc. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
if [ "$(id -u)" -ne "0" ]; then | ||
echo "This script requires root." | ||
exit 1 | ||
fi | ||
|
||
PREF_DIR="/var/luna/preferences" | ||
DEVICE="/dev/mmcblk0" | ||
PART="2" | ||
|
||
updatePartitionTable() { | ||
start=$(fdisk -l ${DEVICE}|grep ${DEVICE}p${PART}|awk '{print $2}') | ||
|
||
fdisk ${DEVICE} <<EOF | ||
p | ||
d | ||
2 | ||
n | ||
p | ||
2 | ||
$start | ||
No | ||
w | ||
EOF | ||
echo "Partition table updated!" | ||
} | ||
|
||
if [ -f ${PREF_DIR}/rootfs_resized ]; then | ||
echo "Resize rootfs done already!" | ||
else | ||
updatePartitionTable | ||
partprobe | ||
resize2fs ${DEVICE}p${PART} | ||
touch ${PREF_DIR}/rootfs_resized | ||
echo "Resize rootfs done!" | ||
fi |
27 changes: 27 additions & 0 deletions
27
meta-webos-raspberrypi/recipes-bsp/resize-rootfs/resize-rootfs.bb
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,27 @@ | ||
# Copyright (c) 2019 LG Electronics, Inc. | ||
|
||
SUMMARY = "A service to expand rootfs to whole media" | ||
AUTHOR = "JeongBong Seo <jb.seo@lge.com>" | ||
SECTION = "webos/base" | ||
LICENSE = "Apache-2.0" | ||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" | ||
|
||
RDEPENDS_${PN} = "e2fsprogs-resize2fs parted" | ||
|
||
PR = "r0" | ||
|
||
inherit systemd | ||
|
||
SRC_URI = " \ | ||
file://resize-rootfs.service \ | ||
file://resize-rootfs.sh \ | ||
" | ||
|
||
do_install() { | ||
install -d ${D}${systemd_system_unitdir} | ||
install -v -m 0644 ${WORKDIR}/resize-rootfs.service ${D}${systemd_system_unitdir} | ||
install -d ${D}${sysconfdir}/systemd/system/scripts | ||
install -v -m 0755 ${WORKDIR}/resize-rootfs.sh ${D}${sysconfdir}/systemd/system/scripts | ||
} | ||
|
||
SYSTEMD_SERVICE_${PN} = " resize-rootfs.service" |
6 changes: 6 additions & 0 deletions
6
meta-webos-raspberrypi/recipes-core/images/webos-image.bbappend
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 @@ | ||
# Copyright (c) 2019 LG Electronics, Inc. | ||
|
||
EXTENDPRAUTO_append_rpi = "webosrpi1" | ||
|
||
# resize-rootfs will expand rootfs, so we don't need extra space a lot | ||
IMAGE_ROOTFS_EXTRA_SPACE = "16384" |
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