sonic-buildimage/files/initramfs-tools/varlog
arheneus@marvell.com 6bd17d4780 [initramfs] Updated required tools for initramfs (#3734)
* [initramfs] Updated reuired tools for initramfs

Signed-off-by: Antony Rheneus <arheneus@marvell.com>

* [initramfs] Updated required tools for initramfs

Signed-off-by: Antony Rheneus <arheneus@marvell.com>

* [Platform] [Marvell] Platform specific debian package for et6448m device

Signed-off-by: Antony Rheneus <arheneus@marvell.com>

* Removed auto-generated files

Signed-off-by: Antony Rheneus <arheneus@marvell.com>

* [initramfs] Added mtd and uboot firmware tools package required for arm arch
Its been enabled to all arch including amd64

Signed-off-by: Antony Rheneus <arheneus@marvell.com>

* [initramfs] Added mtd and uboot firmware tools package required for arm arch
Its been enabled to all arch including amd64

Signed-off-by: Antony Rheneus <arheneus@marvell.com>

* [initramfs] Marvell arm modules update and platform config update

Signed-off-by: Antony Rheneus <arheneus@marvell.com>

* [iniramfs] add initramfs uboot-utils hook script only for ARM

Signed-off-by: Antony Rheneus <arheneus@marvell.com>
2020-01-15 08:25:01 -08:00

45 lines
1.1 KiB
Bash

#!/bin/sh -e
PREREQS=""
prereqs() { echo "$PREREQS"; }
case $1 in
prereqs)
prereqs
exit 0
;;
esac
# Extract kernel parameters
set -- $(cat /proc/cmdline)
for x in "$@"; do
case "$x" in
varlog_size=*)
varlog_size="${x#varlog_size=}"
esac
done
[ -z "$varlog_size" ] && exit 0
# exit when the var_log.ext4 exists and the size matches
if [ -e "${rootmnt}/host/disk-img/var-log.ext4" ]; then
cur_varlog_size=$(ls -l ${rootmnt}/host/disk-img/var-log.ext4 | awk '{print $5}')
if [ $cur_varlog_size == $((1024*1024*$varlog_size)) ]; then
exit 0
else
rm -rf ${rootmnt}/host/disk-img
fi
fi
# create varlog disk
case "${ROOT}" in
ubi*)
# sys_fallocate is NOT supported over UBIFS
mkdir -p ${rootmnt}/host/disk-img && ${rootmnt}/usr/bin/truncate -s "$varlog_size"M ${rootmnt}/host/disk-img/var-log.ext4 && mkfs.ext4 -q -F ${rootmnt}/host/disk-img/var-log.ext4
;;
*)
mkdir -p ${rootmnt}/host/disk-img && ${rootmnt}/usr/bin/fallocate -l "$varlog_size"M ${rootmnt}/host/disk-img/var-log.ext4 && mkfs.ext4 -q -F ${rootmnt}/host/disk-img/var-log.ext4
;;
esac