util-linux: make swap support fully optional on all projects, dont install and run init script and swap tools if disabled, add support to setup swap file size at build and runtime

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2012-05-19 02:28:16 +02:00
parent 7da4861c47
commit b835c903b6
25 changed files with 144 additions and 34 deletions

View File

@ -329,6 +329,10 @@ show_config() {
config_message="$config_message\n\n Misc. Filesystems:"
config_message="$config_message\n $dashes$dashes"
config_message="$config_message\n - Swap Support:\t\t\t $SWAP_SUPPORT"
if [ "$SWAP_SUPPORT" = "yes" ]; then
config_message="$config_message\n - Swapfile default size:\t\t $SWAPFILESIZE"
fi
config_message="$config_message\n - NTFS Support (via Fuse):\t\t $NTFS3G"
config_message="$config_message\n - Install HFS Tools:\t\t\t $HFSTOOLS"

View File

@ -47,6 +47,11 @@ sed -i -e "s|^CONFIG_INITRAMFS_SOURCE=.*$|CONFIG_INITRAMFS_SOURCE=\"$ROOT/$BUILD
sed -i -e "s|^CONFIG_VIDEO_DEV=.*$|# CONFIG_VIDEO_DEV is not set|" $LINUX/.config
fi
# disable swap support if not enabled
if [ ! "$SWAP_SUPPORT" = yes ]; then
sed -i -e "s|^CONFIG_SWAP=.*$|# CONFIG_SWAP is not set|" $LINUX/.config
fi
# dont install some debug stuff on release builds
if [ ! "$DEVTOOLS" = yes ]; then
sed -i -e "s|^CONFIG_DEBUG_FS=.*$|# CONFIG_DEBUG_FS is not set|" $LINUX/.config

View File

@ -0,0 +1,22 @@
################################################################################
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This Program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenELEC.tv; see the file COPYING. If not, write to
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
SWAPFILE="$HOME/.cache/swapfile"
SWAPFILESIZE="@SWAPFILESIZE@"

View File

@ -25,8 +25,6 @@
mkdir -p $INSTALL/usr/bin
cp $PKG_BUILD/misc-utils/.libs/blkid $INSTALL/usr/bin
cp $PKG_BUILD/sys-utils/fstrim $INSTALL/usr/bin
cp $PKG_BUILD/sys-utils/.libs/swapon $INSTALL/usr/bin
ln -sf swapon $INSTALL/usr/bin/swapoff
cp $PKG_BUILD/fsck/.libs/fsck $INSTALL/usr/bin
mkdir -p $INSTALL/usr/lib
@ -34,3 +32,15 @@ mkdir -p $INSTALL/usr/lib
rm -rf $INSTALL/usr/lib/libblkid.so*T
cp -PR $PKG_BUILD/libuuid/src/.libs/libuuid.so* $INSTALL/usr/lib
rm -rf $INSTALL/usr/lib/libuuid.so*T
if [ "$SWAP_SUPPORT" = "yes" ]; then
mkdir -p $INSTALL/usr/bin
cp $PKG_BUILD/sys-utils/.libs/swapon $INSTALL/usr/bin
ln -sf swapon $INSTALL/usr/bin/swapoff
mkdir -p $INSTALL/etc/init.d
cp $PKG_DIR/scripts/32_swapfile $INSTALL/etc/init.d
mkdir -p $INSTALL/etc
cat $PKG_DIR/config/swap.conf | sed -e "s,@SWAPFILESIZE@,$SWAPFILESIZE,g" > $INSTALL/etc/swap.conf
fi

View File

@ -1,6 +1,6 @@
################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv
# http://www.openelec.tv
# This file is part of OpenELEC - http://www.openelec.tv
# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv)
#
# This Program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -23,16 +23,20 @@
#
# runlevels: openelec, textmode
(
INSTALLED_MEMORY=`cat /proc/meminfo | grep 'MemTotal:' | awk '{print $2}'`
SWAP=`blkid -t TYPE="swap" -o device`
SWAPFILE="$HOME/.cache/swapfile"
. /etc/swap.conf
if [ -f $HOME/.config/swap.conf ]; then
. $HOME/.config/swap.conf
fi
(
if [ -e /proc/swaps ]; then
SWAP=`blkid -t TYPE="swap" -o device`
if [ "$INSTALLED_MEMORY" -le "500000" ]; then
if [ -z "$SWAP" -a ! -f "$SWAPFILE" ]; then
progress "creating swapfile"
mkdir -p $HOME/.cache
dd if=/dev/zero of=$SWAPFILE bs=1024 count=262144 2>&1 > /dev/null
mkdir -p `dirname $SWAPFILE`
dd if=/dev/zero of=$SWAPFILE bs=1024 count=$SWAPFILESIZE 2>&1 > /dev/null
mkswap $SWAPFILE 2>&1 > /dev/null
fi

View File

@ -267,7 +267,7 @@
# build and install CEC adapter support (yes / no)
CEC_SUPPORT="yes"
# build and install iSCSI support - iscsistart (yes / no)
ISCSI_SUPPORT="yes"
@ -298,6 +298,12 @@
# build with lm_sensors hardware monitoring support (yes / no)
SENSOR_SUPPORT="yes"
# build with swap support (yes / no)
SWAP_SUPPORT="yes"
# swapfile size if SWAP_SUPPORT=yes in kB (example: 262144 = 256MB )
SWAPFILESIZE="262144"
# build with automatic update support (yes / no)
UPDATE_SUPPORT="yes"

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.16 Kernel Configuration
# Linux/i386 3.2.17 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -71,7 +71,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -428,6 +428,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.2.16 Kernel Configuration
# Linux/x86_64 3.2.17 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@ -73,7 +73,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -397,6 +397,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -297,6 +297,12 @@
# build with lm_sensors hardware monitoring support (yes / no)
SENSOR_SUPPORT="yes"
# build with swap support (yes / no)
SWAP_SUPPORT="no"
# swapfile size if SWAP_SUPPORT=yes in kB (example: 262144 = 256MB )
SWAPFILESIZE="262144"
# build with automatic update support (yes / no)
UPDATE_SUPPORT="yes"

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.16 Kernel Configuration
# Linux/i386 3.2.17 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -71,7 +71,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -430,6 +430,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -297,6 +297,12 @@
# build with lm_sensors hardware monitoring support (yes / no)
SENSOR_SUPPORT="yes"
# build with swap support (yes / no)
SWAP_SUPPORT="no"
# swapfile size if SWAP_SUPPORT=yes in kB (example: 262144 = 256MB )
SWAPFILESIZE="262144"
# build with automatic update support (yes / no)
UPDATE_SUPPORT="yes"

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.16 Kernel Configuration
# Linux/i386 3.2.17 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -71,7 +71,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -430,6 +430,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -297,6 +297,12 @@
# build with lm_sensors hardware monitoring support (yes / no)
SENSOR_SUPPORT="yes"
# build with swap support (yes / no)
SWAP_SUPPORT="no"
# swapfile size if SWAP_SUPPORT=yes in kB (example: 262144 = 256MB )
SWAPFILESIZE="262144"
# build with automatic update support (yes / no)
UPDATE_SUPPORT="yes"

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.16 Kernel Configuration
# Linux/i386 3.2.17 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -71,7 +71,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -425,6 +425,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.2.16 Kernel Configuration
# Linux/x86_64 3.2.17 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@ -73,7 +73,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -389,6 +389,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -297,6 +297,12 @@
# build with lm_sensors hardware monitoring support (yes / no)
SENSOR_SUPPORT="yes"
# build with swap support (yes / no)
SWAP_SUPPORT="no"
# swapfile size if SWAP_SUPPORT=yes in kB (example: 262144 = 256MB )
SWAPFILESIZE="262144"
# build with automatic update support (yes / no)
UPDATE_SUPPORT="yes"

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.16 Kernel Configuration
# Linux/i386 3.2.17 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -71,7 +71,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -426,6 +426,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.2.16 Kernel Configuration
# Linux/x86_64 3.2.17 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@ -73,7 +73,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -391,6 +391,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -297,6 +297,12 @@
# build with lm_sensors hardware monitoring support (yes / no)
SENSOR_SUPPORT="yes"
# build with swap support (yes / no)
SWAP_SUPPORT="no"
# swapfile size if SWAP_SUPPORT=yes in kB (example: 262144 = 256MB )
SWAPFILESIZE="262144"
# build with automatic update support (yes / no)
UPDATE_SUPPORT="yes"

View File

@ -301,6 +301,12 @@
# build with lm_sensors hardware monitoring support (yes / no)
SENSOR_SUPPORT="yes"
# build with swap support (yes / no)
SWAP_SUPPORT="no"
# swapfile size if SWAP_SUPPORT=yes in kB (example: 262144 = 256MB )
SWAPFILESIZE="262144"
# build with automatic update support (yes / no)
UPDATE_SUPPORT="yes"

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.2.15 Kernel Configuration
# Linux/x86_64 3.2.17 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@ -73,7 +73,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -389,6 +389,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -297,6 +297,12 @@
# build with lm_sensors hardware monitoring support (yes / no)
SENSOR_SUPPORT="yes"
# build with swap support (yes / no)
SWAP_SUPPORT="no"
# swapfile size if SWAP_SUPPORT=yes in kB (example: 262144 = 256MB )
SWAPFILESIZE="262144"
# build with automatic update support (yes / no)
UPDATE_SUPPORT="yes"

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/i386 3.2.16 Kernel Configuration
# Linux/i386 3.2.17 Kernel Configuration
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@ -71,7 +71,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -424,6 +424,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -1,6 +1,6 @@
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86_64 3.2.16 Kernel Configuration
# Linux/x86_64 3.2.17 Kernel Configuration
#
CONFIG_64BIT=y
# CONFIG_X86_32 is not set
@ -73,7 +73,7 @@ CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_XZ=y
# CONFIG_KERNEL_LZO is not set
CONFIG_DEFAULT_HOSTNAME="openelec"
# CONFIG_SWAP is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
@ -388,6 +388,7 @@ CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
#
CONFIG_SUSPEND=y
CONFIG_SUSPEND_FREEZER=y
# CONFIG_HIBERNATION is not set
CONFIG_PM_SLEEP=y
CONFIG_PM_SLEEP_SMP=y
CONFIG_PM_RUNTIME=y

View File

@ -293,6 +293,12 @@
# build with lm_sensors hardware monitoring support (yes / no)
SENSOR_SUPPORT="yes"
# build with swap support (yes / no)
SWAP_SUPPORT="no"
# swapfile size if SWAP_SUPPORT=yes in kB (example: 262144 = 256MB )
SWAPFILESIZE="262144"
# build with automatic update support (yes / no)
UPDATE_SUPPORT="yes"