diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2011-01-01 23:00:49 +0100 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2011-01-01 23:00:49 +0100 |
commit | 3b8ad1593a12bef4e3e2d9ab240b0fba16093199 (patch) | |
tree | db6aea1713444decc7ada448a0d01cb7ad501b3b /Makefile | |
download | initramdisk-3b8ad1593a12bef4e3e2d9ab240b0fba16093199.tar.gz initramdisk-3b8ad1593a12bef4e3e2d9ab240b0fba16093199.tar.xz initramdisk-3b8ad1593a12bef4e3e2d9ab240b0fba16093199.zip |
initial version
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..b17e9a7 --- /dev/null +++ b/Makefile @@ -0,0 +1,62 @@ +CONTENT=/sbin/lvm /sbin/vgchange /sbin/vgscan /bin/busybox init /dev/console etc/kmap-de +CONTENT-LINKS=bin/sh +CONTENT-MARKER=$(addprefix .root-done/,$(CONTENT)) +DATE=$(shell date +%F_%T) + +all: initramfs + +initramfs: initramfs.cpio + gzip > initramfs < initramfs.cpio + +initramfs.cpio: .root-done/.complete + cd root ;\ + find . | cpio -H newc -o > ../initramfs.cpio + +.root-done/.complete: $(CONTENT-MARKER) .root-done/.links + touch .root-done/.complete + +$(CONTENT-MARKER): .root-done/%: % + -ldd $* | cut -d" " -f 3 | while read i ; do \ + if [ -n "$$i" ]; then \ + mkdir -p $$(dirname $$i) ;\ + cp --parents $$i root/ ;\ + fi ;\ + done + + -ldd $* | grep -v "=>" | cut -f1 -d" " | while read i ; do \ + if [ -n "$$i" ]; then \ + mkdir -p $$(dirname $$i) ;\ + cp --parents $$i root/ ;\ + fi ;\ + done + + mkdir -p $(shell dirname $*) + cp -a --parents $* root/ + + mkdir -p $(dir .root-done/$*) + touch .root-done/$* + +.root-done/.links: Makefile + for i in $(CONTENT-LINKS) ; do \ + mkdir -p $$(dirname $$i) ;\ + cp -a --parents $$i root/ ;\ + done + + touch .root-done/.static + +$(CONTENT-MARKER): Makefile + +clean: + ${RM} initramfs initramfs.cpio + ${RM} -r root/* + ${RM} -r .root-done/ + +install: + if [ ! -d "/boot/grub" ]; then \ + mount /boot ;\ + fi + + if [ -r /boot/initramfs ]; then \ + mv /boot/initramfs /boot/initramfs-$(DATE) ;\ + fi + cp initramfs /boot/initramfs |