forked from clawplach/crosslinux
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcl-bt.in
740 lines (674 loc) · 23.9 KB
/
cl-bt.in
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
#!@@CL_MAKE@@ -rf
# vim: syntax=make
# This file is part of the crosslinux software.
# The license which this software falls under is GPLv2 as follows:
#
# Inspired by ct-ng.in from crosstool-NG
# (C) 2013-2013 Douglas Jerome <[email protected]>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
# *****************************************************************************
#
# FILE DESCRIPTION
#
# This is the makefile used in making a crosslinux distribution.
#
# Conventions
#
# Although the needed programs are known to exists, because
# ./configure has successfully created this Makefile, use variables
# such as $(install) for most all programs. The reasons for this
# are:
# 1) the path to the program may be unusual and ./configure has
# found the path
# 2) to use the variables as they are set by ./configure, so when a
# variable doesn't work then a needed program is found that is
# not checked by ./configure.
# The exceptions are the basic programs that a Linux system needs to
# work, such as rm, rmdir, ls, cat, etc. For any other programs
# that could be not yet installed, or in an unusual path, use the
# variables.
#
# CHANGE LOG
#
# 2013-06-14 drj File creation.
#
# *****************************************************************************
# *************************************************************************** #
# Configuration Variables from ./configure #
# *************************************************************************** #
export DATE := @@CL_DATE@@
export LOCAL := @@CL_LOCAL@@
export PROGRAM_NAME := @@CL_PROG_NAME@@
export PACKAGE_VERSION := @@CL_VERSION@@
export grep := @@CL_GREP@@
export sed := @@CL_SED@@
export bindir := @@CL_BINDIR@@
export libdir := @@CL_LIBDIR@@
export docdir := @@CL_DOCDIR@@
export mandir := @@CL_MANDIR@@
# *************************************************************************** #
# cl-bt Make Variables and Make Environment #
# *************************************************************************** #
# This top level cannot run parallel jobs.
#
.NOTPARALLEL:
# Do not print directories as descend into or ascended from.
#
ifeq ($(filter --no-print-directory,$(MAKEFLAGS)),)
MAKEFLAGS += --no-print-directory
endif
# -- Single-Package Support
#
PACKAGE=""
# -- Second level argument; see how it is used in the 'clean' targets.
#
CMD_PARAM=""
# -- Sanity
#
SHELL=@@CL_BASH@@
BLDDIRS=build/{bld,log,run} dload mnt sysroot target/{image,kpkgs,kroot,loader,pkgbin}
# 'GREP_OPTIONS=--color=always' breaks the generated .in files, so clear it.
#
export GREP_OPTIONS=
# *************************************************************************** #
# Make Targets #
# *************************************************************************** #
# -----------------------------------------------------------------------------
# -- Default Target
# -----------------------------------------------------------------------------
.PHONY: help
help:
@echo "crosslinux-buildtool ${PROGRAM_NAME}-@@CL_VERSION@@"
@echo ""
@echo "Copyright (C) 2013-2013 Douglas Jerome <[email protected]>"
@echo "This is free software; see the source for copying conditions."
@echo "There is NO warranty; not even for MERCHANTABILITY or FITNESS"
@echo "FOR A PARTICULAR PURPOSE."
@echo ""
@echo "crosslinux Build Tool System Targets:"
@echo "bt-init - initialize the build tool system -- do this once"
@echo " before building"
@echo "bt-reinit - remove the build tool system, then initialize"
@echo "bt-done - remove the build tool system"
@echo "bt-showcfg - show the configuration of the crosslinux build tool"
@echo "bt-showman - show the crosslinux build tool man page"
@echo ""
@echo "Housekeeping Targets:"
@echo "getcfg - get a default build config file"
@echo "config - make or change the build config file"
@echo "menuconfig - make or change the build config file"
@echo "nconfig - make or change the build config file"
@echo "ldrlist - make list of loader packages from config file"
@echo "pkglist - make list of source packages using the config file"
@echo "dload - download source packages; do this after menuconfig"
@echo ""
@echo "Build Targets:"
@echo "dist - do the entire build"
@echo "stat - report the status of the build process"
@echo "clean - remove the entire build"
@echo "kclean - remove the kernel build"
@echo "lclean - remove the loader build"
@echo "pclean - remove the packages build"
@echo "pkgs - build the packages listed in the build config file"
@echo "pkgs_ - continue building the packages"
@echo "loader - build the target loader; do this before kernel"
@echo "kernel - build the target kernel"
@echo "rootfs - build root file system: initrd or initramfs or tarball"
@echo "bootfs - build bootable staging directory: iso9660 or tarball"
@echo "bootimg - build bootable file system image: iso9660 or tarball"
@echo ""
# -----------------------------------------------------------------------------
# -- Build Tool System Targets
# -----------------------------------------------------------------------------
.PHONY: bt-init bt-done bt-reinit bt-showcfg bt-man
.bt-init bt-init:
@echo "i> Initialize for building."
@echo "i> Making build directories."
@for d in $(BLDDIRS); do \
echo "=> making $${d}/"; \
mkdir --parents $${d}; \
done
@mkdir --mode=0700 --parents bin-link/
@echo "=> making bin-link/"
@$(libdir)/scripts/bt-init.sh # See note [1] below.
@rm --force .bt-init
@date >.bt-init
#
# [1] - The script is not called in a subshell; on error the following lines in
# the rule are not executed purposely, and make aborts.
bt-done:
@echo "i> Removing build directories."
@for d in $(BLDDIRS); do \
if [[ -d $${d%%/*} ]]; then \
echo "=> removing $${d%%/*}/"; \
rm --force --recursive $${d%%/*}; \
fi \
done
@rm --force --recursive bin-link
@rm --force --recursive .bt-init
bt-reinit: bt-done bt-init
bt-showcfg:
@echo ""
@echo "${PROGRAM_NAME}-$(PACKAGE_VERSION) built on $(DATE)"
@echo ""
@if [[ "$(LOCAL)" == "yes" ]]; then \
echo "Using local crosslinux directory."; \
else \
echo "Using installed configuration."; \
fi
@if [[ -f .bt-init ]]; then \
echo "This directory is initialized for building."; \
else \
echo "Run '$(PROGRAM_NAME) bt-init' before building."; \
fi
@echo ""
@echo "bindir: $(bindir)"
@echo "libdir: $(libdir)"
@echo "docdir: $(docdir)"
@echo "mandir: $(mandir)"
@echo ""
bt-showman:
man "$(mandir)/man1/cl-bt.1.gz"
# -----------------------------------------------------------------------------
# -- Housekeeping Targets
# -----------------------------------------------------------------------------
.PHONY: getcfg config menuconfig nconfig ldrlist pkglist dload
getcfg:
@dlist=`cd $(libdir)/boards/;for d in *; do echo $${d}; done`; \
for d in $${dlist}; do \
for f in $(libdir)/boards/$${d}/$${d}-*config; do \
[[ -f $${f} ]] && llist+="$${f##*/} " || true; \
done; \
done; \
list=($${llist}); \
declare -i i=0; \
declare -i cfg=0; \
declare -i cnt="$${#list[@]}"; \
while [[ $${cfg} -eq 0 || $${cfg} -gt $${cnt} ]]; do \
echo ""; \
echo "crosslinux target board configurations:"; \
for (( i=1 ; $${i} <= $${cnt} ; i++ )); do \
echo "$${i}) $${list[(($${i}-1))]}"; \
done; \
echo ""; \
read -p " Choose from 1 through $${cnt} -> " cfg; \
done; \
cfg="(($${cfg} - 1))"; \
bc=$${list[$${cfg}]}; \
echo ""; \
echo "=> using $${bc}"; \
rm --force crosslinux-config.sh; \
rm --force crosslinux-loader.txt; \
rm --force crosslinux-pkglst.txt; \
cp $(libdir)/boards/$${bc%-*}/$${bc} crosslinux-config.sh
@chmod 666 crosslinux-config.sh
@ls --color -Fl crosslinux-config.sh
@echo ""
crosslinux-config.sh:
@echo "E> Need a new crosslinux-config.sh file."
@echo "=> Run a command to make a new crosslinux-config.sh file:"
@echo " $(PROGRAM_NAME) getcfg"
@echo " $(PROGRAM_NAME) menuconfig"
@echo " $(PROGRAM_NAME) nconfig"
@false
config:
@if [[ -f crosslinux-config.sh && -f .config ]]; then \
echo "E> You have both files:"; \
echo "=> crosslinux-config.sh"; \
echo "=> .config"; \
echo "Delete or save the .config file."; \
ls --color -lF crosslinux-config.sh .config; \
false; \
fi
@if [[ -f crosslinux-config.sh ]]; then \
cp crosslinux-config.sh .config; \
fi
@$(libdir)/kconfig-exec/kconfig-conf $(libdir)/pkg-cfg/Kconfig
@if [[ -f .config ]]; then \
rm --force crosslinux-config.sh; \
mv .config crosslinux-config.sh; \
fi
@chmod 666 crosslinux-config.sh
@ls --color -Fl crosslinux-config.sh
menuconfig:
@if [[ -f crosslinux-config.sh && -f .config ]]; then \
echo "E> You have both files:"; \
echo "=> crosslinux-config.sh"; \
echo "=> .config"; \
echo "Delete or save the .config file."; \
ls --color -lF crosslinux-config.sh .config; \
false; \
fi
@if [[ -f crosslinux-config.sh ]]; then \
cp crosslinux-config.sh .config; \
fi
@$(libdir)/kconfig-exec/kconfig-mconf $(libdir)/pkg-cfg/Kconfig
@if [[ -f .config ]]; then \
rm --force crosslinux-config.sh; \
mv .config crosslinux-config.sh; \
fi
@chmod 666 crosslinux-config.sh
@ls --color -Fl crosslinux-config.sh
nconfig:
@if [[ -f crosslinux-config.sh && -f .config ]]; then \
echo "E> You have both files:"; \
echo "=> crosslinux-config.sh"; \
echo "=> .config"; \
echo "Delete or save the .config file."; \
ls --color -lF crosslinux-config.sh .config; \
false; \
fi
@if [[ -f crosslinux-config.sh ]]; then \
cp crosslinux-config.sh .config; \
fi
@$(libdir)/kconfig-exec/kconfig-nconf $(libdir)/pkg-cfg/Kconfig
@if [[ -f .config ]]; then \
rm --force crosslinux-config.sh; \
mv .config crosslinux-config.sh; \
fi
@chmod 666 crosslinux-config.sh
@ls --color -Fl crosslinux-config.sh
crosslinux-loader.txt ldrlist: crosslinux-config.sh
@echo "i> Regenerating crosslinux-loader.txt:"
@rm --force .ldrlst; \
$(grep) "^CONFIG_LOADER_" crosslinux-config.sh >.ldrlst; \
$(sed) -i .ldrlst \
-e "s/^CONFIG_LOADER_//" \
-e "s/=y//" \
-e "s/p/./g" \
-e "s/_/-/g" \
-e "s/\(.*\)/\L\1/g"; \
rm --force crosslinux-loader.txt; \
>crosslinux-loader.txt; \
for dir in $$(<.ldrlst); do \
echo -n "$${dir} " >> crosslinux-loader.txt; \
for ((i=35 ; $${i}>$${#dir} ; i--)); do \
echo -n "." >>crosslinux-loader.txt; \
done; \
source $(libdir)/pkg-cfg/$${dir}/bld.sh; \
echo -n " $${PKG_ZIP} " >>crosslinux-loader.txt; \
for ((i=35 ; $${i}>$${#PKG_ZIP} ; i--)); do \
echo -n "." >>crosslinux-loader.txt; \
done; \
echo -n " $${PKG_URL}" >>crosslinux-loader.txt; \
echo "" >>crosslinux-loader.txt; \
done; \
rm --force .ldrlst
@chmod 666 crosslinux-loader.txt
@ls --color -Fl crosslinux-loader.txt
crosslinux-pkglst.txt pkglist: crosslinux-config.sh
@echo "i> Regenerating crosslinux-pkglst.txt:"
@rm --force .pkglst; \
$(grep) "^CONFIG_BLD_" crosslinux-config.sh >.pkglst; \
$(sed) -i .pkglst \
-e "s/^CONFIG_BLD_//" \
-e "s/=y//" \
-e "s/p/./g" \
-e "s/_/-/g" \
-e "s/\(.*\)/\L\1/g"; \
rm --force crosslinux-pkglst.txt; \
>crosslinux-pkglst.txt; \
for dir in $$(<.pkglst); do \
echo -n "$${dir} " >> crosslinux-pkglst.txt; \
for ((i=35 ; $${i}>$${#dir} ; i--)); do \
echo -n "." >>crosslinux-pkglst.txt; \
done; \
source $(libdir)/pkg-cfg/$${dir}/bld.sh; \
echo -n " $${PKG_ZIP} " >>crosslinux-pkglst.txt; \
for ((i=35 ; $${i}>$${#PKG_ZIP} ; i--)); do \
echo -n "." >>crosslinux-pkglst.txt; \
done; \
echo -n " $${PKG_URL}" >>crosslinux-pkglst.txt; \
echo "" >>crosslinux-pkglst.txt; \
done; \
rm --force .pkglst
@chmod 666 crosslinux-pkglst.txt
@ls --color -Fl crosslinux-pkglst.txt
dload: crosslinux-loader.txt crosslinux-pkglst.txt $(libdir)/scripts/utl-dload.sh
@if [[ -z "$(PACKAGE)" ]]; then \
echo "i> Download loader source package."; \
$(libdir)/scripts/utl-dload.sh crosslinux-loader.txt; \
if [[ $$? != 0 ]]; then \
echo "E> Download FAILED."; \
false; \
fi \
fi
@echo "i> Download source packages."
@$(libdir)/scripts/utl-dload.sh crosslinux-pkglst.txt $(PACKAGE); \
if [[ $$? != 0 ]]; then \
echo "E> Download FAILED."; \
false; \
fi
# -----------------------------------------------------------------------------
# -- Build Status Support
# -----------------------------------------------------------------------------
.PHONY: ok_to_build
build/run/loader:
@if [[ ! -f build/run/loader ]]; then \
echo "E> The loader is not built."; \
exit 1; \
fi
build/run/packages:
@if [[ ! -f build/run/packages ]]; then \
echo "E> Packages are not all built."; \
exit 1; \
fi
build/run/kernel:
@if [[ ! -f build/run/kernel ]]; then \
echo "E> The kernel is not built."; \
exit 1; \
fi
build/run/rootfs:
@if [[ ! -f build/run/rootfs ]]; then \
echo "E> The root filesystem is not built."; \
exit 1; \
fi
build/run/bootfs:
@if [[ ! -f build/run/bootfs ]]; then \
echo "E> The boot filesystem is not built."; \
exit 1; \
fi
build/run/bootimg:
@if [[ ! -f build/run/bootimg ]]; then \
echo "E> The boot image is not built."; \
exit 1; \
fi
ok_to_build: crosslinux-config.sh
@if [[ ! -f .bt-init ]]; then \
echo "E> Not initialized for building."; \
echo "=> Maybe '${PROGRAM_NAME} bt-init' first."; \
exit 1; \
fi
# -----------------------------------------------------------------------------
# -- Build Targets
# -----------------------------------------------------------------------------
.PHONY: _clean clean lclean kclean pclean
.PHONY: dist stat
.PHONY: loader pkgs pkgs_ kernel rootfs bootfs bootimg
dist: dload clean pkgs loader kernel rootfs bootfs bootimg
stat:
@source ./crosslinux-config.sh; \
echo "Report status of the build."; \
sysName="'$${CONFIG_BRAND_NAME}' "; \
sysName+="$${CONFIG_RELEASE_VERS} "; \
sysName+="[$${CONFIG_RELEASE_NAME}]"; \
echo "=> $${sysName}"; \
echo "=> $${CONFIG_BOARD}"
@(echo -n "> Packages "; \
[[ ! -f build/run/packages ]] && echo -n "NOT "; \
echo "Built")
@(echo -n "> Loader "; \
[[ ! -f build/run/loader ]] && echo -n "NOT "; \
echo "Built")
@(echo -n "> Kernel "; \
[[ ! -f build/run/kernel ]] && echo -n "NOT "; \
echo "Built")
@(echo -n "> Root File System "; \
[[ ! -f build/run/rootfs ]] && echo -n "NOT "; \
echo "Built")
@(echo -n "> Boot Staging Directory Structure "; \
[[ ! -f build/run/bootfs ]] && echo -n "NOT "; \
echo "Built")
@(echo -n "> Boot Image "; \
[[ ! -f build/run/bootimg ]] && echo -n "NOT "; \
echo "Built")
_clean: crosslinux-config.sh $(libdir)/scripts/bld-kernel.sh $(libdir)/scripts/bld-pkgs.sh
@source ./crosslinux-config.sh; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-clean-0.sh ]]; then \
site/bld-clean-0.sh "$(libdir)" ${CMD_PARAM}; \
fi \
fi; \
declare -i mystat=0; \
if [[ x"${CMD_PARAM}" == x"build" || \
x"${CMD_PARAM}" == x"loader" ]]; \
then \
$(libdir)/scripts/bld-loader.sh clean; \
mystat=$$(($${mystat} + $$?)); \
fi; \
if [[ x"${CMD_PARAM}" == x"build" || \
x"${CMD_PARAM}" == x"kernel" ]]; \
then \
$(libdir)/scripts/bld-kernel.sh clean; \
mystat=$$(($${mystat} + $$?)); \
fi; \
if [[ x"${CMD_PARAM}" == x"build" || \
x"${CMD_PARAM}" == x"packages" ]]; \
then \
$(libdir)/scripts/bld-pkgs.sh clean; \
mystat=$$(($${mystat} + $$?)); \
fi; \
if [[ x"${CMD_PARAM}" == x"build" ]]; \
then \
echo "=> Removing target/cdrom, if any."; \
rm --force --recursive target/cdrom; \
echo "=> Removing files from target/image."; \
rm --force target/image/*; \
echo "=> Removing target/source, if any."; \
rm --force --recursive target/source; \
fi; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-clean-1.sh ]]; then \
site/bld-clean-1.sh "$(libdir)" ${CMD_PARAM}; \
fi \
fi; \
if [[ $${mystat} != 0 ]]; then \
echo "Clean FAILED."; \
exit 1; \
fi
@rm --force build/run/${CMD_PARAM}
@rm --force build/run/rootfs
@rm --force build/run/bootfs
@rm --force build/run/bootimg
clean:
@${PROGRAM_NAME} _clean CMD_PARAM=build
lclean:
@${PROGRAM_NAME} _clean CMD_PARAM=loader
kclean:
@${PROGRAM_NAME} _clean CMD_PARAM=kernel
pclean:
@${PROGRAM_NAME} _clean CMD_PARAM=packages
pkgs: ok_to_build crosslinux-pkglst.txt $(libdir)/scripts/bld-pkgs.sh
@if [[ `id -u` -eq 0 ]]; then \
echo "E> Do not do this as root"; \
exit 1; \
fi
@source ./crosslinux-config.sh; \
echo "i> Make the crosslinux packages for:"; \
sysName="'$${CONFIG_BRAND_NAME}' "; \
sysName+="$${CONFIG_RELEASE_VERS} "; \
sysName+="[$${CONFIG_RELEASE_NAME}]"; \
echo "=> $${sysName}"; \
echo "=> $${CONFIG_BOARD}"; \
rm --force build/run/packages; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-pkgs-0.sh ]]; then \
site/bld-pkgs-0.sh "$(libdir)"; \
fi \
fi; \
$(libdir)/scripts/bld-pkgs.sh ${PACKAGE}; \
declare -i mystat=$$?; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-pkgs-1.sh ]]; then \
site/bld-pkgs-1.sh "$(libdir)" $${mystat}; \
fi \
fi; \
if [[ $${mystat} != 0 ]]; then \
echo "E> Build packages FAILED."; \
exit 1; \
fi
@>build/run/packages
pkgs_:
@if [[ `id -u` -eq 0 ]]; then \
echo "E> Do not do this as root"; \
exit 1; \
fi
@${PROGRAM_NAME} pkgs PACKAGE=continue
loader: ok_to_build crosslinux-loader.txt $(libdir)/scripts/bld-loader.sh
@if [[ `id -u` -eq 0 ]]; then \
echo "E> Do not do this as root"; \
exit 1; \
fi
@source ./crosslinux-config.sh; \
echo "i> Make the crosslinux loader for:"; \
sysName="'$${CONFIG_BRAND_NAME}' "; \
sysName+="$${CONFIG_RELEASE_VERS} "; \
sysName+="[$${CONFIG_RELEASE_NAME}]"; \
echo "=> $${sysName}"; \
echo "=> $${CONFIG_BOARD}"; \
rm --force build/run/loader; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-loader-0.sh ]]; then \
site/bld-loader-0.sh "$(libdir)"; \
fi \
fi; \
$(libdir)/scripts/bld-loader.sh; \
declare -i mystat=$$?; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-loader-1.sh ]]; then \
site/bld-loader-1.sh "$(libdir)" $${mystat}; \
fi \
fi; \
if [[ $${mystat} != 0 ]]; then \
echo "E> Build loader FAILED."; \
exit 1; \
fi
@>build/run/loader
kernel: ok_to_build build/run/loader $(libdir)/scripts/bld-kernel.sh
@if [[ `id -u` -eq 0 ]]; then \
echo "E> Do not do this as root"; \
exit 1; \
fi
@source ./crosslinux-config.sh; \
echo "i> Make the ttylinux kernel for:"; \
sysName="'$${CONFIG_BRAND_NAME}' "; \
sysName+="$${CONFIG_RELEASE_VERS} "; \
sysName+="[$${CONFIG_RELEASE_NAME}]"; \
echo "=> $${sysName}"; \
echo "=> $${CONFIG_BOARD}"; \
rm -f build/run/kernel; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-kernel-0.sh ]]; then \
site/bld-kernel-0.sh "$(libdir)"; \
fi \
fi; \
$(libdir)/scripts/bld-kernel.sh; \
declare -i mystat=$$?; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-kernel-1.sh ]]; then \
site/bld-kernel-1.sh "$(libdir)" $${mystat}; \
fi \
fi; \
if [[ $${mystat} != 0 ]]; then \
echo "Kernel FAILED."; \
exit 1; \
fi
@>build/run/kernel
rootfs: ok_to_build build/run/packages $(libdir)/scripts/bld-rootfs.sh
@if [[ `id -u` -eq 0 ]]; then \
echo "E> Do not do this as root"; \
exit 1; \
fi
@source ./crosslinux-config.sh; \
echo "i> Make the root file system image."; \
sysName="'$${CONFIG_BRAND_NAME}' "; \
sysName+="$${CONFIG_RELEASE_VERS} "; \
sysName+="[$${CONFIG_RELEASE_NAME}]"; \
echo "=> $${sysName}"; \
echo "=> $${CONFIG_BOARD}"; \
rm -f build/run/rootfs; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-rootfs-0.sh ]]; then \
site/bld-rootfs-0.sh "$(libdir)"; \
fi \
fi; \
$(libdir)/host-tools/usr/bin/fakeroot -- \
$(libdir)/scripts/bld-rootfs.sh; \
declare -i mystat=$$?; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-rootfs-1.sh ]]; then \
site/bld-rootfs-1.sh "$(libdir)" $${mystat}; \
fi \
fi; \
if [[ $$mystat != 0 ]]; then \
echo "Root file system FAILED."; \
exit 1; \
fi
@>build/run/rootfs
bootfs: ok_to_build build/run/rootfs build/run/kernel $(libdir)/scripts/bld-bootfs.sh
@if [[ `id -u` -eq 0 ]]; then \
echo "E> Do not do this as root"; \
exit 1; \
fi
@source ./crosslinux-config.sh; \
echo "i> Make boot directory structure."; \
sysName="'$${CONFIG_BRAND_NAME}' "; \
sysName+="$${CONFIG_RELEASE_VERS} "; \
sysName+="[$${CONFIG_RELEASE_NAME}]"; \
echo "=> $${sysName}"; \
echo "=> $${CONFIG_BOARD}"; \
rm -f build/run/bootfs; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-bootfs-0.sh ]]; then \
site/bld-bootfs-0.sh "$(libdir)"; \
fi \
fi; \
$(libdir)/scripts/bld-bootfs.sh; \
declare -i mystat=$$?; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-bootfs-1.sh ]]; then \
site/bld-bootfs-1.sh "$(libdir)" $${mystat}; \
fi \
fi; \
if [[ $$mystat != 0 ]]; then \
echo "Boot file system directory FAILED."; \
exit 1; \
fi
@>build/run/bootfs
bootimg: ok_to_build build/run/bootfs $(libdir)/scripts/bld-bootimg.sh
@if [[ `id -u` -eq 0 ]]; then \
echo "E> Do not do this as root"; \
exit 1; \
fi
@source ./crosslinux-config.sh; \
echo "i> Make bootable file system image."; \
sysName="'$${CONFIG_BRAND_NAME}' "; \
sysName+="$${CONFIG_RELEASE_VERS} "; \
sysName+="[$${CONFIG_RELEASE_NAME}]"; \
echo "=> $${sysName}"; \
echo "=> $${CONFIG_BOARD}"; \
rm -f build/run/bootimg; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-bootimg-0.sh ]]; then \
site/bld-bootimg-0.sh "$(libdir)"; \
fi \
fi; \
$(libdir)/scripts/bld-bootimg.sh; \
declare -i mystat=$$?; \
if [[ x"$${CONFIG_SITE_SCRIPTS:-}" == x"y" ]]; then \
if [[ -x site/bld-bootimg-1.sh ]]; then \
site/bld-bootimg-1.sh "$(libdir)" $${mystat}; \
fi \
fi; \
if [[ $$mystat != 0 ]]; then \
echo "Boot file system image FAILED."; \
exit 1; \
fi
@>build/run/bootimg
srcimg: crosslinux-pkglst.txt crosslinux-loader.txt $(libdir)/scripts/bld-srcimg.sh
@echo "i> Make source ISO image."
@$(libdir)/scripts/bld-srcimg.sh
# end of Makefile