summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@europa5.lan>2009-08-23 13:57:14 +0200
committerroot <root@europa5.lan>2009-08-23 13:57:14 +0200
commitda2f0620a3b4ca216e9e4457a3153eec92954142 (patch)
treea927957537929f2891ce8232179162876215136b
parent0b39b9c645046896610779dcef0fb6cc0ebe4022 (diff)
downloadminilinux-da2f0620a3b4ca216e9e4457a3153eec92954142.tar.gz
minilinux-da2f0620a3b4ca216e9e4457a3153eec92954142.tar.bz2
added acpid in user land with a simple script being able to to a ACPI powerbutton shutdown (needed for VirtualBox tests)
-rw-r--r--Makefile28
-rw-r--r--acpid-anything3
-rw-r--r--acpid-handler.sh68
-rw-r--r--kernel-config52
-rwxr-xr-xrcS3
5 files changed, 144 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 166a268..b01a6b7 100644
--- a/Makefile
+++ b/Makefile
@@ -46,14 +46,19 @@ qemu: clean step1 step2 step3 step4 step5 umount-root
step1:
+# step2: initial setup, image, directory layout, device inodes
step2: disk-image mount-root directory-layout initial-devices
+# step3: boot loader
step3: grub grub-loader
-#step4: kernel uclibc busybox
-step4: kernel busybox gpm
+# step4: kernel, uclibc C-library, busybox, basic tools, ACPI daemon
+step4: kernel busybox acpid
-step5: perl
+# step5: additional user space tools:
+# - GPM for mouse copy-pate
+# - Miniperl
+step5: gpm perl
# disk image and directories
@@ -185,6 +190,21 @@ gpm:
gpm-clean:
-rm -rf gpm-$(GPM_VERSION)
+acpid:
+ -rm -rf acpid-$(ACPID_VERSION)
+ -rm -rf target/etc/acpi
+ tar zxf tarballs/acpid-$(ACPID_VERSION).tar.gz
+ cd acpid-$(ACPID_VERSION) && make
+ cd acpid-$(ACPID_VERSION) && cp acpid ../target/usr/sbin/acpid
+ mkdir target/etc/acpi
+ mkdir target/etc/acpi/events
+ cp acpid-anything target/etc/acpi/events
+ cp acpid-handler.sh target/etc/acpi/handler.sh
+ chmod 775 target/etc/acpi/handler.sh
+
+acpid-clean:
+ -rm -rf acpid-$(ACPID_VERSION)
+
perl:
-rm -rf perl-$(PERL_VERSION)
tar zxf tarballs/perl-$(PERL_VERSION).tar.gz
@@ -212,7 +232,7 @@ umount-root:
# global clean
-clean: grub-clean uclibc-clean kernel-clean busybox-clean gpm-clean perl-clean
+clean: grub-clean uclibc-clean kernel-clean busybox-clean acpid-clean gpm-clean perl-clean
-umount target
-/sbin/losetup -d /dev/loop0
-rm minilinux.img
diff --git a/acpid-anything b/acpid-anything
new file mode 100644
index 0000000..d182898
--- /dev/null
+++ b/acpid-anything
@@ -0,0 +1,3 @@
+# Pass all events to our one handler script
+event=.*
+action=/etc/acpi/handler.sh %e
diff --git a/acpid-handler.sh b/acpid-handler.sh
new file mode 100644
index 0000000..4f3ee32
--- /dev/null
+++ b/acpid-handler.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# Default acpi script that takes an entry for all actions
+
+# NOTE: This is a 2.6-centric script. If you use 2.4.x, you'll have to
+# modify it to not use /sys
+
+minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
+maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
+setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
+
+set $*
+
+case "$1" in
+ button/power)
+ #echo "PowerButton pressed!">/dev/tty5
+ case "$2" in
+ PWRF)
+ logger "PowerButton pressed: $2"
+ poweroff
+ ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ button/sleep)
+ case "$2" in
+ SLPB) echo -n mem >/sys/power/state ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ ac_adapter)
+ case "$2" in
+ AC)
+ case "$4" in
+ 00000000)
+ echo -n $minspeed >$setspeed
+ #/etc/laptop-mode/laptop-mode start
+ ;;
+ 00000001)
+ echo -n $maxspeed >$setspeed
+ #/etc/laptop-mode/laptop-mode stop
+ ;;
+ esac
+ ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ battery)
+ case "$2" in
+ BAT0)
+ case "$4" in
+ 00000000) #echo "offline" >/dev/tty5
+ ;;
+ 00000001) #echo "online" >/dev/tty5
+ ;;
+ esac
+ ;;
+ CPU0)
+ ;;
+ *) logger "ACPI action undefined: $2" ;;
+ esac
+ ;;
+ button/lid)
+ #echo "LID switched!">/dev/tty5
+ ;;
+ *)
+ logger "ACPI group/action undefined: $1 / $2"
+ ;;
+esac
diff --git a/kernel-config b/kernel-config
index 141163e..2c7abc6 100644
--- a/kernel-config
+++ b/kernel-config
@@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28.7
-# Fri Mar 13 21:21:09 2009
+# Linux kernel version: 2.6.28.8
+# Sun Aug 23 09:57:59 2009
#
# CONFIG_64BIT is not set
CONFIG_X86_32=y
@@ -230,6 +230,7 @@ CONFIG_UNEVICTABLE_LRU=y
CONFIG_X86_RESERVE_LOW_64K=y
# CONFIG_MATH_EMULATION is not set
# CONFIG_MTRR is not set
+# CONFIG_EFI is not set
# CONFIG_SECCOMP is not set
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
@@ -246,7 +247,30 @@ CONFIG_PHYSICAL_ALIGN=0x100000
#
# Power management and ACPI options
#
-# CONFIG_PM is not set
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+# CONFIG_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
+CONFIG_ACPI=y
+# CONFIG_ACPI_PROCFS is not set
+CONFIG_ACPI_PROCFS_POWER=y
+CONFIG_ACPI_SYSFS_POWER=y
+CONFIG_ACPI_PROC_EVENT=y
+CONFIG_ACPI_AC=y
+CONFIG_ACPI_BATTERY=y
+CONFIG_ACPI_BUTTON=y
+CONFIG_ACPI_FAN=y
+CONFIG_ACPI_PROCESSOR=y
+CONFIG_ACPI_THERMAL=y
+# CONFIG_ACPI_ASUS is not set
+# CONFIG_ACPI_TOSHIBA is not set
+# CONFIG_ACPI_CUSTOM_DSDT is not set
+CONFIG_ACPI_BLACKLIST_YEAR=0
+# CONFIG_ACPI_DEBUG is not set
+# CONFIG_ACPI_PCI_SLOT is not set
+CONFIG_ACPI_SYSTEM=y
+CONFIG_X86_PM_TIMER=y
+# CONFIG_ACPI_SBS is not set
#
# CPU Frequency scaling
@@ -265,6 +289,7 @@ CONFIG_PCI=y
CONFIG_PCI_GOANY=y
CONFIG_PCI_BIOS=y
CONFIG_PCI_DIRECT=y
+CONFIG_PCI_MMCONFIG=y
CONFIG_PCI_DOMAINS=y
# CONFIG_PCIEPORTBUS is not set
# CONFIG_ARCH_SUPPORTS_MSI is not set
@@ -361,6 +386,13 @@ CONFIG_EXTRA_FIRMWARE=""
# CONFIG_CONNECTOR is not set
# CONFIG_MTD is not set
# CONFIG_PARPORT is not set
+CONFIG_PNP=y
+CONFIG_PNP_DEBUG_MESSAGES=y
+
+#
+# Protocols
+#
+CONFIG_PNPACPI=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_FD=y
# CONFIG_BLK_CPQ_DA is not set
@@ -389,6 +421,7 @@ CONFIG_IDE_GD_ATA=y
CONFIG_BLK_DEV_IDECD=y
CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
# CONFIG_BLK_DEV_IDETAPE is not set
+# CONFIG_BLK_DEV_IDEACPI is not set
# CONFIG_IDE_TASK_IOCTL is not set
CONFIG_IDE_PROC_FS=y
@@ -398,6 +431,7 @@ CONFIG_IDE_PROC_FS=y
# CONFIG_IDE_GENERIC is not set
# CONFIG_BLK_DEV_PLATFORM is not set
# CONFIG_BLK_DEV_CMD640 is not set
+# CONFIG_BLK_DEV_IDEPNP is not set
CONFIG_BLK_DEV_IDEDMA_SFF=y
#
@@ -462,6 +496,7 @@ CONFIG_NETDEVICES=y
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# CONFIG_VETH is not set
+# CONFIG_NET_SB1000 is not set
# CONFIG_ARCNET is not set
# CONFIG_PHYLIB is not set
CONFIG_NET_ETHERNET=y
@@ -600,6 +635,7 @@ CONFIG_SERIAL_8250=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_PNP=y
CONFIG_SERIAL_8250_NR_UARTS=4
CONFIG_SERIAL_8250_RUNTIME_UARTS=1
# CONFIG_SERIAL_8250_EXTENDED is not set
@@ -623,6 +659,7 @@ CONFIG_RTC=y
# CONFIG_NSC_GPIO is not set
# CONFIG_CS5535_GPIO is not set
# CONFIG_RAW_DRIVER is not set
+# CONFIG_HPET is not set
# CONFIG_HANGCHECK_TIMER is not set
CONFIG_DEVPORT=y
# CONFIG_I2C is not set
@@ -630,10 +667,12 @@ CONFIG_DEVPORT=y
CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
# CONFIG_GPIOLIB is not set
# CONFIG_W1 is not set
-# CONFIG_POWER_SUPPLY is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_BATTERY_DS2760 is not set
# CONFIG_HWMON is not set
-# CONFIG_THERMAL is not set
-# CONFIG_THERMAL_HWMON is not set
+CONFIG_THERMAL=y
# CONFIG_WATCHDOG is not set
CONFIG_SSB_POSSIBLE=y
@@ -704,6 +743,7 @@ CONFIG_USB=y
# CONFIG_USB_DEVICEFS is not set
# CONFIG_USB_DEVICE_CLASS is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_SUSPEND is not set
# CONFIG_USB_MON is not set
# CONFIG_USB_WUSB_CBAF is not set
diff --git a/rcS b/rcS
index 95ae97c..cb83e5e 100755
--- a/rcS
+++ b/rcS
@@ -17,6 +17,9 @@ syslogd
echo "Starting kernel logger.."
klogd
+echo "Starting ACPI daemon.."
+/usr/sbin/acpid -l
+
echo "Starting mouse on console.."
/usr/sbin/gpm -m /dev/psaux -t ps2