summaryrefslogtreecommitdiffstats
path: root/rules/bootdisk.make
blob: dbea21e83c5c424b1d8b297e554528a0a3dff67b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# -*-makefile-*- 
# $Id: bootdisk.make,v 1.11 2003/10/23 15:01:19 mkl Exp $
#
# Copyright (C) 2002 by Pengutronix e.K., Hildesheim, Germany
# See CREDITS for details about who has contributed to this project. 
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
ifeq (y, $(PTXCONF_GRUB_BOOTDISK))
PACKAGES += bootdisk
endif

#
# Paths and names 
#

BOOTDISK			= rayonic-bootdisk-20030808-2
BOOTDISK_SOURCE			= $(SRCDIR)/$(BOOTDISK).tar.gz
BOOTDISK_URL			= http://www.pengutronix.de/software/ptxdist/temporary-src/$(BOOTDISK).tar.gz
BOOTDISK_DIR			= $(BUILDDIR)/$(BOOTDISK)
BOOTDISK_EXTRACT		= gzip -dc

# ----------------------------------------------------------------------------
# Get
# ----------------------------------------------------------------------------

bootdisk_get: $(STATEDIR)/bootdisk.get

$(STATEDIR)/bootdisk.get: $(BOOTDISK_SOURCE)
	@$(call targetinfo, $@)
	touch $@

$(BOOTDISK_SOURCE):
	@$(call targetinfo, $@)
	@$(call get, $(BOOTDISK_URL))

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

bootdisk_extract: $(STATEDIR)/bootdisk.extract

$(STATEDIR)/bootdisk.extract: $(STATEDIR)/bootdisk.get
	@$(call targetinfo, $@)
	@$(call clean, $(BOOTDISK_DIR))
	@$(call extract, $(BOOTDISK_SOURCE))
	touch $@

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

bootdisk_prepare: $(STATEDIR)/bootdisk.prepare

$(STATEDIR)/bootdisk.prepare: $(STATEDIR)/bootdisk.extract
	@$(call targetinfo, $@)
	touch $@

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

bootdisk_compile: $(STATEDIR)/bootdisk.compile

$(STATEDIR)/bootdisk.compile: $(STATEDIR)/bootdisk.prepare 
	@$(call targetinfo, $@)
	touch $@

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

bootdisk_install: $(STATEDIR)/bootdisk.install

$(STATEDIR)/bootdisk.install: $(STATEDIR)/bootdisk.compile
	@$(call targetinfo, $@)
	touch $@

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

bootdisk_targetinstall: $(STATEDIR)/bootdisk.targetinstall

bootdisk_targetinstall_deps =  $(STATEDIR)/bootdisk.install
bootdisk_targetinstall_deps += $(STATEDIR)/kernel.compile
bootdisk_targetinstall_deps += $(STATEDIR)/grub.compile
bootdisk_targetinstall_deps += $(STATEDIR)/e2fsprogs.compile
bootdisk_targetinstall_deps += $(STATEDIR)/ncurses.compile

$(STATEDIR)/bootdisk.targetinstall: $(bootdisk_targetinstall_deps)
	@$(call targetinfo, $@)
	install $(KERNEL_TARGET_PATH) $(BOOTDISK_DIR)/boot/
	install $(GRUB_DIR)/stage1/stage1 $(BOOTDISK_DIR)/boot/grub/
	install $(GRUB_DIR)/stage2/stage2 $(BOOTDISK_DIR)/boot/grub/
	install $(GRUB_DIR)/grub/grub $(BOOTDISK_DIR)/bin/
	$(CROSSSTRIP) -R .note -R .comment $(BOOTDISK_DIR)/bin/grub
	# FIXME: make this a config option
	ln -sf menu-disk.lst $(BOOTDISK_DIR)/boot/grub/menu.lst
	ln -sf menu.lst $(BOOTDISK_DIR)/boot/grub/grub.conf
	install $(E2FSPROGS_DIR)/misc/mke2fs $(BOOTDISK_DIR)/bin/
	$(CROSSSTRIP) -R .note -R .comment $(BOOTDISK_DIR)/bin/mke2fs
	install $(NCURSES_DIR)/lib/libncurses.so.5.2 $(BOOTDISK_DIR)/lib/
	$(CROSSSTRIP) -S -R .note -R .comment $(BOOTDISK_DIR)/lib/libncurses.so.5.2
	# FIXME: is this the correct file for this rule? 
	install $(SRCDIR)/ptxflash $(BOOTDISK_DIR)/sbin/
	rm -fr $(BUILDDIR)/tmpboot && install -d $(BUILDDIR)/tmpboot
	cd $(BOOTDISK_DIR) && tar cf $(BUILDDIR)/tmpboot/bootdisk.tar *
	$(SUDO) sh -c \
		"GRUBPATH=$(BOOTDISK_DIR)/bin/; $(BOOTDISK_DIR)/sbin/mkbimage -d $(BUILDDIR)/tmpboot -f $(BUILDDIR)/tmpboot/bootdisk.tar -s ext2 -t 1.44"
	mv $(BUILDDIR)/tmpboot/1.44.image $(TOPDIR)/boot.image
	$(SUDO) rm -rf $(BUILDDIR)/tmpboot
	touch $@

# ----------------------------------------------------------------------------
# Clean
# ----------------------------------------------------------------------------

bootdisk_clean: 
	rm -rf $(STATEDIR)/bootdisk.* $(BOOTDISK_DIR)

# vim: syntax=make