root/floppyfw-3.0/makefiles/initrd.mk

Revision 97, 3.4 KB (checked in by root, 6 years ago)

Two quick patches from Tosing on floppyfw.devel

Line 
1############################
2#
3# initrd, building the initrd.sq file.
4#
5# this is a bit special than most other .mk files since it will always
6# build the file, regardeless the exsistence of a initrd.sq file.
7#
8# The reasons are that we don't know which type of initrd.sq file we have,
9# we do make two of'em here already (IDE and basic) and since the building
10# of the images, initrd.sq and add.bz2 are separate from the rest, you never
11# really know when to build or not.
12#
13# So, this is being on the safe side.
14#
15##########################
16
17TMP_MNT=$(TMP_DIR)/mnt
18TMP_INITRD=$(TMP_DIR)/initrd
19
20initrd-base: $(INITRD_MASTER)
21        -[ -d $(TMP_MNT) ] && $(RM) -r $(TMP_MNT)
22        -[ -f $(TMP_INITRD) ] && $(RM) $(TMP_INITRD)
23
24        mkdir $(TMP_MNT)
25        # mount -t minix -o loop $(TMP_INITRD) $(TMP_MNT)
26        cp -a $(INITRD_MASTER)/* $(TMP_MNT)/.
27        cp -a $(SCRIPTS_DIR)/linuxrc $(TMP_MNT)/.
28        $(SED) 's/FLOPPYFW_VERSION/$(FLOPPYFW_VERSION)/' $(TMP_MNT)/linuxrc
29               
30        cp -a $(SCRIPTS_DIR)/rc.initrd $(TMP_MNT)/etc/.
31        cp -a $(SCRIPTS_DIR)/functions.inc $(TMP_MNT)/etc/.
32        cp -a $(SCRIPTS_DIR)/inittab $(TMP_MNT)/etc/.
33        cp -a $(SCRIPTS_DIR)/inittab.serial $(TMP_MNT)/etc/.
34        chown -R root.root $(TMP_MNT)
35       
36        (cd $(TMP_MNT)/dev ; \
37                mknod -m 600 console c 5 1; \
38                mknod -m 600 tty0 c 4 0; \
39                mknod -m 600 tty1 c 4 1; \
40                mknod -m 660 ram0 b 1 0; \
41        );
42        mksquashfs-lzma $(TMP_MNT) $(TMP_INITRD).sq -all-root -noappend -nopad
43
44        mv $(TMP_INITRD).sq $(INITRD_DIR)/initrd.sq
45
46
47# I wish I didn't have to repeat the whole thing here:
48# This has a dependancy of idemods (which could trigger quite alot) but
49# idemods.ffw are the whole point of this.
50initrd-ide: $(INITRD_MASTER) $(MODULES_BASE_DIR)/idemods.ffw $(MODULES_BASE_DIR)/usbmods.ffw
51        -[ -d $(TMP_MNT) ] && $(RM) -r $(TMP_MNT)
52        -[ -f $(TMP_INITRD) ] && $(RM) $(TMP_INITRD)
53
54        mkdir $(TMP_MNT)
55        cp -a $(INITRD_MASTER)/* $(TMP_MNT)/.
56        cp -a $(SCRIPTS_DIR)/linuxrc $(TMP_MNT)/.
57        $(SED) 's/FLOPPYFW_VERSION/$(FLOPPYFW_VERSION)/' $(TMP_MNT)/linuxrc
58        cp -a $(SCRIPTS_DIR)/rc.initrd $(TMP_MNT)/etc/.
59        cp -a $(SCRIPTS_DIR)/functions.inc $(TMP_MNT)/etc/.
60        cp -a $(SCRIPTS_DIR)/inittab $(TMP_MNT)/etc/.
61        cp -a $(SCRIPTS_DIR)/inittab.serial $(TMP_MNT)/etc/.
62
63        $(LZMAD) $(MODULES_BASE_DIR)/idemods.ffw | \
64                tar -C $(TMP_MNT) $(TAR_VERBOSE) -xf -
65        $(LZMAD) $(MODULES_BASE_DIR)/usbmods.ffw | \
66                tar -C $(TMP_MNT) $(TAR_VERBOSE) -xf -
67
68        (cd $(TMP_MNT)/dev ; \
69                mknod -m 600 console c 5 1; \
70                mknod -m 600 tty0 c 4 0; \
71                mknod -m 600 tty1 c 4 1; \
72                mknod -m 660 ram0 b 1 0; \
73        );
74        mksquashfs-lzma $(TMP_MNT) $(TMP_INITRD).sq -all-root -noappend -nopad
75        mv $(TMP_INITRD).sq $(INITRD_DIR)/initrd.sq
76
77
78initrd-livekit: $(INITRD_MASTER)
79        -[ -d $(TMP_MNT) ] && $(RM) -r $(TMP_MNT)
80        -[ -f $(TMP_INITRD) ] && $(RM) $(TMP_INITRD)
81
82        mkdir $(TMP_MNT)
83        cp -a $(INITRD_MASTER)/* $(TMP_MNT)/.
84        cp -a $(BASE_DIR)/devkitstuff/linuxrc $(TMP_MNT)/.
85        $(SED) 's/FLOPPYFW_VERSION/$(FLOPPYFW_VERSION)/' $(TMP_MNT)/linuxrc
86
87        # I probably don't need these.
88        # $(LZMAD) $(MODULES_BASE_DIR)/idemods.ffw | \
89        #       tar -C $(TMP_MNT) $(TAR_VERBOSE) -xf -
90        # $(LZMAD) $(MODULES_BASE_DIR)/usbmods.ffw | \
91        #       tar -C $(TMP_MNT) $(TAR_VERBOSE) -xf -
92
93        cp -a /dev/* $(TMP_MNT)/dev/.
94        # Since I don't use squashfs on the devkit kernel, I'll do this the
95        # old fashioned way.
96        $(BASE_DIR)/devkitstuff/mkinitrd $(TMP_MNT)
97
98
99initrd-clean:
100        -$(RM) $(INITRD_DIR)/initrd.sq
101        -$(RM) $(BASE_DIR)/floppy/initrd.sq
102
103initrd-dirclean:
104        -$(RM) $(INITRD_DIR)/initrd.sq
105        -$(RM) -r $(INITRD_MASTER)
106       
Note: See TracBrowser for help on using the browser.