-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
982 lines (901 loc) · 35.7 KB
/
Makefile
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
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
SHELL :=/bin/bash
#
# Copyright 2022 IKERLAN S.COOP.
#
# Based on the Versal Custom Thin Platform Extensible System developed by Xilinx, Inc.
# Original repository available at:
# https://github.com/Xilinx/Vitis-Tutorials/tree/2021.1/Developer_Contributed/01-Versal_Custom_Thin_Platform_Extensible_System
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# =========================================================
# MAKEFILE ARGUMENTS
# =========================================================
TIME ?=$(shell date "+%Y%m%d-%H%M%S")
PROJ_NAME ?=platform
USE_BSP ?=TRUE
XEN_HYPERVISOR ?=FALSE
QEMU ?=FALSE
XILINX_VER ?=2021.2
LINUX_BUILD_SRC ?=network
# =========================================================
# PETALINUX CONFIGURATION
# =========================================================
CPU_ARCH :=a72
# =========================================================
# SHELL COMMANDS
# =========================================================
RM :=@rm -f
CP :=@cp
CD :=@cd
ECHO :=@echo -e
WAIT :=$(ECHO) "\n[..]"
OK :=$(ECHO) "[OK]"
INFO :=$(ECHO) "[INFO]"
ERROR :=$(ECHO) "[ERROR]"
MAKE :=$(MAKE)
PWD :=$(shell pwd)
# =========================================================
# DIRECTORIES
# =========================================================
SYSROOT :=../sysroot
BSP :=../src/xilinx-vck190-v${XILINX_VER}-final.bsp
PROJ_PATH :=${PWD}/${PROJ_NAME}
LINUX_DIR :=${PROJ_PATH}/images/linux
XSA :=$(shell dirname "${PWD}")/vivado/${PROJ_NAME}/${PROJ_NAME}.xsa
XSA_PATH :=${PWD}/src/import_from_vivado
LINUX_TMP_DIR ?= /tmp/petalinux
LINUX_LOCAL_DOWNLOADS_DIR ?= ${LINUX_TEMP_DIR}/workspace/downloads
LINUX_LOCAL_SSTATE_DIR ?= ${LINUX_TEMP_DIR}/workspace/sstate_aarch64_2021.2/aarch64
# USR_ROOTFS_APPEND :=${PWD}/src/components/user-rootfsconfig.append
SRC_PATH_EXT_SRC :=${PWD}/src/components/ext_src
# DEST_PATH_EXT_SRC :=${PROJ_PATH}/project-spec
COMMON_IMAGE :=$(shell dirname "${PWD}")/src/xilinx-versal-common-v${XILINX_VER}.tar.gz
FILE_MAIN_CFG :=${PROJ_PATH}/project-spec/configs/config
FILE_ROOTFS_CFG :=${PROJ_PATH}/project-spec/configs/rootfs_config
USR_ROOTFS_CFG :=${PROJ_PATH}/project-spec/meta-user/conf/user-rootfsconfig
FILE_SYSTEM_USR :=${PROJ_PATH}/project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi
DT_BBAPPEND :=${PROJ_PATH}/project-spec/meta-user/recipes-bsp/device-tree/device-tree.bbappend
# PKG_GRP_VITISAI :=${PROJ_PATH}/components/yocto/layers/meta-petalinux/recipes-core/packagegroups/packagegroup-petalinux-vitisai.bb
ROOTFS :=${LINUX_DIR}/rootfs.ext4
IMAGE :=${LINUX_DIR}/Image
BL31 :=${LINUX_DIR}/bl31.elf
BOOT_SCR :=${LINUX_DIR}/boot.scr
BOOT :=${LINUX_DIR}/BOOT.BIN
BOOT_BH :=${LINUX_DIR}/BOOT_bh.bin
QEMU_BOOT :=${LINUX_DIR}/qemu_boot.img
PLM :=${LINUX_DIR}/plm.elf
PSMFW :=${LINUX_DIR}/psmfw.elf
UBOOT :=${LINUX_DIR}/u-boot.elf
DTB :=${LINUX_DIR}/system.dtb
SDK :=${LINUX_DIR}/sdk.sh
SYSROOT :=${PWD}/sysroot
BIF :=${PWD}/src/boot_custom.bif
# =========================================================
# ALIASES
# =========================================================
PETALINUX_CREATE :=@petalinux-create -t project -n ${PROJ_NAME}
PETALINUX_CONFIG :=$(RM) update_build update_bootimage update_sdk update_sysroot && cd ${PROJ_PATH} && petalinux-config --silentconfig
PETALINUX_BUILD :=$(CD) ${PROJ_PATH} && petalinux-build
PETALINUX_PACKAGE :=$(CD) ${PROJ_PATH} && petalinux-package
PETALINUX_BOOT :=cd ${PROJ_PATH} && petalinux-boot
CFG :=@./src/config
MAIN_CONFIG :=$(CFG) --file ${FILE_MAIN_CFG}
ROOTFS_CONFIG :=$(CFG) --file ${FILE_ROOTFS_CFG}
ENABLE :=--keep-case --enable
DISABLE :=--keep-case --disable
SET_STR :=--set-str
PASS_CONFIG_LOG :=echo -e "[OK] petalinux-config exited successfully"; cp ${PROJ_PATH}/build/config.log ${PWD}/${TIME}_PASS_
ERROR_CONFIG_LOG :=echo -e "[ERROR] petalinux-config ended with errors (log file available)"; cp ${PROJ_PATH}/build/config.log ${PWD}/${TIME}_ERROR_
PASS_BUILD_LOG :=echo -e "[OK] petalinux-build exited successfully"; cp ${PROJ_PATH}/build/build.log ${PWD}/${TIME}_PASS_
ERROR_BUILD_LOG :=echo -e "[ERROR] petalinux-build ended with errors (log file available)"; cp ${PROJ_PATH}/build/build.log ${PWD}/${TIME}_ERROR_
PASS_PACKAGE_LOG :=echo -e "[OK] petalinux-package exited successfully"; cp ${PROJ_PATH}/build/package.log ${PWD}/${TIME}_PASS_
ERROR_PACKAGE_LOG :=echo -e "[ERROR] petalinux-package ended with errors (log file available)"; cp ${PROJ_PATH}/build/package.log ${PWD}/${TIME}_ERROR_
# =========================================================
# RECIPES
# =========================================================
.PHONY: all clean help targets
all: ${PROJ_PATH}
$(MAKE) update_all_configs
$(MAKE) update_build
$(MAKE) update_bootimage
$(MAKE) update_sysroot
$(MAKE) sd_card
clean:
$(WAIT) "Cleaning project"
$(RM) -r ${PROJ_PATH}
$(RM) -r common_image
$(RM) -r sysroot
$(RM) -r sd_card
$(RM) update_build
$(RM) update_bootimage
$(RM) update_sdk
$(RM) update_sysroot
$(OK) "Successfully cleaned project"
help: targets
targets:
$(ECHO) "Make targets: all create update_hw update_config update_ext_src update_device_tree update_ext_src_config update_build update_bootimage update_sysroot"
# =========================================================
# CREATE PROJECT
# =========================================================
.PHONY: create
create: clean ${PROJ_PATH}
${PROJ_PATH}:
$(WAIT) "Create project ${PROJ_NAME}"
ifeq ("$(wildcard ${BSP});${USE_BSP}","${BSP};TRUE")
# BSP exists
$(INFO) "Using BSP ${BSP}"
# Use this to create a project for the VCK190 development board
$(PETALINUX_CREATE) -s ${BSP}
else
# BSP does not exist
$(INFO) "Using VERSAL template"
# Use this to create a project for a custom board
$(PETALINUX_CREATE) --template versal
endif
$(OK) "Successfully created project ${PROJ_NAME}"
# =========================================================
# CONFIG PROJECT
# =========================================================
.PHONY: update_all_configs clean_config
# Create backup config files for project restoration:
${FILE_MAIN_CFG}.original:
$(WAIT) "Creating a backup of config"
$(CP) ${FILE_MAIN_CFG} ${FILE_MAIN_CFG}.original
$(OK) "Successfully created backup of config"
${FILE_ROOTFS_CFG}.original:
$(WAIT) "Creating a backup of rootfs_config"
$(CP) ${FILE_ROOTFS_CFG} ${FILE_ROOTFS_CFG}.original
$(OK) "Successfully created backup of rootfs_config"
${USR_ROOTFS_CFG}.original:
$(WAIT) "Creating a backup of usr-rootfsconfig"
$(CP) ${USR_ROOTFS_CFG} ${USR_ROOTFS_CFG}.original
$(OK) "Successfully created backup of usr-rootfsconfig"
${FILE_SYSTEM_USR}.original:
$(WAIT) "Creating a backup of system-user.dtsi"
$(CP) ${FILE_SYSTEM_USR} ${FILE_SYSTEM_USR}.original
$(OK) "Successfully created backup of system-user.dtsi"
${DT_BBAPPEND}.original:
$(WAIT) "Creating a backup of device-tree.bbappend"
$(CP) ${DT_BBAPPEND} ${DT_BBAPPEND}.original
$(OK) "Successfully created backup of device-tree.bbappend"
update_all_configs:
$(MAKE) update_hw
$(MAKE) update_main_config
# Using the default linux kernel, no need to run the kernel configuration
# $(MAKE) update_kernel_config
$(MAKE) update_rootfs_config
# $(MAKE) update_ext_src
# $(MAKE) update_ext_src_config
# ifeq ("${XEN_HYPERVISOR}","TRUE")
# $(MAKE) enable_xen_hypervisor
# else
# $(MAKE) disable_xen_hypervisor
# endif
clean_config: | ${FILE_MAIN_CFG}.original ${FILE_ROOTFS_CFG}.original
$(WAIT) "Cleaning configuration"
$(CP) ${FILE_MAIN_CFG}.original ${FILE_MAIN_CFG}
$(WAIT) "Configuring ${FILE_MAIN_CFG}"
$(PETALINUX_CONFIG)
$(OK) "Successfully configured ${FILE_MAIN_CFG}"
$(CP) ${FILE_ROOTFS_CFG}.original ${FILE_ROOTFS_CFG}
$(WAIT) "Configuring ${FILE_ROOTFS_CFG}"
$(PETALINUX_CONFIG) -c rootfs
$(OK) "Successfully configured ${FILE_ROOTFS_CFG}"
$(MAKE) clean_extra_layers
$(MAKE) disable_xen_hypervisor
$(OK) "Successfully cleaned configuration"
# =========================================================
# HW CONFIG
# =========================================================
.PHONY: update_hw ${XSA_PATH}
${XSA}:
$(MAKE) ${XSA} -C ../vivado
${XSA_PATH}: ${XSA}
$(WAIT) "Importing XSA from Vivado"
$(CP) ${XSA} ${XSA_PATH}/.
$(OK) "Successfully imported XSA from Vivado"
update_hw: ${FILE_MAIN_CFG}.original ${XSA_PATH}
$(WAIT) "Updating hardware with ${XSA_PATH}"
$(INFO) "Restoring original main config file"
$(CP) ${FILE_MAIN_CFG}.original ${FILE_MAIN_CFG}
$(PETALINUX_CONFIG) --get-hw-description=${XSA_PATH} && { \
$(PASS_CONFIG_LOG)hw_config.log; \
} || { \
$(ERROR_CONFIG_LOG)hw_config.log; \
exit $$?; \
}
$(OK) "Successfully updated hardware"
$(INFO) "Recreating a backup of config"
$(CP) ${FILE_MAIN_CFG} ${FILE_MAIN_CFG}.original
$(WAIT) "Configuring ${FILE_MAIN_CFG}"
$(PETALINUX_CONFIG)
$(OK) "Successfully configured ${FILE_MAIN_CFG}"
# =========================================================
# MAIN CONFIG
# =========================================================
.PHONY: update_main_config
update_main_config: ${FILE_MAIN_CFG}.original
$(WAIT) "Updating ${FILE_MAIN_CFG}"
$(INFO) "Restoring original main config file"
$(CP) ${FILE_MAIN_CFG}.original ${FILE_MAIN_CFG}
## Subsystem AUTO HW Settings - Flash Settings
# Why was it enabled?
# $(MAIN_CONFIG) $(ENABLE) SUBSYSTEM_FLASH__ADVANCED_AUTOCONFIG
## DTG Settings
ifeq ("${USE_BSP}","TRUE")
$(MAIN_CONFIG) $(SET_STR) CONFIG_SUBSYSTEM_MACHINE_NAME "versal-vck190-reva-x-ebm-01-reva"
else
$(MAIN_CONFIG) $(SET_STR) CONFIG_SUBSYSTEM_MACHINE_NAME "template"
endif
## u-boot Configuration
$(MAIN_CONFIG) $(SET_STR) CONFIG_SUBSYSTEM_UBOOT_CONFIG_TARGET "xilinx_versal_virt_defconfig"
## Image Packaging Configuration
# Required for booting INITRD images with full rootfs (ramdisk.cpio.gz -> EXT4)
# https://support.xilinx.com/s/article/76842?language=en_US (Method 1)
# $(MAIN_CONFIG) $(DISABLE) SUBSYSTEM_ROOTFS_INITRAMFS
# $(MAIN_CONFIG) $(ENABLE) SUBSYSTEM_ROOTFS_INITRD
# $(MAIN_CONFIG) $(SET_STR) CONFIG_SUBSYSTEM_INITRAMFS_IMAGE_NAME "petalinux-image-minimal"
# $(MAIN_CONFIG) $(SET_STR) CONFIG_SUBSYSTEM_RFS_FORMATS "cpio cpio.gz cpio.gz.u-boot tar.gz jffs2 ext4"
## Firmware Version Configuration
$(MAIN_CONFIG) $(SET_STR) CONFIG_SUBSYSTEM_HOSTNAME "fractal_versal"
$(MAIN_CONFIG) $(SET_STR) CONFIG_SUBSYSTEM_PRODUCT "fractal_versal"
## Yocto Settings - Yocto board settings
$(MAIN_CONFIG) $(SET_STR) CONFIG_YOCTO_BOARD_NAME "vck190"
## Yocto Settings - Local/Network sstate feeds settings
$(MAIN_CONFIG) $(ENABLE) YOCTO_BUILDTOOLS_EXTENDED
ifeq (${LINUX_BUILD_SRC},"local")
$(MAIN_CONFIG) $(ENABLE) CONFIG_YOCTO_BB_NO_NETWORK
$(MAIN_CONFIG) $(DISABLE) CONFIG_YOCTO_NETWORK_SSTATE_FEEDS
$(MAIN_CONFIG) $(SET_STR) CONFIG_YOCTO_LOCAL_SSTATE_FEEDS_URL ${LINUX_LOCAL_SSTATE_DIR}
$(MAIN_CONFIG) $(SET_STR) CONFIG_PRE_MIRROR_URL "file\:\/\/"${LINUX_LOCAL_DOWNLOADS_DIR}
endif
$(OK) "Successfully updated ${FILE_MAIN_CFG}"
$(WAIT) "Configuring ${FILE_MAIN_CFG}"
$(PETALINUX_CONFIG) && { \
$(PASS_CONFIG_LOG)main_config.log; \
} || { \
$(ERROR_CONFIG_LOG)main_config.log; \
exit $$?; \
}
$(OK) "Successfully configured ${FILE_MAIN_CFG}"
# =========================================================
# KERNEL CONFIG
# =========================================================
.PHONY: update_kernel_config
update_kernel_config:
$(WAIT) "Configuring kernel"
$(PETALINUX_CONFIG) -c kernel && { \
$(PASS_CONFIG_LOG)kernel_config.log; \
} || { \
$(ERROR_CONFIG_LOG)kernel_config.log; \
exit $$?; \
}
$(OK) "Successfully configured kernel"
# =========================================================
# ROOTFS CONFIG
# =========================================================
.PHONY: update_rootfs_config
update_rootfs_config: ${FILE_ROOTFS_CFG}.original
$(WAIT) "Updating ${FILE_ROOTFS_CFG}"
$(INFO) "Restoring original Root FS config file"
$(CP) ${FILE_ROOTFS_CFG}.original ${FILE_ROOTFS_CFG}
## FS Packages - Base
$(ROOTFS_CONFIG) $(ENABLE) dnf
$(ROOTFS_CONFIG) $(ENABLE) e2fsprogs-mke2fs
$(ROOTFS_CONFIG) $(ENABLE) e2fsprogs-resize2fs
$(ROOTFS_CONFIG) $(ENABLE) fpga-manager-script
$(ROOTFS_CONFIG) $(ENABLE) haveged
$(ROOTFS_CONFIG) $(ENABLE) mtd-utils
## FS Packages - Console - Network
$(ROOTFS_CONFIG) $(ENABLE) can-utils
$(ROOTFS_CONFIG) $(ENABLE) openssh
$(ROOTFS_CONFIG) $(ENABLE) openssh-ssh
$(ROOTFS_CONFIG) $(ENABLE) openssh-sftp
$(ROOTFS_CONFIG) $(ENABLE) openssh-sftp-server
$(ROOTFS_CONFIG) $(ENABLE) openssh-sshd
## FS Packages - Console - Tools
$(ROOTFS_CONFIG) $(ENABLE) parted
## FS Packages - Console - Utils
$(ROOTFS_CONFIG) $(ENABLE) alsa-tools
$(ROOTFS_CONFIG) $(ENABLE) alsa-utils
$(ROOTFS_CONFIG) $(ENABLE) bash-completion
$(ROOTFS_CONFIG) $(ENABLE) bzip2
$(ROOTFS_CONFIG) $(ENABLE) file
$(ROOTFS_CONFIG) $(ENABLE) findutils
$(ROOTFS_CONFIG) $(ENABLE) gawk
$(ROOTFS_CONFIG) $(ENABLE) git
$(ROOTFS_CONFIG) $(ENABLE) grep
$(ROOTFS_CONFIG) $(ENABLE) gzip
$(ROOTFS_CONFIG) $(ENABLE) hdparm
$(ROOTFS_CONFIG) $(ENABLE) less
$(ROOTFS_CONFIG) $(ENABLE) lmbench
$(ROOTFS_CONFIG) $(ENABLE) pciutils
$(ROOTFS_CONFIG) $(ENABLE) pkgconfig
$(ROOTFS_CONFIG) $(ENABLE) screen
$(ROOTFS_CONFIG) $(ENABLE) sed
$(ROOTFS_CONFIG) $(ENABLE) setserial
$(ROOTFS_CONFIG) $(ENABLE) smartmontools
$(ROOTFS_CONFIG) $(ENABLE) sysstat
$(ROOTFS_CONFIG) $(ENABLE) unzip
$(ROOTFS_CONFIG) $(ENABLE) zip
## FS Packages - Development
$(ROOTFS_CONFIG) $(ENABLE) binutils
$(ROOTFS_CONFIG) $(ENABLE) make
$(ROOTFS_CONFIG) $(ENABLE) run-postinsts
$(ROOTFS_CONFIG) $(ENABLE) tcl
## FS Packages - Development - Python
$(ROOTFS_CONFIG) $(ENABLE) packagegroup-petalinux-python-modules
$(ROOTFS_CONFIG) $(ENABLE) python
$(ROOTFS_CONFIG) $(ENABLE) libpython2
$(ROOTFS_CONFIG) $(ENABLE) python-2to3
$(ROOTFS_CONFIG) $(ENABLE) python-argparse
$(ROOTFS_CONFIG) $(ENABLE) python-audio
$(ROOTFS_CONFIG) $(ENABLE) python-bsddb
$(ROOTFS_CONFIG) $(ENABLE) python-codecs
$(ROOTFS_CONFIG) $(ENABLE) python-compile
$(ROOTFS_CONFIG) $(ENABLE) python-compiler
$(ROOTFS_CONFIG) $(ENABLE) python-compression
$(ROOTFS_CONFIG) $(ENABLE) python-contextlib
$(ROOTFS_CONFIG) $(ENABLE) python-core
$(ROOTFS_CONFIG) $(ENABLE) python-crypt
$(ROOTFS_CONFIG) $(ENABLE) python-ctypes
$(ROOTFS_CONFIG) $(ENABLE) python-curses
$(ROOTFS_CONFIG) $(ENABLE) python-datetime
$(ROOTFS_CONFIG) $(ENABLE) python-db
$(ROOTFS_CONFIG) $(ENABLE) python-debugger
$(ROOTFS_CONFIG) $(ENABLE) python-difflib
$(ROOTFS_CONFIG) $(ENABLE) python-distutils
$(ROOTFS_CONFIG) $(ENABLE) python-email
$(ROOTFS_CONFIG) $(ENABLE) python-fcntl
$(ROOTFS_CONFIG) $(ENABLE) python-gdbm
$(ROOTFS_CONFIG) $(ENABLE) python-hotshot
$(ROOTFS_CONFIG) $(ENABLE) python-html
$(ROOTFS_CONFIG) $(ENABLE) python-idle
$(ROOTFS_CONFIG) $(ENABLE) python-image
$(ROOTFS_CONFIG) $(ENABLE) python-io
$(ROOTFS_CONFIG) $(ENABLE) python-json
$(ROOTFS_CONFIG) $(ENABLE) python-lang
$(ROOTFS_CONFIG) $(ENABLE) python-logging
$(ROOTFS_CONFIG) $(ENABLE) python-mailbox
$(ROOTFS_CONFIG) $(ENABLE) python-math
$(ROOTFS_CONFIG) $(ENABLE) python-mime
$(ROOTFS_CONFIG) $(ENABLE) python-misc
$(ROOTFS_CONFIG) $(ENABLE) python-mmap
$(ROOTFS_CONFIG) $(ENABLE) python-modules
$(ROOTFS_CONFIG) $(ENABLE) python-multiprocessing
$(ROOTFS_CONFIG) $(ENABLE) python-netclient
$(ROOTFS_CONFIG) $(ENABLE) python-netserver
$(ROOTFS_CONFIG) $(ENABLE) python-numbers
$(ROOTFS_CONFIG) $(ENABLE) python-pickle
$(ROOTFS_CONFIG) $(ENABLE) python-pkgutil
$(ROOTFS_CONFIG) $(ENABLE) python-plistlib
$(ROOTFS_CONFIG) $(ENABLE) python-pprint
$(ROOTFS_CONFIG) $(ENABLE) python-profile
$(ROOTFS_CONFIG) $(ENABLE) python-pydoc
$(ROOTFS_CONFIG) $(ENABLE) python-re
$(ROOTFS_CONFIG) $(ENABLE) python-resource
$(ROOTFS_CONFIG) $(ENABLE) python-robotparser
$(ROOTFS_CONFIG) $(ENABLE) python-shell
$(ROOTFS_CONFIG) $(ENABLE) python-smtpd
$(ROOTFS_CONFIG) $(ENABLE) python-sqlite3
$(ROOTFS_CONFIG) $(ENABLE) python-stringold
$(ROOTFS_CONFIG) $(ENABLE) python-subprocess
$(ROOTFS_CONFIG) $(ENABLE) python-syslog
$(ROOTFS_CONFIG) $(ENABLE) python-terminal
$(ROOTFS_CONFIG) $(ENABLE) python-tests
$(ROOTFS_CONFIG) $(ENABLE) python-textutils
$(ROOTFS_CONFIG) $(ENABLE) python-threading
$(ROOTFS_CONFIG) $(ENABLE) python-tkinter
$(ROOTFS_CONFIG) $(ENABLE) python-unittest
$(ROOTFS_CONFIG) $(ENABLE) python-unixadmin
$(ROOTFS_CONFIG) $(ENABLE) python-xml
$(ROOTFS_CONFIG) $(ENABLE) python-xmlrpc
$(ROOTFS_CONFIG) $(ENABLE) python-zlib
$(ROOTFS_CONFIG) $(ENABLE) python3
$(ROOTFS_CONFIG) $(ENABLE) libpython3
$(ROOTFS_CONFIG) $(ENABLE) python3-2to3
$(ROOTFS_CONFIG) $(ENABLE) python3-async
$(ROOTFS_CONFIG) $(ENABLE) python3-asyncio
$(ROOTFS_CONFIG) $(ENABLE) python3-audio
$(ROOTFS_CONFIG) $(ENABLE) python3-codecs
$(ROOTFS_CONFIG) $(ENABLE) python3-compile
$(ROOTFS_CONFIG) $(ENABLE) python3-compression
$(ROOTFS_CONFIG) $(ENABLE) python3-core
$(ROOTFS_CONFIG) $(ENABLE) python3-crypt
$(ROOTFS_CONFIG) $(ENABLE) python3-ctypes
$(ROOTFS_CONFIG) $(ENABLE) python3-curses
$(ROOTFS_CONFIG) $(ENABLE) python3-datetime
$(ROOTFS_CONFIG) $(ENABLE) python3-db
$(ROOTFS_CONFIG) $(ENABLE) python3-debugger
$(ROOTFS_CONFIG) $(ENABLE) python3-difflib
$(ROOTFS_CONFIG) $(ENABLE) python3-distutils
$(ROOTFS_CONFIG) $(ENABLE) python3-email
$(ROOTFS_CONFIG) $(ENABLE) python3-fcntl
$(ROOTFS_CONFIG) $(ENABLE) python3-gdbm
$(ROOTFS_CONFIG) $(ENABLE) python3-git
$(ROOTFS_CONFIG) $(ENABLE) python3-gitdb
$(ROOTFS_CONFIG) $(ENABLE) python3-html
$(ROOTFS_CONFIG) $(ENABLE) python3-idle
$(ROOTFS_CONFIG) $(ENABLE) python3-image
$(ROOTFS_CONFIG) $(ENABLE) python3-io
$(ROOTFS_CONFIG) $(ENABLE) python3-json
$(ROOTFS_CONFIG) $(ENABLE) python3-logging
$(ROOTFS_CONFIG) $(ENABLE) python3-mailbox
$(ROOTFS_CONFIG) $(ENABLE) python3-math
$(ROOTFS_CONFIG) $(ENABLE) python3-mime
$(ROOTFS_CONFIG) $(ENABLE) python3-misc
$(ROOTFS_CONFIG) $(ENABLE) python3-mmap
$(ROOTFS_CONFIG) $(ENABLE) python3-modules
$(ROOTFS_CONFIG) $(ENABLE) python3-multiprocessing
$(ROOTFS_CONFIG) $(ENABLE) python3-netclient
$(ROOTFS_CONFIG) $(ENABLE) python3-netserver
$(ROOTFS_CONFIG) $(ENABLE) python3-numbers
$(ROOTFS_CONFIG) $(ENABLE) python3-pickle
$(ROOTFS_CONFIG) $(ENABLE) python3-pkgutil
$(ROOTFS_CONFIG) $(ENABLE) python3-pprint
$(ROOTFS_CONFIG) $(ENABLE) python3-profile
$(ROOTFS_CONFIG) $(ENABLE) python3-pydoc
$(ROOTFS_CONFIG) $(ENABLE) python3-pyvenv
$(ROOTFS_CONFIG) $(ENABLE) python3-resource
$(ROOTFS_CONFIG) $(ENABLE) python3-setuptools
$(ROOTFS_CONFIG) $(ENABLE) python3-shell
$(ROOTFS_CONFIG) $(ENABLE) python3-smmap
$(ROOTFS_CONFIG) $(ENABLE) python3-smtpd
$(ROOTFS_CONFIG) $(ENABLE) python3-sqlite3
$(ROOTFS_CONFIG) $(ENABLE) python3-stringold
$(ROOTFS_CONFIG) $(ENABLE) python3-syslog
$(ROOTFS_CONFIG) $(ENABLE) python3-terminal
$(ROOTFS_CONFIG) $(ENABLE) python3-tests
$(ROOTFS_CONFIG) $(ENABLE) python3-threading
$(ROOTFS_CONFIG) $(ENABLE) python3-tkinter
$(ROOTFS_CONFIG) $(ENABLE) python3-unittest
$(ROOTFS_CONFIG) $(ENABLE) python3-unixadmin
$(ROOTFS_CONFIG) $(ENABLE) python3-xml
$(ROOTFS_CONFIG) $(ENABLE) python3-xmlrpc
$(ROOTFS_CONFIG) $(ENABLE) python3-dbus
$(ROOTFS_CONFIG) $(ENABLE) python3-nose
$(ROOTFS_CONFIG) $(ENABLE) python3-numpy
$(ROOTFS_CONFIG) $(ENABLE) python3-pygobject
$(ROOTFS_CONFIG) $(ENABLE) python3-scons
## FS Packages - Libraries
$(ROOTFS_CONFIG) $(ENABLE) ai-engine-driver
$(ROOTFS_CONFIG) $(ENABLE) xrt
$(ROOTFS_CONFIG) $(ENABLE) zocl
## FS Packages - Miscellaneous
$(ROOTFS_CONFIG) $(ENABLE) udev-extraconf
$(ROOTFS_CONFIG) $(ENABLE) libstdcPLUSPLUS
$(ROOTFS_CONFIG) $(ENABLE) packagegroup-core-boot
$(ROOTFS_CONFIG) $(DISABLE) packagegroup-core-ssh-dropbear
$(ROOTFS_CONFIG) $(ENABLE) libsysfs
$(ROOTFS_CONFIG) $(ENABLE) tcf-agent
## FS Packages - Network
$(ROOTFS_CONFIG) $(ENABLE) bridge-utils
## FS Packages - Utilities
$(ROOTFS_CONFIG) $(ENABLE) u-boot-tools
## PetaLinux Package Groups
$(ROOTFS_CONFIG) $(ENABLE) packagegroup-petalinux
$(ROOTFS_CONFIG) $(ENABLE) packagegroup-petalinux-mraa
$(ROOTFS_CONFIG) $(ENABLE) packagegroup-petalinux-openamp
$(ROOTFS_CONFIG) $(ENABLE) packagegroup-petalinux-opencv
# $(ROOTFS_CONFIG) $(ENABLE) packagegroup-petalinux-self-hosted
$(ROOTFS_CONFIG) $(ENABLE) packagegroup-petalinux-utils
## Image Features
$(ROOTFS_CONFIG) $(DISABLE) imagefeature-ssh-server-dropbear
$(ROOTFS_CONFIG) $(ENABLE) imagefeature-ssh-server-openssh
$(ROOTFS_CONFIG) $(ENABLE) imagefeature-hwcodecs
$(ROOTFS_CONFIG) $(ENABLE) imagefeature-debug-tweaks
$(ROOTFS_CONFIG) $(ENABLE) auto-login
## Apps
$(ROOTFS_CONFIG) $(ENABLE) aie-oob
$(ROOTFS_CONFIG) $(ENABLE) gpio-demo
$(ROOTFS_CONFIG) $(ENABLE) peekpoke
# Configure
$(OK) "Successfully updated ${FILE_ROOTFS_CFG}"
$(WAIT) "Configuring ${FILE_ROOTFS_CFG}"
$(PETALINUX_CONFIG) -c rootfs && { \
$(PASS_CONFIG_LOG)rootfs_config.log; \
} || { \
$(ERROR_CONFIG_LOG)rootfs_config.log; \
exit $$?; \
}
$(OK) "Successfully configured ${FILE_ROOTFS_CFG}"
# =========================================================
# EXTERNAL SOURCES/LAYERS
# =========================================================
.PHONY: update_ext_src update_ext_src_config clean_ext_src clean_extra_layers
update_ext_src: clean_ext_src
$(WAIT) "Updating external source code"
${PWD}/src/components/vitis-ai.sh --import -s ${SRC_PATH_EXT_SRC}
$(OK) "Successfully updated external source code"
## $(INFO) "Cloning meta-tensorflow from yoctoproject.org"
## @git clone -b thud git://git.yoctoproject.org/meta-tensorflow ${SRC_PATH_EXT_SRC}/meta-tensorflow
# $(INFO) "Cloning meta-vitis-ai from github.com"
## https://github.com/Xilinx/Vitis-AI/tree/master/tools/Vitis-AI-Recipes#to-install-the-vai20-online
# @git clone -b rel-v2021.2 https://github.com/Xilinx/meta-vitis-ai.git ${SRC_PATH_EXT_SRC}/meta-vitis-ai
# $(ECHO) "packagegroup-petalinux-vitisai" >> \
# ${USR_ROOTFS_APPEND}
# $(CP) ${PKG_GRP_VITISAI} ${PKG_GRP_VITISAI}.original
# @cat ${PKG_GRP_VITISAI} | \
# tr '\n' '\f' | \
# sed -e 's?\f dnndk \\\f?\f?' | \
# tr '\f' '\n' | \
# tee ${PKG_GRP_VITISAI} > \
# /dev/null
update_ext_src_config: ${FILE_MAIN_CFG}.original ${FILE_ROOTFS_CFG}.original ${USR_ROOTFS_CFG}.original
$(WAIT) "Updating external source code configuration"
${PWD}/src/components/vitis-ai.sh --config -s ${SRC_PATH_EXT_SRC} -p ${PROJ_PATH}
$(WAIT) "Configuring ${FILE_ROOTFS_CFG}"
$(PETALINUX_CONFIG) -c rootfs && { \
$(PASS_CONFIG_LOG)ext_src_rootfs_config.log; \
} || { \
$(ERROR_CONFIG_LOG)ext_src_rootfs_config.log; \
exit $$?; \
}
$(OK) "Successfully updated external source code configuration"
# $(WAIT) "Proceding to add the following layers to the PetaLinux project:"
# $(INFO) "$(shell ls ${SRC_PATH_EXT_SRC})"
# @COUNTER=0; \
# for i in $(shell ls ${SRC_PATH_EXT_SRC}); do \
# echo "[INFO] Adding $${i} external layer"; \
# rm -rf ${DEST_PATH_EXT_SRC}/$${i}; \
# mkdir ${DEST_PATH_EXT_SRC}/$${i}; \
# cp -r ${SRC_PATH_EXT_SRC}/$${i} ${DEST_PATH_EXT_SRC}; \
# sed -i \
# "s?CONFIG_USER_LAYER_$${COUNTER}=.*?CONFIG_USER_LAYER_$${COUNTER}=\"${DEST_PATH_EXT_SRC}/$${i}\"\nCONFIG_USER_LAYER_$$((COUNTER+1))=\"\"?" \
# ${FILE_MAIN_CFG}; \
# COUNTER=$$((COUNTER+1)); \
# done;
# $(OK) "Successfully added the external layers"
# $(WAIT) "Configuring ${FILE_MAIN_CFG}"
# $(PETALINUX_CONFIG) && { \
# $(PASS_CONFIG_LOG)ext_src_main_config.log; \
# } || { \
# $(ERROR_CONFIG_LOG)ext_src_main_config.log; \
# exit $$?; \
# }
# $(OK) "Successfully configured ${FILE_MAIN_CFG}"
# $(WAIT) "Adding user packages to ${USR_ROOTFS_CFG}"
# @for i in ${USR_ROOTFS_APPEND}; do \
# echo "CONFIG_$${i}" >> ${USR_ROOTFS_CFG}; \
# ${PWD}/src/config --file ${FILE_ROOTFS_CFG} ${ENABLE} $${i}; \
# done;
# $(OK) "Successfully added the user packages"
# $(WAIT) "Configuring ${FILE_ROOTFS_CFG}"
# $(PETALINUX_CONFIG) -c rootfs && { \
# $(PASS_CONFIG_LOG)ext_src_rootfs_config.log; \
# } || { \
# $(ERROR_CONFIG_LOG)ext_src_rootfs_config.log; \
# exit $$?; \
# }
# $(OK) "Successfully configured ${FILE_ROOTFS_CFG}"
clean_ext_src:
$(WAIT) "Cleaning external source components"
${PWD}/src/components/vitis-ai.sh --clean -s ${SRC_PATH_EXT_SRC} -p ${PROJ_PATH}
$(OK) "Successfully cleaned external source components"
# $(RM) -r ${SRC_PATH_EXT_SRC}/*
# $(RM) ${USR_ROOTFS_APPEND}
# @touch ${USR_ROOTFS_APPEND}
############## PENDING #############
## https://www.hackster.io/jack-bonnell2/xilinx-kv260-petalinux-2021-1-build-vitis-ai-libraries-dd3025
# @cat ${PKG_GRP_VITISAI} | \
# tr '\n' '\f' | \
# sed -e 's?\f opencv \\\f?\f opencv \\\f dnndk \\\f?' | \
# tr '\f' '\n' | \
# tee ${PKG_GRP_VITISAI} > \
# /dev/null
############# PENDING #############
#clean_extra_layers:
# $(WAIT) "Cleaning extra layers"
# $(INFO) "Removing extra layers from the ${PROJ_NAME}/project-spec directory"
# @COUNTER=0; \
# for i in $(shell ls ${DEST_PATH_EXT_SRC}); do \
# if [[ "attributes configs hw-description meta-user" != *"$${i}"* ]]; then \
# echo "[INFO] Removing $${i} external layer"; \
# rm -rf ${DEST_PATH_EXT_SRC}/$${i}; \
# fi; \
# done;
# $(INFO) "Removing user layers from ${FILE_MAIN_CFG}"
# @sed -i "s?CONFIG_USER_LAYER_0=.*?CONFIG_USER_LAYER_0=\"\"?" ${FILE_MAIN_CFG}
# @cat ${FILE_MAIN_CFG} | \
# tr '\n' '\f' | \
# sed -e 's?\fCONFIG_USER_LAYER_1=.*\fCONFIG_?\fCONFIG_?' | \
# tr '\f' '\n' | \
# tee ${FILE_MAIN_CFG} > \
# /dev/null
# $(WAIT) "Configuring ${FILE_MAIN_CFG}"
# $(PETALINUX_CONFIG) && { \
# $(PASS_CONFIG_LOG)clean_ext_src_main_config.log; \
# } || { \
# $(ERROR_CONFIG_LOG)clean_ext_src_main_config.log; \
# exit $$?; \
# }
# $(OK) "Successfully configured ${FILE_MAIN_CFG}"
# $(INFO) "Removing user packages from ${FILE_ROOTFS_CFG}"
# @for i in ${USR_ROOTFS_APPEND}; do \
# cat ${FILE_ROOTFS_CFG} | \
# tr '\n' '\f' | \
# sed -e 's?\fCONFIG_$${i}=y\f?\f?' | \
# tr '\f' '\n' | \
# tee ${FILE_ROOTFS_CFG} > \
# /dev/null; \
# done;
# $(WAIT) "Configuring ${FILE_ROOTFS_CFG}"
# $(PETALINUX_CONFIG) -c rootfs && { \
# $(PASS_CONFIG_LOG)clean_ext_src_rootfs_config.log; \
# } || { \
# $(ERROR_CONFIG_LOG)clean_ext_src_rootfs_config.log; \
# exit $$?; \
# }
# $(OK) "Successfully configured ${FILE_ROOTFS_CFG}"
# $(INFO) "Restoring original ${USR_ROOTFS_CFG}"
# $(CP) ${USR_ROOTFS_CFG}.original ${USR_ROOTFS_CFG}
# $(OK) "Successfully cleaned extra layers"
# =========================================================
# DEVICE TREE (deprecated)
# =========================================================
.PHONY: update_device_tree
update_device_tree:
$(WAIT) "Updating device tree"
$(OK) "Successfully updated device tree"
# =========================================================
# XEN HYPERVISOR
# =========================================================
.PHONY: enable_xen_hypervisor disable_xen_hypervisor
enable_xen_hypervisor: ${FILE_SYSTEM_USR}.original ${DT_BBAPPEND}.original disable_xen_hypervisor
$(WAIT) "Enabling Xen Hypervisor"
$(WAIT) "Updating ${FILE_MAIN_CFG}"
$(MAIN_CONFIG) $(DISABLE) SUBSYSTEM_ROOTFS_INITRAMFS
$(MAIN_CONFIG) $(ENABLE) SUBSYSTEM_ROOTFS_INITRD
$(MAIN_CONFIG) $(SET_STR) CONFIG_SUBSYSTEM_INITRAMFS_IMAGE_NAME "petalinux-image-minimal"
$(OK) "Successfully updated ${FILE_MAIN_CFG}"
$(WAIT) "Configuring ${FILE_MAIN_CFG}"
$(PETALINUX_CONFIG) && { \
$(PASS_CONFIG_LOG)enable_xen_main_config.log; \
} || { \
$(ERROR_CONFIG_LOG)enable_xen_main_config.log; \
exit $$?; \
}
$(OK) "Successfully configured ${FILE_MAIN_CFG}"
$(WAIT) "Updating ${FILE_ROOTFS_CFG}"
$(ROOTFS_CONFIG) $(ENABLE) packagegroup-petalinux-xen
$(OK) "Successfully updated ${FILE_ROOTFS_CFG}"
$(WAIT) "Configuring ${FILE_ROOTFS_CFG}"
$(PETALINUX_CONFIG) -c rootfs && { \
$(PASS_CONFIG_LOG)enable_xen_rootfs_config.log; \
} || { \
$(ERROR_CONFIG_LOG)enable_xen_rootfs_config.log; \
exit $$?; \
}
$(OK) "Successfully configured ${FILE_ROOTFS_CFG}"
$(WAIT) "Modifying the device tree"
$(INFO) "Including xen.dtsi to system-user.dtsi"
$(CP) ${FILE_SYSTEM_USR} ${FILE_SYSTEM_USR}.${TIME}.old
$(CP) ./src/xen.dtsi ${PROJ_PATH}/project-spec/meta-user/recipes-bsp/device-tree/files/xen.dtsi
@sed -i \
's?/include/ "system-conf.dtsi"?/include/ "system-conf.dtsi"\n/include/ "xen.dtsi"\n/include/ "xen-qemu.dtsi"?' \
${FILE_SYSTEM_USR}
ifeq ("${QEMU}","TRUE")
$(INFO) "Disabling virtual cores for QEMU"
$(CP) ./src/xen-qemu.dtsi ${PROJ_PATH}/project-spec/meta-user/recipes-bsp/device-tree/files/xen-qemu.dtsi
else
$(INFO) "Enabling virtual cores for HW"
$(ECHO) "/ {\n};" | \
tee ${PROJ_PATH}/project-spec/meta-user/recipes-bsp/device-tree/files/xen-qemu.dtsi > \
/dev/null
endif
$(INFO) "Including xen.dtsi to device-tree.bbappend"
$(CP) ${DT_BBAPPEND} ${DT_BBAPPEND}.${TIME}.old
$(ECHO) "SRC_URI_append = \" file://xen.dtsi file://xen-qemu.dtsi\"" >> \
${DT_BBAPPEND}
$(OK) "Successfully modified the device tree"
$(OK) "Successfully enabled Xen Hypervisor"
disable_xen_hypervisor: ${FILE_SYSTEM_USR}.original ${DT_BBAPPEND}.original
$(WAIT) "Disabling Xen Hypervisor"
$(WAIT) "Updating ${FILE_MAIN_CFG}"
$(MAIN_CONFIG) $(DISABLE) SUBSYSTEM_ROOTFS_INITRD
$(MAIN_CONFIG) $(ENABLE) SUBSYSTEM_ROOTFS_INITRAMFS
$(MAIN_CONFIG) $(SET_STR) CONFIG_SUBSYSTEM_INITRAMFS_IMAGE_NAME "petalinux-initramfs-image"
$(OK) "Successfully updated ${FILE_MAIN_CFG}"
$(WAIT) "Configuring ${FILE_MAIN_CFG}"
$(PETALINUX_CONFIG) && { \
$(PASS_CONFIG_LOG)disable_xen_main_config.log; \
} || { \
$(ERROR_CONFIG_LOG)disable_xen_main_config.log; \
exit $$?; \
}
$(OK) "Successfully configured ${FILE_MAIN_CFG}"
$(WAIT) "Updating ${FILE_ROOTFS_CFG}"
$(ROOTFS_CONFIG) $(DISABLE) packagegroup-petalinux-xen
$(OK) "Successfully updated ${FILE_ROOTFS_CFG}"
$(WAIT) "Configuring ${FILE_ROOTFS_CFG}"
$(PETALINUX_CONFIG) -c rootfs && { \
$(PASS_CONFIG_LOG)disable_xen_rootfs_config.log; \
} || { \
$(ERROR_CONFIG_LOG)disable_xen_rootfs_config.log; \
exit $$?; \
}
$(OK) "Successfully configured ${FILE_ROOTFS_CFG}"
$(WAIT) "Modifying the device tree"
$(INFO) "Excluding xen.dtsi & xen-qemu.dtsi from system-user.dtsi"
$(CP) ${FILE_SYSTEM_USR} ${FILE_SYSTEM_USR}.${TIME}.old
$(ECHO) "/ {\n};" | \
tee ${PROJ_PATH}/project-spec/meta-user/recipes-bsp/device-tree/files/xen-qemu.dtsi > \
/dev/null
@cat ${FILE_SYSTEM_USR} | \
tr '\n' '\f' | \
sed -e 's?\f/include/ "xen.dtsi"\f/include/ "xen-qemu.dtsi"??' | \
tr '\f' '\n' | tee ${FILE_SYSTEM_USR} > \
/dev/null
$(INFO) "Excluding xen.dtsi from device-tree.bbappend"
$(CP) ${DT_BBAPPEND} ${DT_BBAPPEND}.${TIME}.old
@cat ${DT_BBAPPEND} | \
tr '\n' '\f' | \
sed -e 's?\fSRC_URI_append = " file://xen.dtsi file://xen-qemu.dtsi"??' | \
tr '\f' '\n' | \
tee ${DT_BBAPPEND} > \
/dev/null
$(OK) "Successfully modified the device tree"
$(OK) "Successfully disabled Xen Hypervisor"
# =========================================================
# BUILD & PACKAGE
# =========================================================
${LINUX_DIR}/ ${ROOTFS} ${IMAGE} ${BL31} ${BOOT_SCR}: update_build
update_build:
$(WAIT) "Updating build"
$(INFO) "Removing output dependencies"
$(RM) update_build update_bootimage update_sdk update_sysroot
$(INFO) "Building image"
$(PETALINUX_BUILD) && { \
$(PASS_BUILD_LOG)build.log; \
touch ../update_build; \
} || { \
$(ERROR_BUILD_LOG)build.log; \
exit $$?; \
}
$(OK) "Successfully updated build"
${BOOT} ${BOOT_BH} ${QEMU_BOOT} ${PLM} ${PSMFW} ${UBOOT} ${DTB}: update_bootimage
update_bootimage: ${ROOTFS} ${IMAGE} ${BL31} ${BOOT_SCR}
$(WAIT) "Updating BOOT image"
$(INFO) "Removing output dependencies"
$(RM) update_bootimage
$(INFO) "Packaging BOOT image"
$(PETALINUX_PACKAGE) --boot --plm --psmfw --u-boot --dtb --force && { \
$(PASS_PACKAGE_LOG)bootimage.log; \
touch ../update_bootimage; \
} || { \
$(ERROR_PACKAGE_LOG)bootimage.log; \
exit $$?; \
}
$(OK) "Successfully packaged BOOT image"
update_wic: update_bootimage
$(WAIT) "Updating WIC package"
$(INFO) "Removing output dependencies"
$(RM) update_wic
$(INFO) "Generating WIC package"
$(PETALINUX_PACKAGE) --wic && { \
$(PASS_PACKAGE_LOG)wic.log; \
touch ../update_wic; \
} || { \
$(ERROR_PACKAGE_LOG)wic.log; \
exit $$?; \
}
$(OK) "Successfully generated WIC package"
${SDK}: update_sdk
update_sdk: ${ROOTFS} ${IMAGE} ${BL31} ${BOOT_SCR}
$(WAIT) "Building SDK"
$(INFO) "Removing output dependencies"
$(RM) update_sdk update_sysroot
ifeq (${LINUX_BUILD_SRC},"local")
# Turn Network Access ON here, since it's not included in the MIRROR
$(INFO) "Turning Network Access ON"
$(MAIN_CONFIG) $(DISABLE) CONFIG_YOCTO_BB_NO_NETWORK
$(PETALINUX_CONFIG)
endif
$(PETALINUX_BUILD) --sdk && { \
$(PASS_BUILD_LOG)sdk.log; touch ../update_sdk; \
} || { \
$(ERROR_BUILD_LOG)sdk.log; \
exit $$?; \
}
ifeq (${LINUX_BUILD_SRC},"local")
# Turn Network Access ON here, since it's not included in the MIRROR
$(INFO) "Turning Network Access OFF"
$(MAIN_CONFIG) $(ENABLE) CONFIG_YOCTO_BB_NO_NETWORK
$(PETALINUX_CONFIG)
endif
$(OK) "Successfully built SDK"
${SYSROOT}/: update_sysroot
update_sysroot: ${SDK}
$(WAIT) "Packaging sysroot"
$(INFO) "Removing output dependencies"
$(RM) update_sysroot
@mkdir -p ${SYSROOT}
$(PETALINUX_PACKAGE) --sysroot -d ${SYSROOT} && { \
$(PASS_PACKAGE_LOG)sysroot.log; \
touch ../update_sysroot; \
} || { \
$(ERROR_PACKAGE_LOG)sysroot.log; \
exit $$?; \
}
$(OK) "Successfully packaged sysroot"
# =========================================================
# SD CARD
# =========================================================
.PHONY: sd_card
common_image: ${COMMON_IMAGE}
$(WAIT) "Extracting Versal common image"
$(RM) -r common_image
@tar -xvzf ${COMMON_IMAGE} -C .
@mv xilinx-versal-common-v${XILINX_VER} common_image
$(OK) "Successfully extracted Versal common image"
sd_card: common_image ${BOOT} ${BOOT_SCR} ${BL31} ${IMAGE}
$(WAIT) "Generating SD card directory structure"
$(RM) -r sd_card
@mkdir -p sd_card/boot
@mkdir -p sd_card/root
$(INFO) "Copying valid files from Versal common image:"
$(INFO) " -Linux Kernel"
$(CP) common_image/Image sd_card/boot/Image
$(INFO) " -Yocto Project SDK (includes sysroot)"
$(CP) common_image/sdk.sh sd_card/boot/sdk.sh
$(INFO) " -Boot script"
$(CP) common_image/boot.scr sd_card/boot/boot.scr
$(INFO) "Copying generated files from PetaLinux project:"
$(INFO) " -BOOT image (includes: fractal_platform_presynth.pdi, plm.elf, psmfw.elf, system.dtb, bl31.elf & u-boot.elf)"
$(CP) ${BOOT} sd_card/boot/BOOT.BIN
$(INFO) " -U-Boot"
$(CP) common_image/boot.scr sd_card/boot/boot.scr
$(INFO) " -RootFS"
$(CP) ${ROOTFS} sd_card/root/rootfs.ext4
# Boot script
# $(CP) ${BOOT_SCR} sd_card/boot/boot.scr
# Kernel
# $(CP) ${IMAGE} sd_card/root/Image
$(OK) "Successfully generated SD card directory structure"
# =========================================================
# QEMU SIMULATION
# =========================================================
.PHONY: qemu
qemu: update_bootimage
$(WAIT) "Launching QEMU"
$(ECHO) "$(PETALINUX_BOOT) --qemu --kernel" | \
tee ${PWD}/qemu > \
/dev/null
@chmod +x ${PWD}/qemu
@script -q ${PWD}/${TIME}_qemu.log -c ${PWD}/qemu && rm -f ${PWD}/qemu
@cat ${PWD}/${TIME}_qemu.log | \
tr -d '\f' | \
tr -d '\r' | \
tee ${PWD}/${TIME}_qemu.log > \
/dev/null
$(CP) ${PWD}/${TIME}_qemu.log ${PWD}/${TIME}_qemu_trimmed.log
@sed -i -E \
"s#\[[ [:digit:]]{5}\.[[:digit:]]{3,6}\]#[ 0.000000]#gI" \
${PWD}/${TIME}_qemu_trimmed.log
@sed -i -E \
"s#[ ]*[[:digit:]\.]+ (([mn]s)|([KM](i)?(B(\/s(ec)?)?)?)|([KM]?Byte(s)?))# 0 \1#gI" \
${PWD}/${TIME}_qemu_trimmed.log
@sed -i -E \
"s#([[:alnum:]]{2}:){5,19}([[:alnum:]]{2})#00:00:00:00:00:00#gI" \
${PWD}/${TIME}_qemu_trimmed.log
@sed -i -E \
"s#[[:digit:]]{4}-[[:digit:]]{1,2}-[[:digit:]]{1,2}[ T][[:digit:]]{1,2}:[[:digit:]]{1,2}:[[:digit:]]{2}([\+\-][[:digit:]]{2}:[[:digit:]]{2})?#0000-00-00 00:00:00#gI" \
${PWD}/${TIME}_qemu_trimmed.log
@sed -i -E \
"s#/tmp\.[[:alnum:]]+#/tmp\.rnd#gI" \
${PWD}/${TIME}_qemu_trimmed.log
@sed -i -E \
"s#(ssh-rsa )?.* ?root@fractal_versal#\1 root@fractal_versal:~#g" \
${PWD}/${TIME}_qemu_trimmed.log
$(OK) "Exited from QEMU"