summaryrefslogtreecommitdiff
path: root/embedded-test.sh
blob: a0e43cba2d510b6b1c9b23fec0c5ee5edd60e380 (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
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
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
#!/usr/bin/env mksh
#
# Copyright © 2014-2023
#	Waldemar Brodkorb <wbx@openadk.org>
#
# Provided that these terms and disclaimer and all copyright notices
# are retained or reproduced in an accompanying document, permission
# is granted to deal in this work without restriction, including un‐
# limited rights to use, publicly perform, distribute, sell, modify,
# merge, give away, or sublicence.
#
# This work is provided “AS IS” and WITHOUT WARRANTY of any kind, to
# the utmost extent permitted by applicable law, neither express nor
# implied; without malicious intent or gross negligence. In no event
# may a licensor, author or contributor be held liable for indirect,
# direct, other damage, loss, or other issues arising in any way out
# of dealing in the work, even if advised of the possibility of such
# damage or existence of a defect, except proven that it results out
# of said person’s immediate fault when using the work as intended.
#
# Alternatively, this work may be distributed under the Terms of the
# General Public License, any version as published by the Free Soft‐
# ware Foundation.

# uClibc-ng
arch_list_uclibcng="aarch64 aarch64be alpha arcv2 \
  armv5 armv5-nommu-thumb armv6 armv7 \
  armv7-thumb2 armv8 armv8-thumb2 armeb avr32 \
  bf512-flat bf512-fdpic bf532-flat bf532-fdpic \
  crisv10 crisv32 csky-ck807 csky-ck810 \
  h8300-h8300h h8300-h8s hppa ia64 kvx lm32 \
  m68k m68k-nommu metag microblazeel microblazebe \
  mips32 mips32r6 mips32sf mips32el mips32r6el mips32elsf \
  mips64 mips64n32 mips64n64 mips64el mips64eln32 mips64eln64 \
  mips64r6n32 mips64r6n64 mips64r6eln32 mips64r6eln64 nds32le \
  nios2 or1k ppc ppcsf riscv64 sh2 sh2eb sh3 sh3eb sh4 sh4eb \
  sparc sparc-leon3 sparc64 tilegx x86 x86_64 \
  xtensa xtensabe xtensa-nommu"

# musl
arch_list_musl="aarch64 aarch64be armv5 armv6 armv7 armeb \
  m68k microblazeel microblazebe \
  mips32 mips32r6 mips32sf mips32el mips32elsf \
  mips64n32 mips64n64 mips64eln32 mips64eln64 \
  or1k ppc ppcsf ppc64 ppc64le riscv64 s390 sh4 sh4eb \
  x86 x86_64 x86_64_x32"

# glibc
arch_list_glibc="aarch64 aarch64be alpha armv7 arcv2 \
  csky-ck807 csky-ck810 ia64 m68k microblazeel microblazebe \
  mips32 mips32r6 mips32sf mips32el mips32elsf \
  mips64 mips64n32 mips64n64 mips64el mips64eln32 mips64eln64 \
  mips64r6n32 mips64r6n64 mips64r6eln32 mips64r6eln64 loongarch \
  nios2 or1k ppc ppcsf ppc64 ppc64le riscv32 riscv64 s390 sh4 sh4eb sparc64 \
  x86_64 x86_64_x32"

# newlib
arch_list_newlib="aarch64 aarch64be armv5 bfin crisv10 \
  crisv32 csky-ck807 epiphany ft32 frv h8300-h8300h ia64 m32r m68k microblazeel \
  microblazebe mips32 mips32el mn10300 moxie msp430 nds32le nds32be \
  nios2 or1k ppc riscv64 rx sh sparc v850 x86 x86_64 xtensa"

topdir=$(pwd)
giturl=git://openadk.org/git/openadk
valid_os="linux"
valid_libc="uclibc-ng musl glibc newlib"
valid_tests="toolchain boot libc ltp mksh native"
valid_thread_types="none lt nptl"

bootserver=10.0.0.1
buildserver=10.0.0.2

tools='make git xz cpio tar awk sed'
f=0
for tool in $tools; do
  if ! which $tool >/dev/null; then
    echo "Checking if $tool is installed... failed"
    f=1
  fi
done
if [ $f -eq 1 ]; then 
  exit 1
fi

help() {
	cat >&2 <<EOF
Syntax: $0 [ --libc=<libc> --os=<os> --arch=<arch> --test=<test> ]

Explanation:
	--libc=<libc>                C library to use (${valid_libc})
	--os=<operating system>      operating system to use (${valid_os})
	--arch=<arch>                architecture to check (otherwise all supported)
	--skip-arch=<arch>           architectures to skip when all choosen
	--targets=<targets.txt>      a list of remote targets to test via nfsroot or chroot
	--test=<test>                run test (${valid_tests}), default toolchain
	--threads=<type>             configure threading support (${valid_thread_types}) (only for uClibc-ng)
	--libc-source=<dir>          use directory with source for C library
	--gcc-source=<dir>           use directory with source for gcc
	--binutils-source=<dir>      use directory with source for binutils
	--gdb-source=<dir>           use directory with source for gdb
        --kernel-source=<dir>        use directory with source for kernel
	--libc-version=<version>     use version of C library
	--gcc-version=<version>      use version of gcc
	--binutils-version=<version> use version of binutils
	--gdb-version=<version>      use version of gdb 
	--kernel-version=<version>   use version of kernel
	--ntp=<ntpserver>            set NTP server for test run
	--packages=<packagelist>     add extra packages to the build
	--update                     update OpenADK source via git pull, before building
	--create                     create toolchain archive for external usage
	--continue                   continue on a broken build
	--cleandir                   clean OpenADK build directories before build
	--clean                      clean OpenADK build directory for single arch
	--no-clean                   do not clean OpenADK build directory for single arch
	--cxx                        enable C++ toolchain
	--static                     use static compilation
	--ssp                        use smack stashing protection
	--debug                      make debug build
	--verbose                    enable verbose output from OpenADK
	--shell                      start a shell instead of test autorun
	--help                       this help text
EOF
	exit 1
}

cont=0
clean=0
noclean=0
cleandir=0
shell=0
update=0
verbose=0
create=0
static=0
cxx=0
ssp=0
debug=0
ntp=""
libc=""
os="linux"
test="toolchain"

while [[ $1 != -- && $1 = -* ]]; do case $1 { 
  (--cleandir) cleandir=1; shift ;;
  (--clean) clean=1; shift ;;
  (--no-clean) noclean=1; shift ;;
  (--verbose) verbose=1; shift ;;
  (--update) update=1; shift ;;
  (--create) create=1; shift ;;
  (--static) static=1; shift ;;
  (--cxx) cxx=1; shift ;;
  (--ssp) ssp=1; shift ;;
  (--debug) debug=1; shift ;;
  (--continue) cont=1; shift ;;
  (--shell) shell=1 shift ;;
  (--libc=*) libc=${1#*=}; shift ;;
  (--os=*) os=${1#*=}; shift ;;
  (--arch=*) archs=${1#*=}; shift ;;
  (--skip-arch=*) skiparchs=${1#*=}; shift ;;
  (--targets=*) targets=${1#*=}; shift ;;
  (--test=*) test=${1#*=}; shift ;;
  (--threads=*) threads=${1#*=}; shift ;;
  (--libc-source=*) libcsource=${1#*=}; shift ;;
  (--gcc-source=*) gccsource=${1#*=}; shift ;;
  (--binutils-source=*) binutilssource=${1#*=}; shift ;;
  (--gdb-source=*) gdbsource=${1#*=}; shift ;;
  (--kernel-source=*) kernelsource=${1#*=}; shift ;;
  (--libc-version=*) libcversion=${1#*=}; shift ;;
  (--gcc-version=*) gccversion=${1#*=}; shift ;;
  (--binutils-version=*) binutilsversion=${1#*=}; shift ;;
  (--gdb-version=*) gdbversion=${1#*=}; shift ;;
  (--kernel-version=*) kernelversion=${1#*=}; shift ;;
  (--packages=*) packages=${1#*=}; shift ;;
  (--ntp=*) ntp=${1#*=}; shift ;;
  (--help) help; shift ;;
  (--*) echo "unknown option $1"; exit 1 ;; 
  (-*) help ;;
}; done

if [ ! -z $targets ]; then
  targetmode=1
fi

if [ -z "$libc" ]; then
  if [[ $libcversion ]]; then
    echo "You can not use a specific C library version without setting the C library"
    exit 1
  else
    libc="uclibc-ng musl glibc newlib"
  fi
fi

if [ $static -eq 1 ]; then
  rsuffix=${rsuffix}.static
fi
if [ $ssp -eq 1 ]; then
  rsuffix=${rsuffix}.ssp
fi
if [ $debug -eq 1 ]; then
  rsuffix=${rsuffix}.debug
fi
if [ $cxx -eq 1 ]; then
  rsuffix=${rsuffix}.cxx
fi

if [ ! -d openadk ]; then
  git clone $giturl
  if [ $? -ne 0 ]; then
    echo "Cloning from $giturl failed."
    exit 1
  fi
else
  if [ $update -eq 1 ]; then
    (cd openadk && git pull)
    if [ $? -ne 0 ]; then
      echo "Updating from $giturl failed."
      exit 1
    fi
  fi
fi

get_arch_info() {
  arch=$1
  lib=$2

  emulator=qemu
  gdbcmd=
  noappend=0
  piggyback=0
  endian=
  suffix=
  allowed_libc=
  runtime_test=
  qemu_args=-nographic

  case ${arch} in
    aarch64)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc ltp mksh native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=aarch64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-aarch64"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=aarch64"
      cpu_arch=cortex_a53
      qemu_machine=virt
      qemu_args="${qemu_args} -m 256 -cpu cortex-a53 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
      suffix=${cpu_arch}
      skiplt=aarch64
      ;;
    aarch64be)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=generic-aarch64 ADK_TARGET_ENDIAN=big"
      default_musl="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=generic-aarch64 ADK_TARGET_ENDIAN=big"
      default_glibc="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=aarch64 ADK_TARGET_SYSTEM=generic-aarch64 ADK_TARGET_ENDIAN=big"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=aarch64 ADK_TARGET_ENDIAN=big"
      cpu_arch=cortex_a53
      qemu_machine=virt
      qemu_args="${qemu_args} -cpu cortex-a53 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
      suffix=${cpu_arch}
      skiplt=aarch64be
      ;;
    alpha)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc ltp mksh"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=alpha ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-alpha"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=alpha ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-alpha"
      march=alpha
      qemu=qemu-system-alpha
      qemu_machine=clipper
      qemu_args="${qemu_args} -monitor null -m 256"
      ;;
    armv5)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc ltp mksh native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-versatilepb"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=arm ADK_TARGET_ENDIAN=little ADK_TARGET_CPU=arm926ej-s"
      cpu_arch=arm926ej_s
      march=arm-versatilepb
      qemu=qemu-system-arm
      qemu_machine=versatilepb
      suffix=${cpu_arch}_soft_eabi_arm
      dtbdir=openadk/firmware/qemu-${march}_${lib}_${suffix}
      qemu_args="${qemu_args} -cpu arm926 -net user -net nic,model=smc91c111 -dtb ${dtbdir}/versatile-pb.dtb"
      ;;
    armv5-nommu-arm)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain boot libc"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-arm-versatilepb ADK_TARGET_ENDIAN=little ADK_TARGET_MMU=no ADK_TARGET_INSTRUCTION_SET=arm ADK_TARGET_BINFMT=flat ADK_TARGET_THREADS=lt"
      cpu_arch=arm926ej_s
      march=arm-versatilepb
      qemu=qemu-system-arm
      qemu_machine=versatilepb
      suffix=${cpu_arch}_soft_eabi_flat_arm_nommu
      dtbdir=openadk/firmware/qemu-${march}_${lib}_${suffix}
      qemu_args="${qemu_args} -m 256 -cpu arm926 -net user -net nic,model=smc91c111 -dtb ${dtbdir}/versatile-pb.dtb"
      piggyback=1
      ;;
    armv5-nommu-thumb)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain boot libc"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-arm-versatilepb ADK_TARGET_ENDIAN=little ADK_TARGET_MMU=no ADK_TARGET_INSTRUCTION_SET=thumb ADK_TARGET_BINFMT=flat ADK_TARGET_THREADS=lt"
      cpu_arch=arm926ej_s
      march=arm-versatilepb
      qemu=qemu-system-arm
      qemu_machine=versatilepb
      suffix=${cpu_arch}_soft_eabi_flat_thumb_nommu
      dtbdir=openadk/firmware/qemu-${march}_${lib}_${suffix}
      qemu_args="${qemu_args} -m 256 -cpu arm926 -net user -net nic,model=smc91c111 -dtb ${dtbdir}/versatile-pb.dtb"
      piggyback=1
      ;;
    armv6)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc ltp mksh native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-realview-eb-mpcore"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-realview-eb-mpcore"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-realview-eb-mpcore"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=arm ADK_TARGET_ENDIAN=little ADK_TARGET_CPU=arm1176jzf-s"
      cpu_arch=mpcore
      march=arm-realview-eb-mpcore
      qemu=qemu-system-arm
      qemu_machine=realview-eb-mpcore
      suffix=${cpu_arch}_hard_eabihf_arm
      dtbdir=openadk/firmware/qemu-${march}_${lib}_${suffix}
      qemu_args="${qemu_args} -net user -net nic -dtb ${dtbdir}/arm-realview-eb-11mp-ctrevb.dtb"
      ;;
    armv7)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc ltp mksh native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
      cpu_arch=cortex_a9
      march=arm-vexpress-a9
      qemu=qemu-system-arm
      qemu_machine=vexpress-a9
      suffix=${cpu_arch}_hard_eabihf_arm
      dtbdir=openadk/firmware/qemu-${march}_${lib}_${suffix}
      qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
      ;;
    armv7-thumb2)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain boot libc ltp mksh native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_INSTRUCTION_SET=thumb ADK_TARGET_FS=initramfsarchive ADK_TARGET_FLOAT=soft ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9"
      cpu_arch=cortex_a9
      march=arm-vexpress-a9
      qemu=qemu-system-arm
      qemu_machine=vexpress-a9
      suffix=${cpu_arch}_soft_eabi_thumb
      dtbdir=openadk/firmware/qemu-${march}_${lib}_${suffix}
      qemu_args="${qemu_args} -cpu cortex-a9 -net user -net nic,model=lan9118 -dtb ${dtbdir}/vexpress-v2p-ca9.dtb"
      ;;
    armv8)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9 ADK_TARGET_CPU=cortex-a53"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9 ADK_TARGET_CPU=cortex-a53"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9 ADK_TARGET_CPU=cortex-a53"
      cpu_arch=cortex_a53
      suffix=${cpu_arch}_hard_eabihf_arm
      ;;
    armv8-thumb2)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_INSTRUCTION_SET=thumb ADK_TARGET_FS=initramfsarchive ADK_TARGET_FLOAT=soft ADK_TARGET_SYSTEM=qemu-arm-vexpress-a9 ADK_TARGET_CPU=cortex-a53"
      cpu_arch=cortex_a53
      suffix=${cpu_arch}_soft_eabi_thumb
      ;;
    armeb)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=generic-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=generic-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arm ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=generic-arm ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
      ;;
    arcv2)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc ltp mksh native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-arc ADK_TARGET_ENDIAN=little ADK_TARGET_CPU=archs"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=arc ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-arc ADK_TARGET_ENDIAN=little ADK_TARGET_CPU=archs"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=arc ADK_TARGET_ENDIAN=little ADK_TARGET_CPU=archs"
      qemu=qemu-system-arc
      qemu_machine=virt
      qemu_args="-nographic -monitor none -serial stdio -cpu archs -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
      cpu_arch=archs
      march=arc
      suffix=${cpu_arch}
      piggyback=1
      ;;
    avr32)
      allowed_libc="uclibc-ng"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=avr32 ADK_TARGET_SYSTEM=generic-avr32"
      ;;
    bf512-flat)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=sim-bfin ADK_TARGET_BINFMT=flat"
      emulator=gdb
      model=bf512
      march=bfin
      binfmt=flat
      gdbcmd="bfin-openadk-uclinux-uclibc-run --env operating --model bf512"
      piggyback=1
      suffix=bf512_flat
      ;;
    bf512-fdpic)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=bfin ADK_TARGET_SYSTEM=sim-bfin ADK_TARGET_BINFMT=fdpic"
      emulator=gdb
      model=bf512
      march=bfin
      binfmt=fdpic
      gdbcmd="bfin-openadk-linux-uclibc-run --env operating --model bf512"
      piggyback=1
      suffix=bf512_fdpic
      ;;
    bf532-flat)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=bfin ADK_TARGET_CPU=bf532 ADK_TARGET_SYSTEM=sim-bfin ADK_TARGET_BINFMT=flat"
      emulator=gdb
      model=bf532
      march=bfin
      binfmt=flat
      gdbcmd="bfin-openadk-uclinux-uclibc-run --env operating --model bf532"
      piggyback=1
      suffix=bf532_flat
      ;;
    bf532-fdpic)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=bfin ADK_TARGET_CPU=bf532 ADK_TARGET_SYSTEM=sim-bfin ADK_TARGET_BINFMT=fdpic"
      emulator=gdb
      model=bf532
      march=bfin
      binfmt=fdpic
      gdbcmd="bfin-openadk-linux-uclibc-run --env operating --model bf532"
      piggyback=1
      suffix=bf532_fdpic
      ;;
    bfin)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=bfin"
      ;;
    c6x)
      allowed_libc="uclibc-ng"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=c6x ADK_TARGET_SYSTEM=generic-c6x ADK_TARGET_ENDIAN=little"
      ;;
    crisv10)
      allowed_libc="uclibc-ng newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=cris ADK_TARGET_SYSTEM=generic-cris ADK_TARGET_CPU=crisv10"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=cris ADK_TARGET_CPU=crisv10"
      ;;
    crisv32)
      allowed_libc="uclibc-ng newlib"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain boot libc ltp"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=cris ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-cris"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=cris ADK_TARGET_CPU=crisv32"
      cpu_arch=crisv32
      march=cris
      qemu=qemu-system-${march}
      qemu_machine=axis-dev88
      piggyback=1
      suffix=${cpu_arch}
      ;;
    csky-ck807)
      allowed_libc="uclibc-ng glibc newlib"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot mksh native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=csky ADK_TARGET_SYSTEM=qemu-csky ADK_TARGET_CPU=ck807 ADK_TARGET_ENDIAN=little"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=csky ADK_TARGET_SYSTEM=qemu-csky ADK_TARGET_CPU=ck807 ADK_TARGET_ENDIAN=little"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=csky ADK_TARGET_CPU=ck807 ADK_TARGET_ENDIAN=little"
      march=csky
      qemu=qemu-system-cskyv2
      qemu_args="-nographic -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
      qemu_machine=virt
      piggyback=1
      suffix=soft
      skiplt=csky-ck807
      ;;
    csky-ck810)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot mksh native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=csky ADK_TARGET_SYSTEM=qemu-csky ADK_TARGET_CPU=ck810 ADK_TARGET_ENDIAN=little"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=csky ADK_TARGET_SYSTEM=qemu-csky ADK_TARGET_CPU=ck810 ADK_TARGET_ENDIAN=little"
      march=csky
      qemu=qemu-system-cskyv2
      qemu_args="-nographic -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
      qemu_machine=virt
      piggyback=1
      suffix=soft
      skiplt=csky-ck810
      ;;
    epiphany)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=epiphany"
      ;;
    ft32)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=ft32"
      ;;
    frv)
      allowed_libc="uclibc-ng newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=frv ADK_TARGET_SYSTEM=generic-frv"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=frv"
      ;;
    ia64)
      allowed_libc="uclibc-ng glibc newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=ia64 ADK_TARGET_SYSTEM=generic-ia64"
      default_glibc="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=ia64 ADK_TARGET_SYSTEM=generic-ia64"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=ia64"
      ;;
    kvx)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=kvx ADK_TARGET_SYSTEM=qemu-kvx"
      qemu=qemu-system-kvx
      qemu_args="-nographic"
      qemu_machine=mppa-coolidge
      piggyback=1
      skiplt=kvx
      ;;
    h8300-h8300h)
      allowed_libc="uclibc-ng newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=h8300 ADK_TARGET_CPU=h8300h ADK_TARGET_SYSTEM=sim-h8300"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=h8300 ADK_TARGET_CPU=h8300h"
      ;;
    h8300-h8s)
      allowed_libc="uclibc-ng newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=h8300 ADK_TARGET_CPU=h8s ADK_TARGET_SYSTEM=sim-h8300"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=h8300 ADK_TARGET_CPU=h8s"
      ;;
    hppa)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=hppa ADK_TARGET_SYSTEM=qemu-hppa"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=hppa ADK_TARGET_SYSTEM=qemu-hppa"
      qemu=qemu-system-hppa
      qemu_args="-nographic -device e1000,netdev=adk0 -netdev user,id=adk0"
      qemu_machine=hppa
      piggyback=1
      ;;
    lm32)
      allowed_libc="uclibc-ng newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=lm32 ADK_TARGET_SYSTEM=qemu-lm32"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=lm32"
      skipcxx=lm32
      ;;
    loongarch)
      allowed_libc="glibc"
      runtime_test="glibc"
      allowed_tests="toolchain"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=loongarch ADK_TARGET_SYSTEM=qemu-loongarch"
      qemu=qemu-system-loongarch64
      qemu_machine=virt
      qemu_args='-nographic -bios target/loongarch/QEMU_EFI.fd -append console=ttyS0,115200'
      piggyback=1
      ;;
    m32r)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=m32r"
      ;;
    m68k)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800 ADK_TARGET_CPU=68040"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800 ADK_TARGET_CPU=68040"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-q800 ADK_TARGET_CPU=68040"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=m68k ADK_TARGET_CPU=68040"
      cpu_arch=68040
      march=m68k-q800
      qemu=qemu-system-m68k
      qemu_args="-nographic"
      qemu_machine=q800
      suffix=${cpu_arch}
      ;;
    m68k-nommu)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain boot libc"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=m68k ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-m68k-mcf5208 ADK_TARGET_MMU=no"
      cpu_arch=cf5208
      march=m68k-mcf5208
      qemu=qemu-system-m68k
      qemu_args="-nographic -m 256"
      qemu_machine=mcf5208evb
      suffix=${cpu_arch}_nommu
      piggyback=1
      ;;
    metag)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain boot libc"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=metag ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-metag"
      cpu_arch=metag
      qemu=qemu-system-meta
      qemu_args="-nographic -display none -device da,exit_threads=1 -chardev stdio,id=chan1 -chardev pty,id=chan2"
      qemu_machine=01sp
      piggyback=1
      skiplt=metag
      skipstatic=metag
      ;;
    microblazeel)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-s3adsp1800 ADK_TARGET_ENDIAN=little"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-s3adsp1800 ADK_TARGET_ENDIAN=little"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-s3adsp1800 ADK_TARGET_ENDIAN=little"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=microblaze ADK_TARGET_ENDIAN=little"
      cpu_arch=microblaze
      endian=el
      march=microblaze-s3adsp1800
      qemu=qemu-system-microblazeel
      qemu_machine=petalogix-s3adsp1800
      suffix=${cpu_arch}${endian}
      skipssp=microblazeel
      ;;
    microblazebe)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-s3adsp1800 ADK_TARGET_ENDIAN=big"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-s3adsp1800 ADK_TARGET_ENDIAN=big"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=microblaze ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-microblaze-s3adsp1800 ADK_TARGET_ENDIAN=big"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=microblaze ADK_TARGET_ENDIAN=big"
      cpu_arch=microblaze
      march=microblaze-s3adsp1800
      qemu=qemu-system-microblaze
      qemu_machine=petalogix-s3adsp1800
      suffix=${cpu_arch}
      skipssp=microblazebe
      ;;
    mips32)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=mips ADK_TARGET_ENDIAN=big"
      cpu_arch=mips32
      march=mips
      qemu=qemu-system-mips
      qemu_machine=malta
      qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}_hard
      ;;
    mips32r6)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32r6"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32r6"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32r6"
      cpu_arch=mips32r6
      march=mips
      qemu=qemu-system-mips
      qemu_machine=malta
      qemu_args="${qemu_args} -cpu mips32r6-generic -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}_hard
      ;;
    mips32sf)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=soft ADK_TARGET_CPU=mips32"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=soft ADK_TARGET_CPU=mips32"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=big ADK_TARGET_FLOAT=soft ADK_TARGET_CPU=mips32"
      cpu_arch=mips32
      march=mips
      qemu=qemu-system-mips
      qemu_machine=malta
      qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}_soft
      ;;
    mips32el)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=mips ADK_TARGET_ENDIAN=little"
      cpu_arch=mips32
      endian=el
      march=mips
      qemu=qemu-system-mipsel
      qemu_machine=malta
      qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}${endian}_hard
      ;;
    mips32r6el)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32r6"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32r6"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=hard ADK_TARGET_CPU=mips32r6"
      cpu_arch=mips32r6
      march=mips
      qemu=qemu-system-mipsel
      qemu_machine=malta
      qemu_args="${qemu_args} -cpu mips32r6-generic -device e1000,netdev=adk0 -netdev user,id=adk0"
      endian=el
      suffix=${cpu_arch}${endian}_hard
      ;;
    mips32elsf)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=soft ADK_TARGET_CPU=mips32"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=soft ADK_TARGET_CPU=mips32"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips ADK_TARGET_ENDIAN=little ADK_TARGET_FLOAT=soft ADK_TARGET_CPU=mips32"
      cpu_arch=mips32
      endian=el
      march=mips
      qemu=qemu-system-mipsel
      qemu_machine=malta
      qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}${endian}_soft
      ;;
    mips64)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32 ADK_TARGET_CPU=mips64"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=o32 ADK_TARGET_CPU=mips64"
      cpu_arch=mips64
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}_o32
      ;;
    mips64r6n32)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64r6"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64r6"
      cpu_arch=mips64r6
      march=mips64
      qemu=qemu-system-${march}
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -cpu I6400 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}_n32
      ;;
    mips64r6n64)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64r6"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64r6"
      cpu_arch=mips64r6
      march=mips64
      qemu=qemu-system-${march}
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -cpu I6400 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}_n64
      ;;
    mips64n32)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64"
      cpu_arch=mips64
      march=mips64
      qemu=qemu-system-${cpu_arch}
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}_n32
      ;;
    mips64n64)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=big ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64"
      cpu_arch=mips64
      march=mips64
      qemu=qemu-system-${cpu_arch}
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}_n64
      ;;
    mips64el)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32 ADK_TARGET_CPU=mips64"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=o32 ADK_TARGET_CPU=mips64"
      cpu_arch=mips64
      march=mips64
      endian=el
      qemu=qemu-system-mips64el
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}${endian}_o32
      ;;
    mips64eln32)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64"
      cpu_arch=mips64
      march=mips64
      endian=el
      qemu=qemu-system-mips64el
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}${endian}_n32
      ;;
    mips64eln64)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64"
      cpu_arch=mips64
      march=mips64
      endian=el
      qemu=qemu-system-mips64el
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}${endian}_n64
      ;;
    mips64r6eln32)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64r6"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n32 ADK_TARGET_CPU=mips64r6"
      cpu_arch=mips64r6
      march=mips64
      endian=el
      qemu=qemu-system-mips64el
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -cpu I6400 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}${endian}_n32
      ;;
    mips64r6eln64)
      allowed_libc="uclibc-ng glibc"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64r6"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=mips64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-mips64 ADK_TARGET_ENDIAN=little ADK_TARGET_ABI=n64 ADK_TARGET_CPU=mips64r6"
      cpu_arch=mips64r6
      march=mips64
      endian=el
      qemu=qemu-system-mips64el
      qemu_machine=malta
      qemu_args="${qemu_args} -m 256 -cpu I6400 -device e1000,netdev=adk0 -netdev user,id=adk0"
      suffix=${cpu_arch}${endian}_n64
      ;;
    mn10300)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=mn10300"
      ;;
    moxie)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=moxie"
      ;;
    msp430)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=msp430"
      ;;
    nds32le)
      allowed_libc="uclibc-ng newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=nds32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=generic-nds32 ADK_TARGET_ENDIAN=little"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=nds32 ADK_TARGET_ENDIAN=little"
      ;;
    nds32be)
      allowed_libc="uclibc-ng newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=nds32 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=generic-nds32 ADK_TARGET_ENDIAN=big"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=nds32 ADK_TARGET_ENDIAN=big"
      ;;
    nios2)
      allowed_libc="uclibc-ng glibc newlib"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=nios2 ADK_TARGET_SYSTEM=qemu-nios2"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=nios2 ADK_TARGET_SYSTEM=qemu-nios2"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=nios2"
      qemu_machine=10m50-ghrd
      piggyback=1
      ;;
    or1k)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-or1k"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-or1k"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=or1k ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-or1k"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=or1k"
      qemu_machine=or1k-sim
      piggyback=1
      ;;
    ppc)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard ADK_TARGET_ENDIAN=big"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard ADK_TARGET_ENDIAN=big"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-macppc ADK_TARGET_FLOAT=hard ADK_TARGET_ENDIAN=big"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=ppc ADK_TARGET_ENDIAN=big"
      cpu_arch=ppc
      march=ppc-macppc
      qemu=qemu-system-${cpu_arch}
      qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
      qemu_machine=mac99
      suffix=hard
      noappend=1
      ;;
    ppcsf)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc-bamboo ADK_TARGET_FLOAT=soft ADK_TARGET_ENDIAN=big"
      cpu_arch=ppc
      march=ppc-bamboo
      qemu=qemu-system-${cpu_arch}
      qemu_args="${qemu_args} -device e1000,netdev=adk0 -netdev user,id=adk0"
      qemu_machine=bamboo
      suffix=soft
      ;;
    ppc64)
      allowed_libc="musl glibc"
      runtime_test="musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=big"
      cpu_arch=ppc64
      qemu=qemu-system-${cpu_arch}
      qemu_machine=pseries
      suffix=${cpu_arch}
      ;;
    ppc64le)
      allowed_libc="musl glibc"
      runtime_test="musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=little"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=ppc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-ppc64 ADK_TARGET_ENDIAN=little"
      cpu_arch=ppc64
      endian=le
      march=ppc64
      qemu=qemu-system-ppc64
      qemu_machine=pseries
      suffix=${cpu_arch}
      ;;
    riscv32)
      allowed_libc="glibc"
      runtime_test="glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=riscv32 ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-riscv32"
      cpu_arch=riscv32
      qemu=qemu-system-${cpu_arch}
      qemu_args="${qemu_args} -m 512 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
      qemu_machine=virt
      piggyback=1
      ;;
    riscv64)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=riscv64 ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-riscv64"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=riscv64 ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-riscv64"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=riscv64 ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-riscv64"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=riscv64"
      cpu_arch=riscv64
      qemu=qemu-system-${cpu_arch}
      qemu_args="${qemu_args} -m 512 -netdev user,id=eth0 -device virtio-net-device,netdev=eth0"
      qemu_machine=virt
      piggyback=1
      ;;
    rx)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=rx"
      ;;
    s390)
      allowed_libc="musl glibc"
      runtime_test="musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=s390 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-s390"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=s390 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-s390"
      cpu_arch=s390x
      qemu=qemu-system-${cpu_arch}
      qemu_machine=s390-ccw-virtio
      ;;
    sh)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=sh ADK_TARGET_ENDIAN=little ADK_TARGET_MMU=no"
      ;;
    sh2)
      allowed_libc="uclibc-ng"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=generic-sh ADK_TARGET_CPU=sh2 ADK_TARGET_MMU=no ADK_TARGET_ENDIAN=little"
      cpu_arch=sh2
      ;;
    sh2eb)
      allowed_libc="uclibc-ng"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=generic-sh ADK_TARGET_CPU=sh2 ADK_TARGET_MMU=no ADK_TARGET_ENDIAN=big"
      cpu_arch=sh2
      ;;
    sh3)
      allowed_libc="uclibc-ng"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=generic-sh ADK_TARGET_CPU=sh3 ADK_TARGET_MMU=no ADK_TARGET_ENDIAN=little"
      default_glibc="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=generic-sh ADK_TARGET_CPU=sh3 ADK_TARGET_MMU=no ADK_TARGET_ENDIAN=little"
      cpu_arch=sh3
      ;;
    sh3eb)
      allowed_libc="uclibc-ng"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=generic-sh ADK_TARGET_CPU=sh3 ADK_TARGET_MMU=no ADK_TARGET_ENDIAN=big"
      default_glibc="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_SYSTEM=generic-sh ADK_TARGET_CPU=sh3 ADK_TARGET_MMU=no ADK_TARGET_ENDIAN=big"
      cpu_arch=sh3
      ;;
    sh4)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=little"
      cpu_arch=sh4
      march=sh
      qemu=qemu-system-sh4
      qemu_machine=r2d
      qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
      suffix=${cpu_arch}
      ;;
    sh4eb)
      allowed_libc="uclibc-ng musl glibc"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sh ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sh ADK_TARGET_ENDIAN=big"
      cpu_arch=sh4eb
      march=sh
      qemu=qemu-system-sh4eb
      qemu_machine=r2d
      qemu_args="${qemu_args} -monitor null -serial null -serial stdio"
      suffix=${cpu_arch}
      ;;
    sparc)
      allowed_libc="uclibc-ng glibc newlib"
      runtime_test="uclibc-ng glibc"
      allowed_tests="toolchain boot libc"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sparc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sparc"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sparc ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sparc"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=sparc"
      cpu_arch=v8
      qemu=qemu-system-sparc
      qemu_machine=SS-10
      qemu_args="${qemu_args} -m 256"
      suffix=${cpu_arch}
      ;;
    sparc-leon3)
      allowed_libc="uclibc-ng"
      runtime_test=""
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=sparc ADK_TARGET_CPU=leon3 ADK_TARGET_SYSTEM=generic-sparc"
      cpu_arch=leon
      suffix=${cpu_arch}
      ;;
    sparc64)
      allowed_libc="uclibc-ng glibc newlib"
      runtime_test="glibc"
      allowed_tests="toolchain"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sparc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sparc64"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=sparc64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-sparc64"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=sparc64"
      cpu_arch=v9
      qemu=qemu-system-sparc64
      qemu_machine=sun4u
      qemu_args="${qemu_args} -net nic,model=e1000 -net user"
      suffix=${cpu_arch}
      ;;
    tilegx)
      allowed_libc="uclibc-ng glibc"
      runtime_test=""
      allowed_tests="toolchain"
      default_glibc="ADK_APPLIANCE=toolchain ADK_TARGET_OS=$os ADK_TARGET_ARCH=tile ADK_TARGET_CPU=tilegx ADK_TARGET_SYSTEM=generic-tile"
      ;;
    v850)
      allowed_libc="newlib"
      runtime_test=""
      allowed_tests="toolchain"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=v850"
      ;;
    x86)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=x86 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-x86"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=x86 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-x86"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=x86 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-x86"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=x86"
      cpu_arch=i686
      qemu=qemu-system-i386
      qemu_machine=pc
      qemu_args="${qemu_args} -m 256"
      ;;
    x86_64)
      allowed_libc="uclibc-ng musl glibc newlib"
      runtime_test="uclibc-ng musl glibc"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=x86_64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-x86_64"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=x86_64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-x86_64"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=x86_64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-x86_64"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=x86_64"
      cpu_arch=x86_64
      qemu_machine=pc
      qemu_args="${qemu_args} -m 256"
      libdir=lib64
      ;;
    x86_64_x32)
      allowed_libc="musl glibc"
      runtime_test="musl glibc"
      allowed_tests="toolchain"
      default_glibc="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=x86_64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-x86_64 ADK_TARGET_ABI=x32"
      default_musl="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=x86_64 ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-x86_64 ADK_TARGET_ABI=x32"
      cpu_arch=x86_64
      march=x86_64
      qemu=qemu-system-${cpu_arch}
      qemu_machine=pc
      libdir=libx32
      suffix=x32
      ;;
    xtensa)
      allowed_libc="newlib uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain boot libc mksh ltp native"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=xtensa ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-xtensa ADK_TARGET_CPU=dc233c ADK_TARGET_ENDIAN=little"
      default_newlib="ADK_APPLIANCE=toolchain ADK_TARGET_OS=baremetal ADK_TARGET_ARCH=xtensa"
      cpu_arch=dc233c
      qemu=qemu-system-xtensa
      qemu_machine=kc705
      qemu_args="${qemu_args} -cpu dc233c -m 256"
      suffix=${cpu_arch}
      piggyback=1
      ;;
    xtensabe)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=xtensa ADK_TARGET_FS=initramfsarchive ADK_TARGET_SYSTEM=qemu-xtensa ADK_TARGET_CPU=kc705_be ADK_TARGET_ENDIAN=big"
      cpu_arch=dc233c
      qemu=qemu-system-xtensa
      qemu_machine=kc705
      qemu_args="${qemu_args} -cpu dc233c"
      suffix=${cpu_arch}
      ;;
    xtensa-nommu)
      allowed_libc="uclibc-ng"
      runtime_test="uclibc-ng"
      allowed_tests="toolchain boot libc"
      default_uclibc_ng="ADK_APPLIANCE=test ADK_TARGET_OS=$os ADK_TARGET_ARCH=xtensa ADK_TARGET_FS=initramfspiggyback ADK_TARGET_SYSTEM=qemu-xtensa ADK_TARGET_CPU=de212 ADK_TARGET_ENDIAN=little ADK_TARGET_MMU=no"
      cpu_arch=de212
      march=xtensa
      qemu=qemu-system-xtensa
      qemu_machine=kc705-nommu
      qemu_args="${qemu_args} -cpu de212 -m 256"
      suffix=${cpu_arch}_nommu
      piggyback=1
      ;;
    *)
      echo "architecture ${arch} not supported"; exit 1;;
  esac
}

