From 8fd2995f3081679651dd18ce947bf7d743724d74 Mon Sep 17 00:00:00 2001 From: Jose V Beneyto Date: Thu, 21 Jul 2011 01:58:47 +0200 Subject: [PATCH] Added simple.script for udhcp. Added support for having dialog compiled as static binary and terminfo files to avoid problems with the dialog curses and TERM variable. Adde some improvements to Makefile. --- Makefile | 69 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 55fca4c..0442920 100644 --- a/Makefile +++ b/Makefile @@ -2,51 +2,58 @@ # initrd.git/Makefile # +TOPDIR = $(shell pwd) + +include $(TOPDIR)/../toolchain/vars.mk + TARGET = arm-crux-linux-gnueabi DEVICE = versatile -TOPDIR = $(shell pwd) WORK = $(TOPDIR)/work CLFS = $(TOPDIR)/../toolchain/clfs CROSSTOOLS = $(TOPDIR)/../toolchain/crosstools - KERNEL_PATH = $(TOPDIR)/../kernel/$(DEVICE) KERNEL_VERSION = $(shell grep '^KERNEL_VERSION = ' $(KERNEL_PATH)/Makefile | sed 's|KERNEL_VERSION = ||') -BUSYBOX_SOURCE = http://busybox.net/downloads/busybox-$(BUSYBOX_VERSION).tar.bz2 BUSYBOX_VERSION = 1.18.4 +BUSYBOX_SOURCE = http://busybox.net/downloads/busybox-$(BUSYBOX_VERSION).tar.bz2 + +DIALOG_VERSION = 1.1-20100119 +DIALOG_SOURCE = ftp://dickey.his.com/dialog/dialog-$(DIALOG_VERSION).tgz -.PHONY: all check-root busybox initrd clean distclean +.PHONY: all check-root busybox dialog initrd clean distclean -all: busybox initrd +all: initrd -clean: busybox-clean initrd-clean +clean: busybox-clean dialog-clean initrd-clean -dist-clean: busybox-distclean initrd-distclean +dist-clean: busybox-distclean dialog-distclean initrd-distclean check-root: @if [ "$$UID" != "0" ]; then \ echo "You need to be root to do this."; \ - echo "Now you should run 'make initrd' as root to finish compilation or 'sudo make initrd'."; \ + echo "Now you should run 'make initrd' as root to finish compilation or 'sudo make initrd'."; \ exit 1; \ fi $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2: - wget -P $(WORK) -c http://busybox.net/downloads/busybox-$(BUSYBOX_VERSION).tar.bz2 + wget -P $(WORK) -c $(BUSYBOX_SOURCE) $(WORK)/busybox-$(BUSYBOX_VERSION): $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2 $(TOPDIR)/busybox-$(BUSYBOX_VERSION).config tar -C $(WORK) -xvjf $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2 cp -v $(TOPDIR)/busybox-$(BUSYBOX_VERSION).config $(WORK)/busybox-$(BUSYBOX_VERSION)/.config touch $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2 -$(WORK)/busybox-$(BUSYBOX_VERSION)/_install: $(WORK)/busybox-$(BUSYBOX_VERSION) +$(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox: $(WORK)/busybox-$(BUSYBOX_VERSION) export PATH=$(CROSSTOOLS)/bin:$$PATH && \ export LD_LIBRARY_PATH=$(CROSSTOOLS)/lib:$$LD_LIBRARY_PATH && \ - make -C $(WORK)/busybox-$(BUSYBOX_VERSION) ARCH=arm CROSS_COMPILE=$(TARGET)- install - touch $(WORK)/busybox-$(BUSYBOX_VERSION)/_install + make -C $(WORK)/busybox-$(BUSYBOX_VERSION) ARCH=arm CROSS_COMPILE=$(TARGET)- install && \ + install -D -m 0755 $(WORK)/busybox-$(BUSYBOX_VERSION)/examples/udhcp/simple.script $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/usr/share/udhcpc/default.script && \ + $(TARGET)-strip $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox && \ + touch $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox -busybox: $(WORK)/busybox-$(BUSYBOX_VERSION)/_install +busybox: $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/bin/busybox busybox-clean: rm -vrf $(WORK)/busybox-$(BUSYBOX_VERSION) @@ -54,19 +61,49 @@ busybox-clean: busybox-distclean: rm -vf $(WORK)/busybox-$(BUSYBOX_VERSION).tar.bz2 +$(WORK)/dialog-$(DIALOG_VERSION).tgz: + wget -P $(WORK) -c $(DIALOG_SOURCE) + +$(WORK)/dialog-$(DIALOG_VERSION): $(WORK)/dialog-$(DIALOG_VERSION).tgz + tar -C $(WORK) -xvzf $(WORK)/dialog-$(DIALOG_VERSION).tgz + touch $(WORK)/dialog-$(DIALOG_VERSION) + +$(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog: $(WORK)/dialog-$(DIALOG_VERSION) + export PATH=$(CROSSTOOLS)/bin:$$PATH && \ + export LD_LIBRARY_PATH=$(CROSSTOOLS)/lib:$$LD_LIBRARY_PATH && \ + cd $(WORK)/dialog-$(DIALOG_VERSION) && \ + ./configure --build=$(BUILD) --host=$(TARGET) --prefix=/usr --with-ncursesw && \ + find -type f -name 'makefile' \ + -exec sed -e "s|-I/usr|-I$(CLFS)/usr|g" -e "s|-L/usr|-L$(CLFS)/usr|g" -i {} \; && \ + make CC="$(TARGET)-gcc -static" && \ + make DESTDIR=$(WORK)/dialog-$(DIALOG_VERSION)/_install install && \ + $(TARGET)-strip $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog && \ + touch $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog + +dialog: $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog + +dialog-clean: + rm -vrf $(WORK)/dialog-$(DIALOG_VERSION) + +dialog-distclean: + rm -rf $(WORK)/dialog-$(DIALOG_VERSION).tgz + $(WORK)/mnt: mkdir -p $(WORK)/mnt -$(WORK)/initrd-$(KERNEL_VERSION).gz: check-root busybox $(KERNEL_PATH) $(WORK)/mnt $(TOPDIR)/filesystem $(TOPDIR)/mkinitrd.sh +$(WORK)/initrd-$(KERNEL_VERSION).gz: check-root busybox dialog $(KERNEL_PATH) $(WORK)/mnt $(TOPDIR)/filesystem $(TOPDIR)/mkinitrd.sh sh mkinitrd.sh --name=$(WORK)/initrd-$(KERNEL_VERSION).gz --size=4096 cd $(WORK) && gunzip -v initrd-$(KERNEL_VERSION).gz mount -v -t ext2 -o loop,rw $(WORK)/initrd-$(KERNEL_VERSION) $(WORK)/mnt cp -dRv $(WORK)/busybox-$(BUSYBOX_VERSION)/_install/* $(WORK)/mnt + install -v -m 0755 $(WORK)/dialog-$(DIALOG_VERSION)/_install/usr/bin/dialog $(WORK)/mnt/usr/bin #make -C $(KERNEL_PATH)/work/linux-$(KERNEL_VERSION) ARCH=arm INSTALL_MOD_PATH=$(WORK)/mnt modules_install - cp -dRv $(CLFS)/lib/libnss_{files*,dns*} $(CLFS)/lib/libresolv* $(WORK)/mnt/lib + cp -dRv $(CLFS)/lib/libnss_{files*,dns*} $(CLFS)/lib/libresolv* $(WORK)/mnt/lib + install -d $(WORK)/mnt/usr/share/terminfo + cp -dRv $(CLFS)/usr/share/terminfo/v $(WORK)/mnt/usr/share/terminfo install -v -m 0644 $(TOPDIR)/filesystem/{fstab,inittab,profile,protocols,*.conf} $(WORK)/mnt/etc install -v -m 0755 $(TOPDIR)/filesystem/rc $(WORK)/mnt/etc && \ - install -v -m 0755 $(TOPDIR)/filesystem/crux $(WORK)/mnt/usr/bin && \ + install -v -m 0755 $(TOPDIR)/filesystem/{crux,setup*} $(WORK)/mnt/usr/bin && \ /sbin/ldconfig -r $(WORK)/mnt umount -v $(WORK)/mnt cd $(WORK) && gzip -v initrd-$(KERNEL_VERSION) -- 2.26.2