# creating test script to be run on boot
create_run_sh() {
  test=$1
  file=$2
  type=$3

  if [ "$type" = "netcat" ]; then
    tee="| tee -a /REPORT"
  fi

cat > $file << EOF
#!/bin/sh
uname -a
if [ -x /usr/sbin/rdate ]; then
  if [ \$ntpserver ]; then
    rdate \$ntpserver
  else
    rdate time.fu-berlin.de
  fi
fi
EOF
  if [ "$type" = "netcat" ]; then
cat >> $file << EOF
dmesg >> /REPORT
EOF
  fi
  # boot test
  if [ $test = "boot" ]; then
cat >> $file << EOF
if [ -x /usr/bin/size ]; then
  size /bin/busybox $tee
else
  ls -la /bin/busybox $tee
fi
helloworld
helloworld.static
if [ -x helloworld-cxx ]; then
helloworld-cxx
fi
if [ -x helloworld-cxx.static ]; then
helloworld-cxx.static
fi
EOF
  if [ $static -eq 0 ]; then
cat >> $file << EOF
for i in \$(ls /lib/* 2>/dev/null);do
  if [ -x /usr/bin/size ]; then
    size \$i $tee
  else
    ls -la \$i $tee
  fi
done
EOF
  fi
  fi
  # ltp test
  if [ $test = "ltp" ]; then
cat >> $file << EOF
/opt/ltp/runltp $tee
EOF
  fi
  # native test
  if [ $test = "native" ]; then
cat >> $file << EOF
echo '#include <stdio.h>\nint main() {\n printf("Hello World");\n return 0; \n}'> /hello.c
gcc -o /hello /hello.c $tee
/hello $tee
if [ \$? -eq 0 ]; then
  echo "\nsuccess"
else
  echo "\nfailed"
fi
EOF
  fi
  # mksh test
  if [ $test = "mksh" ]; then
cat >> $file << EOF
tty=\$(cat /proc/consoles |cut -f 1 -d " ")
mksh -T !/dev/\$tty -c '/opt/mksh/test.sh' $tee
EOF
  fi
  # libc test
  if [ $test = "libc" ]; then
cat >> $file << EOF
cd /usr/lib/uclibc-ng-test/test
sh ./uclibcng-testrunner.sh $tee
EOF
  fi
  # info
cat >> $file <<EOF
if [ -f /etc/.adkgithash ]; then
  echo "OpenADK git version:"
  cat /etc/.adkgithash
fi
if [ -f /etc/.adkcompiler ]; then
  echo "Compiler used:"
  cat /etc/.adkcompiler
fi
if [ -f /etc/.adklinker ]; then
  echo "Linker used:"
  cat /etc/.adklinker
fi
EOF

  if [ "$type" = "netcat" ]; then
cat >> $file << EOF
echo quit|nc $buildserver 9999
EOF
  fi

  if [ "$type" = "quit" ]; then
cat >> $file << EOF
exit
EOF
  fi
  chmod u+x $file
}

runtest() {
  lib=$1
  arch=$2
  test=$3

  if [ $ntp ]; then
    qemu_append="-append ntpserver=$ntp"
  fi
  if [ $shell -eq 1 ]; then
    qemu_append="-append shell"
  fi

  qemu=qemu-system-${arch}
  march=${arch}
  get_arch_info $arch $lib

  case $emulator in
    qemu)
      echo "Using QEMU as emulator"
      if ! which $qemu >/dev/null; then
        echo "Checking if $qemu is installed... failed"
        exit 1
      fi
      qemuver=$(${qemu} -version|awk '{ print $4 }'|head -1)
      if [ "$arch" != "metag" ]; then
        if [ $(echo $qemuver |sed -e "s#\.##g" -e "s#,##") -lt 240 ]; then
          echo "Your qemu version is too old. Please update to 2.4 or greater"
          exit 1
        fi
      fi
      ;;
    gdb)
      echo "Using GDB as simulator"
      ;;
    *)
      echo "emulator/simulator not supported"
      exit 1
      ;;
  esac

  echo "Starting test for $lib and $arch"
  # check if initramfs or piggyback is used
  if [ $piggyback -eq 1 ]; then
    echo "Using extra directory for test image creation"
    root=openadk/extra
    rm -rf openadk/extra 2>/dev/null
    mkdir openadk/extra 2>/dev/null
    if [ ! -z $suffix ]; then
        kernel=openadk/firmware/${emulator}-${march}_${lib}_${suffix}/${emulator}-${march}-initramfspiggyback-kernel
    else
      kernel=openadk/firmware/${emulator}-${march}_${lib}/${emulator}-${march}-initramfspiggyback-kernel
    fi
  else
    echo "Generating root filesystem for test run"
    root=$(mktemp -d /tmp/XXXX)
    if [ ! -z $suffix ]; then
      archive=openadk/firmware/${emulator}-${march}_${lib}_${suffix}/qemu-${march}-${lib}-initramfsarchive.tar.xz
      kernel=openadk/firmware/${emulator}-${march}_${lib}_${suffix}/qemu-${march}-initramfsarchive-kernel
    else
      archive=openadk/firmware/${emulator}-${march}_${lib}/${emulator}-${march}-${lib}-initramfsarchive.tar.xz
      kernel=openadk/firmware/${emulator}-${march}_${lib}/${emulator}-${march}-initramfsarchive-kernel
    fi

    if [ ! -f $archive ]; then
      echo "No root filesystem available for architecture ${arch} tried $archive"
      exit 1
    fi
    tar -xf $archive -C $root
  fi

  create_run_sh $test ${root}/run.sh quit

  if [ $piggyback -eq 1 ]; then
    (cd openadk && make v)
  else
    echo "Creating initramfs filesystem"
    (cd $root; find . | cpio -o -C512 -Hnewc |xz --check=crc32 --stdout > ${topdir}/initramfs.${arch})
    rm -rf $root
    qemu_args="$qemu_args -initrd initramfs.${arch}"
  fi

  # qemu-ppc overwrites existing commandline
  if [ $noappend -eq 0 ]; then
    qemu_args="$qemu_args ${qemu_append}"
  fi

  report=REPORT.${arch}.${test}.${libver}${rsuffix}

  echo "Now running the test ${test} in ${emulator} for architecture ${arch} and ${lib}"
  case $emulator in
    qemu)
      echo "${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot"
      ${qemu} -M ${qemu_machine} ${qemu_args} -kernel ${kernel} -qmp tcp:127.0.0.1:4444,server,nowait -no-reboot | tee $report
      ;;
    gdb)
      echo "$emulator ${arch} ${kernel}"
      ./openadk/toolchain_${emulator}-${march}_${lib}_${model}_${binfmt}/usr/bin/${gdbcmd} ${kernel}
      ;;
  esac
  if [ $? -eq 0 ]; then
    echo "Test ${test} for ${arch} finished. See $report"
  else
    echo "Test ${test} failed for ${arch} with ${lib} ${libver}."
  fi
}

build() {
  lib=$1
  arch=$2
  test=$3
  system=$4
  rootfs=$5

  DEFAULT=
  cd openadk

  if [[ $targetmode ]]; then
    DEFAULT="ADK_APPLIANCE=test ADK_TARGET_ARCH=$arch ADK_TARGET_SYSTEM=$system ADK_TARGET_FS=$rootfs"
  else
    get_arch_info $arch $lib
  fi

  if [ $verbose -eq 1 ]; then
    DEFAULT="$DEFAULT ADK_VERBOSE=1"
  fi

  # build defaults for different tests
  if [ $test = "toolchain" ]; then
    DEFAULT="$DEFAULT ADK_TEST_TOOLCHAIN=y"
  fi
  if [ $test = "boot" ]; then
    DEFAULT="$DEFAULT ADK_TEST_BASE=y"
  fi
  if [ $test = "ltp" ]; then
    DEFAULT="$DEFAULT ADK_TEST_LTP=y"
  fi
  if [ $test = "mksh" ]; then
    DEFAULT="$DEFAULT ADK_TEST_MKSH=y"
    REBUILD=.rebuild.mksh
  fi
  if [ $test = "libc" ]; then
    DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_TEST=y"
  fi
  if [ $test = "native" ]; then
    case $lib in
      uclibc-ng)
        DEFAULT="$DEFAULT ADK_TEST_UCLIBC_NG_NATIVE=y"
        ;;
      musl)
        DEFAULT="$DEFAULT ADK_TEST_MUSL_NATIVE=y"
        ;;
      glibc)
        DEFAULT="$DEFAULT ADK_TEST_GLIBC_NATIVE=y"
        ;;
    esac
  fi

  # build defaults for different C library
  DEFAULT="$DEFAULT ADK_TARGET_LIBC=$lib"
  case $lib in
    uclibc-ng)
      DEFAULT="$DEFAULT $default_uclibc_ng"
      ;;
    musl)
      DEFAULT="$DEFAULT $default_musl"
      ;;
    glibc)
      DEFAULT="$DEFAULT $default_glibc"
      ;;
    newlib)
      DEFAULT="$DEFAULT $default_newlib"
      ;;
  esac
  # use special C library version
  if [[ $libcversion ]]; then
    DEFAULT="$DEFAULT ADK_TARGET_LIBC_VERSION=$libcversion"
  fi
  # use special Linux kernel version
  if [[ $kernelversion ]]; then
    DEFAULT="$DEFAULT ADK_TARGET_KERNEL_VERSION=$kernelversion"
  fi
  if [[ $binutilsversion ]]; then
    DEFAULT="$DEFAULT ADK_TOOLCHAIN_BINUTILS_VERSION=$binutilsversion"
  fi
  if [[ $gccversion ]]; then
    DEFAULT="$DEFAULT ADK_TOOLCHAIN_GCC_VERSION=$gccversion"
  fi
  if [[ $gdbversion ]]; then
    DEFAULT="$DEFAULT ADK_TOOLCHAIN_GDB_VERSION=$gdbversion"
  fi

  rm .config* .defconfig 2>/dev/null
  echo "Using following defaults: $DEFAULT"
  make $DEFAULT defconfig

  if [ $create -eq 1 ]; then
    printf "ADK_CREATE_TOOLCHAIN_ARCHIVE=y\n" >> .config
  fi
  if [ $static -eq 1 ]; then
    printf "ADK_TARGET_USE_STATIC_LIBS_ONLY=y\n" >> .config
  fi
  if [ $cxx -eq 1 ]; then
    if [ "$arch" = "$skipcxx" -o "$lib" = "newlib" ]; then
      echo "Skipping $skipcxx"
    else
      printf "ADK_TOOLCHAIN_WITH_CXX=y\n" >> .config
      printf "ADK_COMPILE_LIBSTDCXX=y\n" >> .config
      printf "ADK_PACKAGE_LIBSTDCXX=y\n" >> .config
    fi
  fi
  if [ $ssp -eq 1 ]; then
    printf "ADK_TARGET_USE_SSP=y\n" >> .config
  fi
  if [ $debug -eq 1 ]; then
    printf "ADK_DEBUG=y\n" >> .config
  fi
  if [ ! -z $threads ]; then
    if [ $threads = "none" ]; then
      printf "ADK_TARGET_WITHOUT_THREADS=y\n" >> .config
    fi
    if [ $threads = "lt" ]; then
      printf "ADK_TARGET_WITH_LT=y\n" >> .config
    fi
    if [ $threads = "nptl" ]; then
      printf "ADK_TARGET_WITH_NPTL=y\n" >> .config
    fi
  fi

  for pkg in $packages; do
    p=$(echo $pkg|tr '[:lower:]' '[:upper:]'|tr - _);printf "ADK_COMPILE_$p=y\nADK_PACKAGE_$p=y\n" >> .config
  done

  # refresh after any changes to config
  yes|make oldconfig >/dev/null

  if [ $clean -eq 1 ]; then
    echo "cleaning openadk build directory"
    make cleansystem
  fi
  if [ ! -z $REBUILD ]; then
    touch $REBUILD
  fi
  make $DEFAULT all
  if [ $? -ne 0 ];then
    echo "build failed"
    exit 1
  fi
  cd ..
}	

for lib in ${libc}; do
  case $lib in
    uclibc-ng)
      archlist=$arch_list_uclibcng
      if [[ $libcversion ]]; then
        version=$libcversion
      else
        version=1.0.44
      fi
      libver=uClibc-ng-${version}
      libdir=uClibc-ng
      ;;
    glibc)
      archlist=$arch_list_glibc
      if [[ $libcversion ]]; then
        version=$libcversion
      else
        version=2.38
      fi
      libver=glibc-${version}
      libdir=glibc
      ;;
    musl)
      archlist=$arch_list_musl
      if [[ $libcversion ]]; then
        version=$libcversion
      else
        version=1.2.4
      fi
      libver=musl-${version}
      libdir=musl
      ;;
    newlib)
      archlist=$arch_list_newlib
      if [[ $libcversion ]]; then
        version=$libcversion
      else
        version=4.1.0
      fi
      libver=newlib-${version}
      libdir=newlib
      ;;
    *)
      echo "$lib not supported"
      exit 1
      ;;
  esac
  if [ ! -z $archs ]; then
    archlist="$archs"
  fi
  # libc source used?
  if [ ! -z $libcsource ]; then
    if [ ! -d $libcsource ]; then
      echo "Not a directory."
      exit 1
    fi
    if [ ! -f openadk/dl/${libver}.tar.xz ]; then
	usrc=$(mktemp -d /tmp/XXXX)
	echo "Creating C library source tarball openadk/dl/${libver}.tar.xz"
	cp -a $libcsource $usrc/$libver
	mkdir -p $topdir/openadk/dl 2>/dev/null
	rm $topdir/openadk/dl/${libver}.tar.xz 2>/dev/null
	(cd $usrc && tar cJf $topdir/openadk/dl/${libver}.tar.xz ${libver} && rm -rf $usrc)
	touch $topdir/openadk/dl/${libver}.tar.xz.nohash
	# we need to clean system, when external source is used
	if [ $noclean -eq 0 ]; then
	    clean=1
	fi
    else
      echo "Libc ${libver} tarball already exists, skipping creation"
    fi
  fi
  # binutils source used?
  if [ ! -z $binutilssource ]; then
    if [ ! -d $binutilssource ]; then
      echo "Not a directory."
      exit 1
    fi
    if [ ! -f openadk/dl/binutils-git.tar.xz ]; then
	usrc=$(mktemp -d /tmp/XXXX)
	echo "Creating binutils source tarball openadk/dl/binutils-git.tar.xz"
	(cd $binutilssource && ./src-release.sh binutils)
	tar xf $binutilssource/binutils-*.tar -C $usrc
	(cd $usrc && mv binutils-* binutils-git)
	mkdir -p $topdir/openadk/dl 2>/dev/null
	rm $topdir/openadk/dl/binutils-git.tar.xz 2>/dev/null
	(cd $usrc && tar cJf $topdir/openadk/dl/binutils-git.tar.xz binutils-git && rm -rf $usrc)
	touch $topdir/openadk/dl/binutils-git.tar.xz.nohash
	# we need to clean system, when external source is used
	if [ $noclean -eq 0 ]; then
	    clean=1
	fi
    else
      echo "Binutils tarball already exists, skipping creation"
    fi
  fi
  # gcc source used?
  if [ ! -z $gccsource ]; then
    if [ ! -d $gccsource ]; then
      echo "Not a directory."
      exit 1
    fi
    if [ ! -f openadk/dl/gcc-git.tar.xz ]; then
	usrc=$(mktemp -d /tmp/XXXX)
	echo "Creating gcc source tarball openadk/dl/gcc-git.tar.xz"
	cp -a $gccsource $usrc/gcc-git
	mkdir -p $topdir/openadk/dl 2>/dev/null
	rm $topdir/openadk/dl/gcc-git.tar.xz 2>/dev/null
	(cd $usrc && tar cJf $topdir/openadk/dl/gcc-git.tar.xz gcc-git && rm -rf $usrc)
	touch $topdir/openadk/dl/gcc-git.tar.xz.nohash
	# we need to clean system, when external source is used
	if [ $noclean -eq 0 ]; then
	    clean=1
	fi
    else
      echo "GCC tarball already exists, skipping creation"
    fi
  fi
  # gdb source used?
  if [ ! -z $gdbsource ]; then
    if [ ! -d $gdbsource ]; then
      echo "Not a directory."
      exit 1
    fi
    if [ ! -f openadk/dl/gdb-git.tar.xz ]; then
	usrc=$(mktemp -d /tmp/XXXX)
	echo "Creating gdb source tarball openadk/dl/gdb-git.tar.xz"
	cp -a $gdbsource $usrc/gdb-git
	mkdir -p $topdir/openadk/dl 2>/dev/null
	rm $topdir/openadk/dl/gdb-git.tar.xz 2>/dev/null
	(cd $usrc && tar cJf $topdir/openadk/dl/gdb-git.tar.xz gdb-git && rm -rf $usrc)
	touch $topdir/openadk/dl/gdb-git.tar.xz.nohash
	# we need to clean system, when external source is used
	if [ $noclean -eq 0 ]; then
	    clean=1
	fi
    else
      echo "GDB tarball already exists, skipping creation"
    fi
  fi
  # Linux kernel source used?
  if [ ! -z $kernelsource ]; then
    if [ ! -d $kernelsource ]; then
      echo "Not a directory."
      exit 1
    fi
    if [ ! -f openadk/dl/linux-git.tar.xz ]; then
      usrc=$(mktemp -d /tmp/XXXX)
      echo "Creating Linux kernel source tarball openadk/dl/linux-git.tar.xz"
      cp -a $kernelsource $usrc/linux-git
      mkdir -p $topdir/openadk/dl 2>/dev/null
      rm $topdir/openadk/dl/linux-git.tar.xz 2>/dev/null
      (cd $usrc && tar cJf $topdir/openadk/dl/linux-git.tar.xz linux-git && rm -rf $usrc)
      touch $topdir/openadk/dl/linux-git.tar.xz.nohash
      # we need to clean system, when external source is used
      if [ $noclean -eq 0 ]; then
        clean=1
      fi
    else
      echo "Tarball already exists, skipping creation"
    fi
  fi
  # start with a clean dir
  if [ $cleandir -eq 1 ]; then
    echo "completely cleaning openadk build directory"
    (cd openadk && make cleandir)
  fi

  if [[ $targetmode ]]; then
    create_run_sh $test run.sh netcat

    while read -u3 line; do
      target_host=$(echo $line|cut -f 1 -d ,)
      target_ip=$(echo $line|cut -f 2 -d ,)
      target_arch=$(echo $line|cut -f 3 -d ,)
      target_system=$(echo $line|cut -f 4 -d ,)
      target_suffix=$(echo $line|cut -f 5 -d ,)
      target_rootfs=$(echo $line|cut -f 6 -d ,)
      target_powerid=$(echo $line|cut -f 7 -d ,)
      echo "Testing target system $target_system ($target_arch) with $target_rootfs on $target_host"
      build $lib $target_arch $test $target_system $target_rootfs
      kernel=openadk/firmware/${target_system}_${lib}_${target_suffix}/${target_system}-${target_rootfs}-kernel
      tarball=openadk/firmware/${target_system}_${lib}_${target_suffix}/${target_system}-${lib}-${target_rootfs}.tar.xz
      scp $kernel root@${bootserver}:/tftpboot/${target_host}
      ssh -n root@${bootserver} "cd /tftpboot; ln -sf ${target_host} vmlinux"
      ssh -n root@${bootserver} "mkdir /nfsroot/${target_host} 2>/dev/null"
      xzcat $tarball | ssh root@${bootserver} "tar -xf - -C /nfsroot/${target_host}"
      scp run.sh root@${bootserver}:/nfsroot/${target_host}
      echo "Powering on target system"
      ssh -n root@${bootserver} "sispmctl -o $target_powerid"
      echo "Waiting for target system to finish"
      nc -l -p 9999
      echo "Test finished. Powering off target system"
      ssh -n root@${bootserver} "sispmctl -f $target_powerid"
      scp root@${bootserver}:/nfsroot/${target_host}/REPORT REPORT.${target_arch}.${target_system}.${test}.${libver}
      ssh -n root@${bootserver} "rm /nfsroot/${target_host}/REPORT"
    done 3< $targets
  else
    for arch in $archlist; do
      get_arch_info $arch $lib
      report=REPORT.${arch}.${test}.${libver}${rsuffix}
      if [ $cont -eq 1 ]; then
        if [ -f $report ]; then
          echo "Skipping already run test $test for $arch and $lib"
          continue
        fi
      fi
      if [ "$arch" = "$skiparchs" ]; then
        echo "Skipping $skiparchs"
        continue
      fi
      if [ "$threads" = "lt" ]; then
        if [ "$arch" = "$skiplt" ]; then
          echo "Skipping $skiplt"
          continue
        fi
      fi
      if [ $static -eq 1 ]; then
        if [ "$arch" = "$skipstatic" ]; then
          echo "Skipping $skipstatic"
          continue
        fi
      fi
      if [ $ssp -eq 1 ]; then
        if [ "$arch" = "$skipssp" ]; then
          echo "Skipping $skipssp"
          continue
        fi
      fi
      if [[ "$allowed_tests" = *${test}* ]]; then
        if [[ "$allowed_libc" = *${lib}* ]]; then
          echo "Compiling for $lib and $arch testing $test"
          build $lib $arch $test
          if [ "$test" != "toolchain" ]; then
            if [[ "$runtime_test" = *${lib}* ]]; then
              runtest $lib $arch $test
            fi
          else
            # fake stamp for continue
            touch $report
          fi
        else
          echo "$lib not available for $arch"
        fi
      else
         echo "$test not available for $arch and $lib"
      fi
    done
  fi
done
echo "All tests finished."
exit 0