summaryrefslogtreecommitdiff
path: root/packages/u-boot/u-boot-1.2.0/u-boot-kurobox.patch
blob: 79f7a8e48a9f7ff89d1fb9c577be1f667159064e (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
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
diff -urN u-boot-86xx/MAKEALL u-boot-86xx-kuro_clean/MAKEALL
--- u-boot-86xx/MAKEALL	2006-10-13 00:27:12.000000000 +0200
+++ u-boot-86xx-kuro_clean/MAKEALL	2006-11-06 22:13:16.000000000 +0100
@@ -106,9 +106,9 @@
 LIST_824x="	\
 	A3000		barco		BMW		CPC45		\
 	CU824		debris		eXalion		HIDDEN_DRAGON	\
-			MOUSSE		MUSENKI		MVBLUE		\
-	OXC		PN62		Sandpoint8240	Sandpoint8245	\
-	sbc8240		SL8245		utx8245				\
+	linkstation	linkstationhg	MOUSSE		MUSENKI		\
+	MVBLUE		OXC		PN62		Sandpoint8240	\
+	Sandpoint8245	sbc8240		SL8245		utx8245		\
 "
 
 #########################################################################
diff -urN u-boot-86xx/Makefile u-boot-86xx-kuro_clean/Makefile
--- u-boot-86xx/Makefile	2006-10-13 00:27:12.000000000 +0200
+++ u-boot-86xx-kuro_clean/Makefile	2006-11-06 22:15:20.000000000 +0100
@@ -122,7 +122,7 @@
 CROSS_COMPILE =
 else
 ifeq ($(ARCH),ppc)
-CROSS_COMPILE = powerpc-linux-
+CROSS_COMPILE = ppc_6xx-
 endif
 ifeq ($(ARCH),arm)
 CROSS_COMPILE = arm-linux-
@@ -237,6 +237,40 @@
 
 all:		$(ALL)
 
+LSMODEL := $(shell head -n 1 include/config.h)
+
+linkstation_HGLAN_RAM: include/config.h
+	@[ -n "$(findstring HGLAN_RAM, $(LSMODEL))" ] || \
+		{ echo "Bad configuration: $(LSMODEL)" ; \
+		  exit 1 ; \
+		}
+	@make all
+	@mv u-boot.bin u-boot-hg.ram.bin
+
+linkstation_HGLAN: include/config.h
+	@[ -n "$(findstring HGLAN_ROM, $(LSMODEL))" ] || \
+		{ echo "Bad configuration: $(LSMODEL)" ; \
+		  exit 1 ; \
+		}
+	@make all
+	@mv u-boot.bin u-boot-hg.flash.bin
+
+linkstation_HDLAN_RAM: include/config.h
+	@[ -n "$(findstring HDLAN_RAM, $(LSMODEL))" ] || \
+		{ echo "Bad configuration: $(LSMODEL)" ; \
+		  exit 1 ; \
+		}
+	@make all
+	@mv u-boot.bin u-boot-hd.ram.bin
+
+linkstation_HDLAN: include/config.h
+	@[ -n "$(findstring HDLAN_ROM, $(LSMODEL))" ] || \
+		{ echo "Bad configuration: $(LSMODEL)" ; \
+		  exit 1 ; \
+		}
+	@make all
+	@mv u-boot.bin u-boot-hd.flash.bin
+
 $(obj)u-boot.hex:	$(obj)u-boot
 		$(OBJCOPY) ${OBJCFLAGS} -O ihex $< $@
 
@@ -317,6 +351,10 @@
 
 #########################################################################
 else
+linkstation_HGLAN_RAM	\
+linkstation_HGLAN	\
+linkstation_HDLAN_RAM	\
+linkstation_HDLAN	\
 all $(obj)u-boot.hex $(obj)u-boot.srec $(obj)u-boot.bin \
 $(obj)u-boot.img $(obj)u-boot.dis $(obj)u-boot \
 $(SUBDIRS) version gdbtools updater env depend \
@@ -1262,6 +1300,38 @@
 kvme080_config: unconfig
 	@$(MKCONFIG) $(@:_config=) ppc mpc824x kvme080 etin
 
+linkstation_HGLAN_RAM_config: mrproper
+	@>include/config.h ; \
+	echo "/* HGLAN_RAM */" >>include/config.h ; \
+	echo "#define CONFIG_HGLAN 1" >>include/config.h ; \
+	echo "TEXT_BASE = 0x07F00000" >board/linkstation/config.tmp ; \
+	./mkconfig -a linkstation ppc mpc824x linkstation ; \
+	echo "LinkStation HGLAN -- RAM BUILD ..."
+
+linkstation_HGLAN_config: mrproper
+	@>include/config.h ; \
+	echo "/* HGLAN_ROM */" >>include/config.h ; \
+	echo "#define CONFIG_HGLAN 1" >>include/config.h ; \
+	echo "TEXT_BASE = 0xFFF00000" >board/linkstation/config.tmp ; \
+	./mkconfig -a linkstation ppc mpc824x linkstation ; \
+	echo "LinkStation HGLAN -- ROM BUILD ..."
+
+linkstation_HDLAN_RAM_config: mrproper
+	@>include/config.h ; \
+	echo "/* HDLAN_RAM */" >>include/config.h ; \
+	echo "#define CONFIG_HLAN 1" >>include/config.h ; \
+	echo "TEXT_BASE = 0x03F00000" >board/linkstation/config.tmp ; \
+	./mkconfig -a linkstation ppc mpc824x linkstation ; \
+	echo "LinkStation HDLAN -- RAM BUILD ..."
+
+linkstation_HDLAN_config: mrproper
+	@>include/config.h ; \
+	echo "/* HDLAN_ROM */" >>include/config.h ; \
+	echo "#define CONFIG_HLAN 1" >>include/config.h ; \
+	echo "TEXT_BASE = 0xFFF00000" >board/linkstation/config.tmp ; \
+	./mkconfig -a linkstation ppc mpc824x linkstation ; \
+	echo "LinkStation HDLAN -- ROM BUILD ..."
+
 MOUSSE_config: unconfig
 	@$(MKCONFIG) $(@:_config=) ppc mpc824x mousse
 
diff -urN u-boot-86xx/board/linkstation/INSTALL u-boot-86xx-kuro_clean/board/linkstation/INSTALL
--- u-boot-86xx/board/linkstation/INSTALL	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/INSTALL	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,631 @@
+
+                     Installing U-Boot for LinkStation
+
+                       For U-Boot port version 2.1.0
+                             16 September 2006
+
+   Copyright (c) 2006 Mihai Georgian
+
+   Permission is granted to copy, distribute and/or modify this document under
+   the terms of the [1]GNU Free Documentation License, Version 1.2 or any later
+   version  published  by the Free Software Foundation; with no Invariant
+   Sections, no Front-Cover Texts, and no Back-Cover Texts. The full text of
+   the license can be obtained by clicking on the above link.
+
+   No  liability  for  the contents of this document can be accepted. The
+   information in this document is provided in good faith but no warranty can
+   be made for its accuracy and the author does not take any responsibility.
+   Use the concepts, examples and information at your own risk. There may be
+   errors and inaccuracies, that could be damaging to your system.
+
+   Use of a term in this document should not be regarded as affecting the
+   validity of any trademark or service mark. Naming of particular products or
+   brands should not be seen as endorsements.
+     _________________________________________________________________
+
+   WARNING
+
+   Flashing the LinkStation with unauthorised firmare voids your warranty. When
+   installing firmware on an embedded computer things can and, sometimes, do go
+   wrong. The power can go down in the middle of the flash operation or the
+   flash write can fail rendering your LinkStation unusable. Please read this
+   entire page carefully before attempting to install U-Boot. 
+
+   If you are not prepared to lose your LinkStation, do not attempt to install
+                                     U-Boot 
+
+  Introduction
+
+   U-Boot  for  the  LinkStation is distributed as a source patch against
+   u-boot-1.1.4. To compile it you will need either a cross toolchain installed
+   on your PC or native development tools installed on your LinkStation. These
+   instructions assume that you are running Linux on a X86 PC and that you are
+   using a cross toolchain.
+
+   To allow testing of U-Boot on your LinkStation without burning it into
+   flash, a kernel module named uloader.o is provided. Uloader allows you to
+   use Linux to load a RAM build of U-Boot and start it. The RAM build of
+   U-Boot is very close to the ROM build. The only differences are the absence
+   of the basic initialisation code (which cannot run from RAM) and the link
+   address. It is strongly recommended that you test U-Boot on your LinkStation
+   using a RAM build before building the ROM version and attempting to burn it
+   into flash. Once you have the RAM build up and running you can use it to
+   install (burn) the ROM version.
+
+  Supported Hardware
+
+   The LinkStation port of U-Boot described in this document supports the
+   following PowerPC based models:
+    1. LinkStation version 1 (model HD-HLAN-1)
+    2. KuroBox standard
+    3. LinkStation HG (model HD-HGLAN)
+    4. KuroBox HG
+
+   This version of U-Boot will certainly not work on the the LinkStation
+   version 2 (model HD-HLAN-2) as the LinkStation version 2 is based on a MIPS
+   processor. The MIPS processor is completely different from the PowerPC
+   processor and attempting to flash a LinkStation version 2 with PowerPC
+      firmware it is guaranteed to make it completely unusable. 
+
+  Get telnet Access
+
+   Try to connect to your LinkStation using telnet. If you see the telnet
+   command prompt, read [2]CGI Exploit (PowerPC) original method of Hacking the
+   LinkStation about how to get telnet access.
+
+   If the above method doesn't work for you, read [3]Turn your LinkStation into
+   a Kuro Box (PowerPC) for other methods to get telnet access.
+
+   The above methods do not work for the LinkStation HG. For this model, the
+   only solution is to load a telnet-enabled version of the firmware. Read the
+   pages about [4]OpenLink and the [5]firmware flasher
+
+   You can also try to flash [6]a modified version of the original firmware.
+
+  Install the Serial Console
+
+   Installing the serial console is not an absolute requirement and it will
+   void your warranty. U-Boot can be installed and controlled without it.
+   However, the serial console will give you the best control over both U-Boot
+                                   and Linux. 
+
+   Read [7]Add a Serial port to the PowerPC Linkstation to learn how to install
+   the serial console.
+
+  Install netcat (nc)
+
+   If you haven't installed the serial console you will need to install netcat
+   (nc). Netcat is a networking utility which reads and writes data across
+   network connections, using the TCP/IP protocol. It comes standard with most
+   Linux  distributions. For more information, visit the netcat home page
+   [8]http://netcat.sourceforge.net or [9]http://www.vulnwatch.org/netcat for
+   the Windows version.
+
+  Get the ELDK
+
+   If you don't have a cross toolchain installed, download the DENX Embedded
+   Linux Development Kit (ELDK) from
+   [10]http://ftp.sunet.se/pub/Linux/distributions/eldk/3.1.1/ppc-linux-x86/iso
+   /ppc-2005-03-07.iso, install it and spend some time getting familiar with
+   it.
+
+  Preparation
+
+   Create the build directory and set the environment variable UBOOT_BUILD to
+   the path to it
+   # mkdir <your_build_directory>
+   # export UBOOT_BUILD=<your_build_directory>
+   # cd $UBOOT_BUILD
+   Download the tarball for u-boot-1.1.4 from
+   [11]ftp://ftp.denx.de/pub/u-boot/u-boot-1.1.4.tar.bz2
+   Download the LinkStation patch, [12]u-boot-1.1.4-list-2.1.0.diff.gz 
+   Download the uloader module for your LinkStation / KuroBox model.
+     * For    the    LinkStation   1   /   KuroBox   standard,   download
+       [13]uloader-2.4.17.tar.gz 
+     * For the LinkStation HG / KuroBox HG, download [14]uloader-2.4.20.tar.gz 
+
+   Untar u-boot-1.1.4 and apply the patch.
+   # tar xjf u-boot-1.1.4.tar.bz2
+   # cd u-boot-1.1.4
+   # gunzip ../u-boot-1.1.4-list-2.01.diff.gz | patch -p1
+
+   Untar the uloader archive for your LinkStation / KuroBox model. The archive
+   contains  the  source  code, a binary module compiled for the original
+   LinkStation kernel and a simple bash script to load and start a RAM build of
+   U-Boot.
+
+   The binary in uloader-2.4.17.tar.gz has been compiled against
+   2.4.17_mvl21-sandpoint. Use only on the LinkStation 1 / KuroBox standard.
+   The binary in uloader-2.4.20.tar.gz has been compiled against
+   2.4.20_mvl31-ppc_linkstation. Use only on the LinkStation HG / KuroBog HG.
+   If you have a different kernel version, you may need to recompile the module
+   for your kernel. Compiling the module requires a fully configured kernel
+   source tree. It is recommended to use the same gcc version as the one used
+   to compile the kernel. There is a small but important difference between the
+   two uloader source archives. The difference is the U-Boot load address. If
+   you compile uloader for the LinkStation 1 / KuroBox standard, use the
+   sources in uloader-2.4.17.tar.gz. If you compile for the LinkStation HG /
+   KuroBox HG, use the sources in uloader-2.4.20.tar.gz. In both cases you
+   need to modify the Makefile to match your development environment. 
+
+   LinkStation 1 / KuroBox standard
+   # cd ..
+   # tar xzf uloader-2.4.17.tar.gz
+   # cd u-boot-1.1.4
+
+   LinkStation HG / KuroBox HG
+   # cd ..
+   # tar xzf uloader-2.4.20.tar.gz
+   # cd u-boot-1.1.4
+
+   Source your ELDK environment
+   # . <path_to_your_ELDK>/config_6xx
+
+  Configure
+
+   Edit include/configs/linkstation.h and set the following variables for your
+   environment:
+
+   CONFIG_IPADDR_LS    -  the IP address of your LinkStation while running
+                          U-Boot (mandatory). The default address is
+                          192.168.11.150.
+   CONFIG_SERVERIP_LS  -  the IP address of the NFS/TFTP/DHCP/BOOTP server,
+                          normally the address of your Linux PC (mandatory).
+                          The default address is 192.168.11.149.
+   CONFIG_NCIP_LS      -  the address of the computer running netcat (nc),
+                          normally the address of your Linux PC (optional).
+                          If the define is missing, CONFIG_NCIP_LS will be
+                          set to the same value as CONFIG_SERVERIP_LS
+
+  RAM Build
+
+   For LinkStation 1 / KuroBox standard run:
+   make linkstation_HDLAN_RAM_config
+   make linkstation_HDLAN_RAM
+
+   The name of the resulting binary is u-boot-hd.ram.bin
+
+   For LinkStation HG / KuroBox HG run:
+   make linkstation_HGLAN_RAM_config
+   make linkstation_HGLAN_RAM
+
+   The name of the resulting binary is u-boot-hg.ram.bin
+
+  Net Console
+
+   The net console is the U-Boot driver which uses the UDP protocol with a
+   default port of 6666 to send the console output to and receive the console
+   input from a remote computer. You need to run netcat on the remote computer
+   to  communicate  with  the  U-Boot  net  console. The communication is
+   bidirectional.  Netcat  will display on your screen the console output
+   received from U-Boot and will send your keyboard input back to U-Boot.
+
+   If U-Boot cannot contact the remote computer, it switches the console to the
+   serial port. To show that it changed the console, U-Boot makes the HDD LED
+   blink with the pattern corresponding to the serial console (see The Reset
+   Button below). The timeout period is 20 sec.
+
+  Minimal Console
+
+   U-Boot for the LinkStation is designed to allow some control over the boot
+   process even in the absence of a console. For this, it uses the power button
+   (the big button at the front) and the reset button (the small red button at
+   the back).
+
+   Before installing U-Boot, when the LinkStation is switched on, the power LED
+   starts  blinking,  the original boot loader starts executing and, very
+   quickly, it starts booting the kernel from flash. If U-Boot is installed,
+   the power LED will change from blinking quickly to blinking very slowly. The
+   blink pattern is the same as the one used to indicate sleep mode in normal
+   operation. When the power LED starts blinking slowly at boot, U-Boot has
+   taken over and it is counting down the boot delay before booting the kernel.
+   The default boot delay is 10 sec. From the moment when the power LED starts
+   blinking slowly and for the duration of the boot delay, you can control the
+   boot process with the power and reset buttons.
+
+    The Power Button
+
+   If you push the power button and keep it pressed for more than 1 sec, the
+   boot  process will stop and the LinkStation will wait for a command. A
+   stopped boot process is indicated by the power LED being lit solid. The
+   effect is the same a pressing 's' on the console.
+
+   A long push of the power button acts as a toggle. If the boot delay count
+   down is in progress, a long push of the power button stops the boot process.
+   If the boot process is stopped (U-Boot is at the command prompt, even if you
+   can't see it), a long push of the power button restarts the boot process
+   resetting the boot delay to its original value. The restart of the boot
+   process is indicated by the power LED blinking slowly.
+
+   By default U-Boot supports three pre-configured boot commands:
+    1. The  first boot command will attempt to load and boot a file named
+       boot/vmlinux.UBoot from the first hard disk partition, /dev/hda1. The
+       file can be in any of the U-Boot bootable formats but uImage is the
+       preferred format. If the file is missing or corrupted, U-Boot will fall
+       back to booting the original kernel from flash.
+    2. The second boot command will boot the original kernel from flash.
+       Please note that the original kernel for the LinkStation 1 / KuroBox
+       standard has a bug in the function that calibrates the decrementer and
+       it will stop for up to 180 sec during boot. This bug is not an U-Boot
+       bug  but  a  kernel bug which is uncovered by the fact that U-Boot
+       activates the decrementer where the original boot loader does not.
+       The original kernel for LinkStation HG / KuroBox HG does not suffer from
+       the above problem.
+    3. The third boot command will attempt to boot in emergency mode (EM). It
+       does this by passing the argument root=/dev/ram0 to the kernel.
+       LinkStation / LinkStation HG owners should avoid booting in EM mode as
+       the root password for this mode on the LinkStation is unknown. 
+       The original kernel for the LinkStation / KuroBox standard and for some
+       of the earlier LinkStation HG / KuroBox HG models ignores the root
+       argument. These models will boot normally from the on-board flash when
+       the  EM  boot command is used. Read the section on EM mode if your
+       LinkStation HG / KuroBox HG has a kernel that doesn't boot in EM mode
+       using this boot command.
+
+   You can cycle through the boot commands with the power button.
+
+   To see which of the three commands U-Boot is going to execute, press the
+   power  button quickly. The HDD LED (the third from the top) will start
+   blinking. The number of times the LED blinks, shows the number of the active
+   boot command. For example, a pattern short on - short off - short on - long
+   off, means that the boot command number 2 is active. U-Boot will repeat the
+   blinking cycle for a total duration of about 5 sec counting from the moment
+   the power button is released.
+
+   A short press of the power button while the HDD LED is blinking will advance
+   the boot command to the next one.
+
+   Changing the boot command does not change the boot status. If the boot is
+   stopped, it will not be restarted. If the boot is in progress, it will not
+   be stopped but the boot delay will be reset to the original value.
+
+    The Reset Button
+
+   Two  consoles are currently configured, the serial console and the net
+   console. The first console is the serial console and the second console is
+   the net console (nc). The net console is the default console.
+
+   The reset button can be used, similarly to the power button, to switch
+   consoles. A press on the reset button (here, it doesn't matter how long you
+   keep the button pressed) displays the currently active console using the HDD
+   LED. Repeatedly pressing the reset button while the HDD LED is blinking will
+   toggle between the two consoles. The blinking pattern is different from the
+   one showing the boot command. The pattern which shows that the second (net)
+   console is active is short off - short on - short off - long on. U-Boot will
+   repeat the blinking cycle for a total duration of about 5 sec counting from
+   the moment the reset button is released.
+
+  Load and Test
+
+   Mount the LinkStation SMB public share and copy the following files to it:
+
+   For LinkStation 1 / KuroBox standard
+   # mount -t smbfs -o password="" //<your_linkstation_name_or_ip>/share/mnt
+   # cp u-boot-hd.ram.bin /mnt
+   # cp ../uloader-2.4.17/uloader.o /mnt
+   # cp ../uloader-2.4.17/u-boot-load-hd.sh /mnt
+   # umount /mmt
+
+   For LinkStation HG / KuroBox HG
+   # mount -t smbfs -o password="" //<your_linkstation_name_or_ip>/share/mnt
+   # cp u-boot-hg.ram.bin /mnt
+   # cp ../uloader-2.4.20/uloader.o /mnt
+   # cp ../uloader-2.4.20/u-boot-load-hg.sh /mnt
+   # umount /mmt
+
+   If you installed the serial port, open another window and use minicom to
+   connect to your LinkStation serial console. The serial port settings are
+   57600,N,8, the same as the settings used by the original Linux kernel.
+
+   Start netcat to communicate with the U-Boot net console. Open another window
+   and run board/linkstation/nc.sh. Nc.sh is a simple script which invokes
+   netcat with the correct options. To quit nc, press ^T (control-T).
+   # cd $UBOOT_BUILD/u-boot-1.1.4
+   # board/linkstation/nc.sh <ip_of_your_linkstation>
+
+   Where <ip_of_your_linkstation> is CONFIG_IPADDR_LS (see Configure U-Boot
+   above). When you run nc.sh nothing will be written to the screen. This is
+   normal as Linux is not using the net console.
+
+   From your original window, use telnet to connect to the LinkStation and
+   launch U-Boot. Replace lshg in the example below with the name / IP address
+   of your LinkStation. Replace myroot with the login you created when you
+   gained  telnet  access.  For  LinkStation  1  /  KuroBox standard, use
+   u-boot-load-hd.sh instead of u-boot-load-hg.sh. Type the commands shown in
+   bold.
+   # telnet lshg
+   Trying 192.168.0.58...
+   Connected to lshg.
+   Escape character is '^]'.
+   BUFFALO INC. Link Station series HD-HGLAN (IEMITSU)
+   HD-HGLAN6C5 login: myroot
+   Linux (none) 2.4.20_mvl31-ppc_linkstation #3 Thu May 19 13:34:18 JST 2005
+   ppc unknown
+   root@HD-HGLAN6C5:~# cd /mnt/share
+   root@HD-HGLAN6C5:/mnt/share# ./u-boot-load-hg.sh
+   root@HD-HGLAN6C5:/mnt/share# exit
+   Connection closed by foreign host.
+   #
+
+   If you have a serial console you should see the initial U-Boot startup
+   messages. Even if the default console is the net console, U-Boot still sends
+   the console output to the serial port until it initialises the network
+   controller.
+   U-Boot 1.1.4 LiSt 2.1.0 (Sep 12 2006 - 23:09:44) LinkStation HG / KuroBox HG
+   CPU: MPC8245 Revision 1.4 at 262.144 MHz: 16 kB I-Cache 16 kB D-Cache
+   DRAM: 128 MB
+   FLASH: 4 MB
+   *** Warning - bad CRC, using default environment
+           00  0b  10ec  8169  0200  ff
+           00  0c  1283  8212  0180  ff
+           00  0e  1033  0035  0c03  ff
+           00  0e  1033  0035  0c03  ff
+           00  0e  1033  00e0  0c03  ff
+   Net:   RTL8169#0
+
+   Watch the net console window. After a few seconds, time needed by U-Boot to
+   initialise the network controller and the IDE controller you should see the
+   U-Boot messages.
+   U-Boot 1.1.4 LiSt 2.1.0 (Sep 12 2006 - 23:09:44) LinkStation HG / KuroBox HG
+   IDE:    Bus 0: OK
+     Device 0: Model: Maxtor 7Y250P0 Firm: YAR41BW0 Ser#: Y62W8PDE
+               Type: Hard Disk
+               Supports 48-bit addressing
+               Capacity: 239372.4 MB = 233.7 GB (490234752 x 512)
+   Boot in 10 seconds ('s' to stop)...
+
+   Press 's' on your keyboard to stop the boot process.
+
+   If  you  want  to  use the serial console, watch the power LED of your
+   LinkStation. When it starts blinking very slowly, use the power button to
+   stop the boot process. Wait for the power LED to go dim and press and hold
+   the power button until the LED lights up brightly indicating that the boot
+   process has stopped. Now press the reset button twice and you should see the
+   U-Boot command prompt (=>) in your minicom window. You can now control
+   U-Boot from the minicom window.
+
+   Using u-boot-load-hd.sh / u-boot-load-hg.sh leads to the above results on
+   devices with the original software. On some LinkStations with modified
+   software, reboot has been modified to send a reboot command to the AVR.
+   This is indicated by the fast blinking of the power LED immediately after
+   running u-boot-load-hd.sh / u-boot-load-hg.sh. Once the AVR receives a
+   reboot command, the reboot process cannot be stopped. The AVR will reboot
+   the LinkStation 5 min after receiving the reboot command.
+   If you find yourself in the above situation you can still test U-Boot by
+   booting your LinkStation with the AVR disabled. Press and hold the reset
+   button and then press the power button. All LEDs will start flashing but
+   your LinkStation will boot normally. Now you can use the procedure
+   described above with one caveat: the AVR being disabled, pressing the
+   buttons will have no effect so you will not be able to test the behaviour
+   of the minimal console. 
+
+   Once  you  get  the  U-Boot command prompt, start testing it. Read the
+   [15]U-Boot documentation and try each command you are interested in.
+
+   Keep in mind that U-Boot interprets all input number as hex numbers. If, for
+   example, you type 256, U-Boot will interpret it as 598 decimal.
+
+   When you are testing memory write commands, do not attempt to write to the
+   first MB of memory (0x00000000 to 0x00100000) as you will be overwriting the
+   exception vectors and U-Boot will crash.
+
+   An important command is flinfo which displays information about the flash
+   chip. If the information displayed is correct for your flash, test the flash
+   erase and flash write commands. To do this, you will need to find an empty
+   sector, one for which each byte is 0xFF. Hint: check the last flash sector
+   first, chances are that it's empty. When you are testing commands that write
+   to the flash, always remember that you can write a single byte but you can
+   only erase whole sectors.
+
+   Be very careful not to write to the flash memory range 0xFFC00000 to
+   0xFFF7FFFF. This area contains the Linux kernel, the initial RAM disk used
+   for EM mode, the bootloader and the configuration sector (which holds the
+   "OKOK" or "NGNG" pattern). The range 0xFFF80000 to 0xFFFFFFFF is the user
+   area and, in most cases, is empty. Always check using the U-Boot command md
+   (memory display) if the flash area you intend to use is empty (all bytes are
+   0xFF). For more information about the flash organisation, read
+   [16]PPCFlashROM for the LinkStation 1 / KuroBox standard or [17]HGFlashROM
+   for the LinkStation HG / KuroBox HG. 
+
+  ROM Build
+
+   Once you are happy with the RAM build, you are ready for the ROM build.
+
+   For LinkStation 1 / KuroBox standard run:
+   make linkstation_HDLAN_config
+   make linkstation_HDLAN
+
+   The name of the resulting binary is u-boot-hd.flash.bin
+
+   For LinkStation HG / KuroBox HG run:
+   make linkstation_HGLAN_config
+   make linkstation_HGLAN
+
+   The name of the resulting binary is u-boot-hg.flash.bin
+
+  Install
+
+   Do not attempt to flash from U-Boot if the power LED is blinking. Your
+   LinkStation is likely to reboot and you will end up with a "brick" 
+   Test the flash commands thoroughly before deciding to burn U-Boot into
+   flash. Write at least 128 kB to the flash to test potential timeout
+   problems 
+   The flash routines in this version of U-Boot for the LinkStation should be
+   able to identify and handle any CFI flash which uses the AMD standard
+   command set. However, they were tested only on a LinkStation with a Fujitsu
+   MBM29PL32TM flash chip and on a LinkStation HG with a ST Micro M29DW324DB
+   flash chip. 
+   Be very careful not to flash your hardware with the wrong U-Boot build.
+   Flashing any RAM build or flashing a ROM build for the LinkStation 1 /
+   KuroBox standard into the LinkStation HG / KuroBox HG or viceversa will
+   "brick" your device. This is especially true if you are flashing from Linux
+      as U-Boot has safety checks to avoid flashing the wrong build. 
+
+    Flashing U-Boot from U-Boot
+
+   The RAM build of U-Boot can be used to load and flash the ROM build. This is
+   the preferred method.
+
+   Boot your LinkStation normally. Open a telnet session and create a directory
+   to hold the U-Boot flash image.
+   root@linkstation:~# cd /mnt/share
+   root@linkstation:/mnt/share# mkdir u-boot
+
+   Copy the U-Boot flash image to your LinkStation SMB share in the directory
+   u-boot.
+
+   Load the RAM build of U-Boot and at the U-Boot command prompt type:
+   => run upgrade
+
+   U-Boot will attempt to load the ROM build from the directory share/u-boot/
+   on the third partition of the hard drive. If the load is successful, it will
+   do the following:
+    1. unprotect the bootloader area;
+    2. erase the bootloader area;
+    3. copy the loaded file to the bootloader area;
+    4. verify the copy;
+
+   Here is the output of run upgrade
+   => run upgrade
+   Loading 0:3:share/u-boot/u-boot-hg.flash.bin
+   174668 bytes read
+   Un-Protected 3 sectors
+   Flash erase: first = 55 @ 0xfff00000
+                last  = 57 @ 0xfff20000
+   Flash erase: Done
+   Erased 3 sectors
+   Copy to Flash... done
+   Total of 174668 bytes were the same
+   =>
+
+   When the above sequence finishes, U-Boot returns to the command prompt (=>).
+
+   Depending on your flash chip, the flash operation can take a long time. Wait
+   patiently and do not try to power down or otherwise interrupt the flash or
+      you will end up with a "brick". 
+
+   Reboot:
+   => reset
+
+   The  power  LED should start blinking slowly and, if you have a serial
+   console, you should see the U-Boot startup messages. Your LinkStation is now
+   running U-Boot.
+
+    Flashing U-Boot from Linux
+
+   Connect to your LinkStation using either the serial port or telnet.
+
+   For LinkStation 1 / KuroBox standard run:
+   # cd /mnt/share/u-boot
+   # dd if=u-boot-hd.flash.bin of=/dev/fl2 bs=1k
+   # cmp u-boot.bin /dev/fl2
+
+   For LinkStation HG / KuroBox HG run:
+   # cd /mnt/share/u-boot
+   # dd if=u-boot-hg.flash.bin of=/dev/mtd1 bs=1k
+   # cmp u-boot.bin /dev/mtd1
+
+   The above commands for LinkStation HG / KuroBox HG will work on devices with
+   the original kernel version 2.4.20 but might to work on earlier devices
+   using kernel version 2.4.17. Please check which device corresponds to the
+   bootloader partition on your hardware.
+
+    If the Flash Fails
+
+   If the flash was not written correctly but U-Boot returns at the command
+   prompt, try to re-run run upgrade.
+
+   If the same happens when you attempt to install U-Boot from Linux, try to dd
+   again.
+
+   If your flash fails completely, for example due to a power failure, all is
+   not  completely  lost. You can still use a JTAG cable to re-flash your
+   Linkstation. Unfortunately, this is a relatively complicated and expensive
+   solution as it involves acquiring or building the JTAG cable and soldering
+   the header for it on the LinkStation motherboard. For more information on
+   how   to  use  a  JTAG  cable  with  the  LinkStation  you  can  visit
+   [18]www.linkstationwiki.net and [19]www.kurobox.com/mwiki.
+
+  EM Mode
+
+             Warning for the LinkStation / LinkStation HG users
+
+   Do not attempt to boot into EM mode using the method described here. The
+   password for the EM mode is unknown for all LinkStation models.
+
+   Once you have U-Boot installed in the on-board flash, you can boot in EM
+   mode even if the third boot command described above doesn't work.
+
+   Stop the boot countdown by pressing 's' in your net console window and, at
+   the U-Boot command prompt, run:
+   => run writeng
+   => run flboot
+
+   The above commands write "NGNG" to 0xFFF70000 and boot from the on-board
+   flash. To revert to normal boot by writing "OKOK" to 0xFFF70000, run:
+   => run writeok
+   => boot
+
+  Advanced configuration
+
+   The  initial  U-Boot  configuration can be changed by editing the file
+   include/configs/linkstation.h.
+
+   In all the examples below, please note the backslash-zero (\0) at the end of
+   the strings and the space-backslash ( \) at the end of each lines and do not
+   change them. 
+
+    Change the name of the default boot file
+
+   Search for the lines containing:
+   "hdpart=0:1\0" \
+   "hdfile=boot/vmlinux.UBoot\0" \
+
+   and  change  them  to the values you want. Partition 0:1 means disk 0,
+   partition 1. Obviously, you can only change the partition number as there is
+   only one disk. The name of the file must be given relative to the root of
+   the partition.
+
+    Change the default console to the serial console
+
+   Search for the lines containing:
+   "stdin=nc\0" \
+   "stdout=nc\0" \
+   "stderr=nc\0" \
+
+   and change them to:
+   "stdin=serial\0" \
+   "stdout=serial\0" \
+   "stderr=serial\0" \
+
+    Change the default boot command to boot from flash
+
+   Search for the lines containing:
+   "bootcmd1=run hdboot;run flboot\0" \
+   "bootcmd2=run flboot\0" \
+
+   and change them to:
+   "bootcmd1=run flboot\0" \
+   "bootcmd2=run hdboot;run flboot\0" \
+
+References
+
+   1. http://www.linuxnotincluded.org.uk/fdl.txt
+   2. http://www.linkstationwiki.net/index.php?title=CGI_Exploit_%28PowerPC%29_original_method_of_Hacking_the_LinkStation
+   3. http://www.linkstationwiki.net/index.php?title=Turn_your_LinkStation_into_a_Kuro_Box_%28PowerPC%29
+   4. http://linkstationwiki.net/index.php?title=OpenLink
+   5. http://linkstationwiki.net/index.php?title=The_LinkStation_firmware_flasher
+   6. http://downloads.linkstationwiki.net/snapshots/HD-HGLAN_149_100_telnet.zip
+   7. http://www.linkstationwiki.net/index.php?title=Add_a_Serial_port_to_the_PowerPC_Linkstation
+   8. http://netcat.sourceforge.net/
+   9. http://www.vulnwatch.org/netcat
+  10. http://ftp.sunet.se/pub/Linux/distributions/eldk/3.1.1/ppc-linux-x86/iso/ppc-2005-03-07.iso
+  11. ftp://ftp.denx.de/pub/u-boot/u-boot-1.1.4.tar.bz2
+  12. http://www.linuxnotincluded.org.uk/linkstation/downloads/u-boot-1.1.4-list-2.1.0.diff.gz
+  13. http://www.linuxnotincluded.org.uk/linkstation/downloads/uloader-2.4.17.tar.gz
+  14. http://www.linuxnotincluded.org.uk/linkstation/downloads/uloader-2.4.20.tar.gz
+  15. http://www.denx.de/wiki/DULG/Manual
+  16. http://linkstationwiki.net/index.php?title=Information/PPCFlashROM
+  17. http://linkstationwiki.net/index.php?title=Information/HGFlashROM
+  18. http://www.linkstationwiki.net/
+  19. http://www.kurobox.com/mwiki
diff -urN u-boot-86xx/board/linkstation/Makefile u-boot-86xx-kuro_clean/board/linkstation/Makefile
--- u-boot-86xx/board/linkstation/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/Makefile	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,41 @@
+#
+# (C) Copyright 2001
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+include $(TOPDIR)/config.mk
+
+LIB	= lib$(BOARD).a
+
+OBJS	= $(BOARD).o flash.o ide.o hwctl.o bootls.o avr.o
+SOBJS	= early_init.o
+
+$(LIB):	.depend $(OBJS) $(SOBJS)
+	$(AR) crv $@ $(OBJS) $(SOBJS)
+
+#########################################################################
+
+.depend:	Makefile $(SOBJS:.o=.S) $(OBJS:.o=.c)
+		$(CC) -M $(CFLAGS) $(SOBJS:.o=.S) $(OBJS:.o=.c) > $@
+
+sinclude .depend
+
+#########################################################################
diff -urN u-boot-86xx/board/linkstation/avr.c u-boot-86xx-kuro_clean/board/linkstation/avr.c
--- u-boot-86xx/board/linkstation/avr.c	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/avr.c	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,307 @@
+/*
+ * avr.c
+ *
+ * AVR functions
+ *
+ * Copyright (C) 2006 Mihai Georgian <u-boot@linuxnotincluded.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+#include <common.h>
+#include <ns16550.h>
+#include <console.h>
+
+/* Button codes from the AVR */
+#define PWRR				0x20	/* Power button release */
+#define PWRP				0x21	/* Power button push    */
+#define RESR				0x22	/* Reset button release */
+#define RESP				0x23	/* Reset button push    */
+#define AVRINIT				0x33	/* Init complete		*/
+#define AVRRESET			0x31	/* Reset request		*/
+
+/* LED commands */
+#define PWRBLINKSTRT		'['		/* Blink power LED		*/
+#define PWRBLINKSTOP		'Z'		/* Solid power LED		*/
+#define HDDLEDON			'W'		/* HDD LED on 			*/
+#define HDDLEDOFF			'V'		/* HDD LED off			*/
+#define HDDBLINKSTRT		'Y'		/* HDD LED start blink	*/
+#define HDDBLINKSTOP		'X'		/* HDD LED stop blink	*/
+
+/* Timings for LEDs blinking to show choice */
+#define PULSETIME			250		/* msecs				*/
+#define LONGPAUSE			(5 * PULSETIME)
+
+/* Button press times */
+#define PUSHHOLD			1000	/* msecs				*/
+#define NOBUTTON			(6 * (LONGPAUSE+PULSETIME))
+
+/* Boot and console choices */
+#define MAX_BOOT_CHOICE		3
+
+static char *consoles[] = {
+	"serial",
+#if defined(CONFIG_NETCONSOLE)
+	"nc",
+#endif
+};
+#define MAX_CONS_CHOICE 	(sizeof(consoles)/sizeof(char *))
+
+#if !defined(CONFIG_NETCONSOLE)
+#define DEF_CONS_CHOICE		0
+#else
+#define DEF_CONS_CHOICE		1
+#endif
+
+#define perror(fmt,args...)     printf("%s: ",__FUNCTION__);printf(fmt,##args)
+
+extern void miconCntl_SendCmd(unsigned char dat);
+extern void miconCntl_DisWDT(void);
+
+static int boot_stop;
+
+static int boot_choice = 1;
+static int cons_choice = DEF_CONS_CHOICE;
+
+static char envbuffer[16];
+
+void init_AVR_DUART (void)
+{
+	NS16550_t AVR_port = (NS16550_t) CFG_NS16550_COM2;
+	int clock_divisor = CFG_NS16550_CLK / 16 / 9600;
+
+	/*
+	 * AVR port init sequence taken from
+	 * the original Linkstation init code
+	 * Normal U-Boot serial reinit doesn't
+	 * work because the AVR uses even parity
+	 */
+	AVR_port->lcr = 0x00;
+	AVR_port->ier = 0x00;
+	AVR_port->lcr = LCR_BKSE;
+	AVR_port->dll = clock_divisor & 0xff;
+	AVR_port->dlm = (clock_divisor >> 8) & 0xff;
+	AVR_port->lcr = LCR_WLS_8 | LCR_PEN | LCR_EPS;
+	AVR_port->mcr = 0x00;
+	AVR_port->fcr = FCR_FIFO_EN | FCR_RXSR | FCR_TXSR;
+
+	miconCntl_DisWDT();
+
+	boot_stop = 0;
+	miconCntl_SendCmd(PWRBLINKSTRT);
+}
+
+void hw_watchdog_reset (void)
+{
+}
+
+static inline int avr_tstc(void)
+{
+	return (NS16550_tstc((NS16550_t)CFG_NS16550_COM2));
+}
+
+static inline char avr_getc(void)
+{
+	return (NS16550_getc((NS16550_t)CFG_NS16550_COM2));
+}
+
+static int push_timeout(char button_code)
+{
+	ulong push_start = get_timer(0);
+	while (get_timer(push_start) <= PUSHHOLD)
+		if (avr_tstc() && avr_getc() == button_code)
+			return 0;
+	return 1;
+}
+
+static void next_boot_choice(void)
+{
+	ulong return_start;
+	ulong pulse_start;
+	int on_times;
+	int button_on;
+	int led_state;
+	char c;
+	
+	button_on = 0;
+	return_start = get_timer(0);
+
+	on_times = boot_choice;
+	led_state = 0;
+	miconCntl_SendCmd(HDDLEDOFF);
+	pulse_start = get_timer(0);
+
+	while (get_timer(return_start) <= NOBUTTON || button_on)
+	{
+		if (avr_tstc()) {
+			c = avr_getc();
+			if (c == PWRP)
+				button_on = 1;
+			else if (c == PWRR) {
+				button_on = 0;
+				return_start = get_timer(0);
+				if (++boot_choice > MAX_BOOT_CHOICE)
+					boot_choice = 1;
+				sprintf(envbuffer, "bootcmd%d", boot_choice);
+				if (getenv(envbuffer)) {
+					sprintf(envbuffer, "run bootcmd%d", boot_choice);
+					setenv("bootcmd", envbuffer);
+				}
+				on_times = boot_choice;
+				led_state = 1;
+				miconCntl_SendCmd(HDDLEDON);
+				pulse_start = get_timer(0);
+			} else {
+				perror("Unexpected code: 0x%02X\n", c);
+			}
+		}
+		if (on_times && get_timer(pulse_start) > PULSETIME) {
+			if (led_state == 1) {
+				--on_times;
+				led_state = 0;
+				miconCntl_SendCmd(HDDLEDOFF);
+			} else {
+				led_state = 1;
+				miconCntl_SendCmd(HDDLEDON);
+			}
+			pulse_start = get_timer(0);
+		}
+		if (!on_times && get_timer(pulse_start) > LONGPAUSE) {
+			on_times = boot_choice;
+			led_state = 1;
+			miconCntl_SendCmd(HDDLEDON);
+			pulse_start = get_timer(0);
+		}
+	}
+	if (led_state)
+		miconCntl_SendCmd(HDDLEDOFF);
+}
+
+void next_cons_choice(int console)
+{
+	ulong return_start;
+	ulong pulse_start;
+	int on_times;
+	int button_on;
+	int led_state;
+	char c;
+	device_t *idev;
+	device_t *odev;
+	
+	button_on = 0;
+	cons_choice = console;
+	return_start = get_timer(0);
+
+	on_times = cons_choice+1;
+	led_state = 1;
+	miconCntl_SendCmd(HDDLEDON);
+	pulse_start = get_timer(0);
+
+	while (get_timer(return_start) <= NOBUTTON || button_on)
+	{
+		if (avr_tstc()) {
+			c = avr_getc();
+			if (c == RESP)
+				button_on = 1;
+			else if (c == RESR) {
+				button_on = 0;
+				return_start = get_timer(0);
+				cons_choice = (cons_choice + 1) % MAX_CONS_CHOICE;
+				idev = search_device(DEV_FLAGS_INPUT,  consoles[cons_choice]);
+				odev = search_device(DEV_FLAGS_OUTPUT, consoles[cons_choice]);
+				console_setfile (stdin,  idev);
+				console_setfile (stdout, odev);
+				console_setfile (stderr, odev);
+				on_times = cons_choice+1;
+				led_state = 0;
+				miconCntl_SendCmd(HDDLEDOFF);
+				pulse_start = get_timer(0);
+			} else {
+				perror("Unexpected code: 0x%02X\n", c);
+			}
+		}
+		if (on_times && get_timer(pulse_start) > PULSETIME) {
+			if (led_state == 0) {
+				--on_times;
+				led_state = 1;
+				miconCntl_SendCmd(HDDLEDON);
+			} else {
+				led_state = 0;
+				miconCntl_SendCmd(HDDLEDOFF);
+			}
+			pulse_start = get_timer(0);
+		}
+		if (!on_times && get_timer(pulse_start) > LONGPAUSE) {
+			on_times = cons_choice+1;
+			led_state = 0;
+			miconCntl_SendCmd(HDDLEDOFF);
+			pulse_start = get_timer(0);
+		}
+	}
+	if (led_state);
+		miconCntl_SendCmd(HDDLEDOFF);
+}
+
+int avr_input(void)
+{
+	char avr_button;
+	int ret;
+
+	if (!avr_tstc())
+		return 0;
+
+	avr_button = avr_getc();
+	switch (avr_button) {
+		case PWRP:
+			if (push_timeout(PWRR)) {
+				/* Timeout before power button release */
+				boot_stop = ~boot_stop;
+				if (boot_stop)
+					miconCntl_SendCmd(PWRBLINKSTOP);
+				else
+					miconCntl_SendCmd(PWRBLINKSTRT);
+				/* Wait for power button release */
+				while (avr_getc() != PWRR)
+					;
+			}
+			else
+				/* Power button released */
+				next_boot_choice();
+			break;
+		case RESP:
+			/* Wait for Reset button release */
+			while (avr_getc() != RESR)
+				;
+			next_cons_choice(cons_choice);
+			break;
+		case AVRINIT:
+			return 0;
+		default:
+			perror("Unexpected code: 0x%02X\n", avr_button);
+			return 0;
+	}
+	if (boot_stop)
+		return (-3);
+	else
+		return (-2);
+}
+
+void avr_StopBoot(void)
+{
+	boot_stop = ~0;
+	miconCntl_SendCmd(PWRBLINKSTOP);
+}
+
+/* vim: set ts=4: */
diff -urN u-boot-86xx/board/linkstation/bootls.c u-boot-86xx-kuro_clean/board/linkstation/bootls.c
--- u-boot-86xx/board/linkstation/bootls.c	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/bootls.c	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,304 @@
+/*
+ * bootls.c
+ *
+ * Boot a Linkstation kernel of type firmimg.bin
+ *
+ * U-Boot loader code for Linkstation kernel. A file of type firmimg.bin
+ * consists of a header, immediately followed by a compressed kernel image,
+ * followed by a compressed initrd image.
+ *
+ * Copyright (C) 2006 Mihai Georgian <u-boot@linuxnotincluded.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * Derived from:
+ *
+ * arch/ppc/common/misc-simple.c (linux-2.4.17_mvl21-sandpoint)
+ * Author: Matt Porter <mporter@mvista.com>
+ * Derived from arch/ppc/boot/prep/misc.c
+ * 2001 (c) MontaVista, Software, Inc.
+ *
+ * common/cmd_bootm.c (u-boot-1.1.4)
+ * (C) Copyright 2000-2002
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ */
+
+#include <common.h>
+#include <command.h>
+
+#include "firminfo.h"
+
+#define _ALIGN(addr,size)       (((addr)+size-1)&(~(size-1)))
+
+struct bi_record {
+	unsigned long tag;		/* tag ID */
+	unsigned long size;		/* size of record (in bytes) */
+	unsigned long data[0];	/* data */
+};
+
+#define BI_FIRST	0x1010	/* first record - marker */
+#define BI_LAST		0x1011	/* last record - marker */
+
+extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+extern int gunzip(void *, int, unsigned char *, int *);
+
+/*
+ * output BYTE data
+ */
+static inline void outb(volatile unsigned char *addr, int val)
+{
+	asm volatile("eieio");
+	asm volatile("stb%U0%X0 %1,%0; sync; isync" : "=m" (*addr) : "r" (val));
+}
+
+unsigned long checksum_check(unsigned char* addr, unsigned long size)
+{
+	long *laddr = (long *)addr;
+	unsigned long sum = 0,remain = 0;
+	int i;
+	while(size>=4) {
+		sum += *laddr;
+		laddr++;
+		size -= 4;
+	}
+	addr = (unsigned char*)laddr;
+	for(i=0;i<4;++i) {
+		remain = remain << 8;
+		if(size>i) remain += *addr;
+		addr++;
+		}
+	sum += remain;
+	return sum;
+}
+
+void do_boot_lskernel (cmd_tbl_t *cmdtp,
+					int flag,
+					int argc,
+					char *argv[],
+					unsigned long load_addr,
+					unsigned long *len_ptr,
+					int verify)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+
+	char 			*zimage_start;
+	int 			zimage_size;
+	unsigned long 	initrd_start;
+	unsigned long 	initrd_end;
+	unsigned long 	sp;
+	unsigned long 	cmd_start;
+	unsigned long 	cmd_end;
+	char 			*cmdline;
+	char 			*s;
+	bd_t 			*kbd;
+	void    		(*kernel)(bd_t *, ulong, ulong, ulong, ulong);
+	unsigned long	iflag;
+	struct firminfo *info = (struct firminfo *)load_addr;
+	struct bi_record *rec;
+
+	int				i;
+	char			*flashstr="FLASH";
+
+	for (i=0; i <= 4; i++)
+		if (info->subver[i] != flashstr[i]) {
+			puts ("Not a Linkstation kernel\n");
+			return;
+		}
+
+	printf("\n******* Product Information *******\n");
+	printf("----------------------------------\n");
+
+	printf("Product Name: %s\n", info->firmname);
+	printf("         VER: %d.%02d\n", info->ver_major, info->ver_minor);
+	printf("        Date: %d/%d/%d %d:%d:%d\n",
+			info->year+1900, info->mon, info->day,
+			info->hour,info->min,info->sec);
+	printf("----------------------------------\n");
+	
+	if (verify) {
+		printf("Verifying checksum... ");
+		if (checksum_check((unsigned char*)info, info->size) != 0) {
+			printf("Failed!: checksum %08X, expecting 0\n",
+					checksum_check((unsigned char*)info, info->size));
+			return; /* Returns on error */
+		} else
+			printf("OK\n");
+	}
+
+	zimage_start = (char*)info + info->kernel_offset;
+	zimage_size  = (int)info->kernel_size;
+	iflag = disable_interrupts();
+	puts("Uncompressing kernel...");
+	if (gunzip(0, 0x400000, zimage_start, &zimage_size) != 0) {
+		puts ("Failed! MUST reset board to recover\n");
+		do_reset (cmdtp, flag, argc, argv);
+	} else
+		puts("done.\n");
+
+	/*
+	 * Allocate space for command line and board info - the
+	 * address should be as high as possible within the reach of
+	 * the kernel (see CFG_BOOTMAPSZ settings), but in unused
+	 * memory, which means far enough below the current stack
+	 * pointer.
+	 */
+
+	asm( "mr %0,1": "=r"(sp) : );
+	debug ("## Current stack ends at 0x%08lX ", sp);
+	sp -= 2048;		/* just to be sure */
+	if (sp > CFG_BOOTMAPSZ)
+		sp = CFG_BOOTMAPSZ;
+	sp &= ~0xF;
+	debug ("=> set upper limit to 0x%08lX\n", sp);
+
+	cmdline = (char *)((sp - CFG_BARGSIZE) & ~0xF);
+	if ((s = getenv("bootargs")) == NULL)
+		s = "root=/dev/hda1";
+	strcpy (cmdline, s);
+	cmd_start    = (ulong)&cmdline[0];
+	cmd_end      = cmd_start + strlen(cmdline);
+	debug ("## cmdline at 0x%08lX ... 0x%08lX\n", cmd_start, cmd_end);
+
+	kbd = (bd_t *)(((ulong)cmdline - sizeof(bd_t)) & ~0xF);
+	*kbd = *(gd->bd);
+	if ((s = getenv ("clocks_in_mhz")) != NULL) {
+		/* convert all clock information to MHz */
+		kbd->bi_intfreq /= 1000000L;
+		kbd->bi_busfreq /= 1000000L;
+	}
+
+	kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))0x4;
+
+	if (info->initrd_size > 0) {
+		initrd_start = (unsigned long)((char*)info + info->initrd_offset);
+		initrd_end   = initrd_start + info->initrd_size;
+		if(initrd_start > 0xffc00000 && initrd_end < 0xffefffff) {
+			unsigned long nsp;
+			unsigned long data;
+
+			data = initrd_start;
+			/*
+			 * the inital ramdisk does not need to be within
+			 * CFG_BOOTMAPSZ as it is not accessed until after
+			 * the mm system is initialised.
+			 *
+			 * do the stack bottom calculation again and see if
+			 * the initrd will fit just below the monitor stack
+			 * bottom without overwriting the area allocated
+			 * above for command line args and board info.
+			 */
+			asm( "mr %0,1": "=r"(nsp) : );
+			nsp -= 2048;			/* just to be sure */
+			nsp &= ~0xF;
+			nsp -= info->initrd_size;
+			nsp &= ~(4096 - 1);		/* align on page */
+			initrd_start = nsp;
+			initrd_end = initrd_start + info->initrd_size;
+			printf ("Loading Ramdisk at 0x%08lX, end 0x%08lX ... ",
+					initrd_start, initrd_end);
+			memmove ((void *)initrd_start, (void *)data, info->initrd_size);
+			puts ("OK\n");
+		}
+	} else {
+		initrd_start = 0;
+		initrd_end   = 0;
+	}
+
+	/*
+	 * The kernel looks for this structure even if
+	 * the information in it is replaced by the
+	 * Linkstation kernel
+     */ 
+	rec = (struct bi_record *)_ALIGN((unsigned long)zimage_size +
+					(1 << 20) - 1,(1 << 20));
+	rec->tag = BI_FIRST;
+	rec->size = sizeof(struct bi_record);
+	rec = (struct bi_record *)((unsigned long)rec + rec->size);
+	rec->tag = BI_LAST;
+	rec->size = sizeof(struct bi_record);
+
+#if defined(CONFIG_HLAN) || defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+	// kernel load done.
+	outb(0x80004500, 0x49); // send signal
+	outb(0x80004500, 0x49); // send signal
+	outb(0x80004500, 0x49); // send signal
+	outb(0x80004500, 0x49); // send signal
+#endif
+#if defined(CONFIG_HGLAN)
+	// full speed 
+	udelay(10000);  /* 10 msec */
+	outb(0x80004500, 0x5D); // send signal
+	outb(0x80004500, 0x5D); // send signal
+	outb(0x80004500, 0x5D); // send signal
+	outb(0x80004500, 0x5D); // send signal
+#endif
+#if defined(CONFIG_HTGL)
+	// LINK/ACT led controll
+	outb(0x80004500, 0x61); // a
+	outb(0x80004500, 0x61); // a
+	outb(0x80004500, 0x39); // 9
+	outb(0x80004500, 0x31); // 1
+	outb(0x80004500, 0x39); // 9
+	outb(0x80004500, 0x30); // 0
+	outb(0x80004500, 0x92); // 1000Mbps down
+	outb(0x80004500, 0x92); // 1000Mbps down
+
+	udelay(10000);  /* 10 msec */
+	outb(0x80004500, 0x61); // a
+	outb(0x80004500, 0x61); // a
+	outb(0x80004500, 0x39); // 9
+	outb(0x80004500, 0x30); // 0
+	outb(0x80004500, 0x39); // 9
+	outb(0x80004500, 0x30); // 0
+	outb(0x80004500, 0x90); // 100Mbps down
+	outb(0x80004500, 0x90); // 100Mbps down
+
+	udelay(10000);  /* 10 msec */
+	outb(0x80004500, 0x61); // a
+	outb(0x80004500, 0x61); // a
+	outb(0x80004500, 0x38); // 8
+	outb(0x80004500, 0x46); // F
+	outb(0x80004500, 0x39); // 9
+	outb(0x80004500, 0x30); // 0
+	outb(0x80004500, 0x8E); // 10Mbps down
+	outb(0x80004500, 0x8E); // 10Mbps down
+
+	udelay(10000);  /* 10 msec */
+	outb(0x80004500, 0x5F); // _
+	outb(0x80004500, 0x5F); // _
+#endif
+
+/*
+ * This is what the original boot loader sends
+ * just before jumping to the kernel start
+ */
+	outb(0xFF000001, 0xFF);
+
+	puts("Booting the kernel\n");
+
+	/*
+	 * Linux Kernel Parameters:
+	 *   r3: ptr to board info data
+	 *   r4: initrd_start or 0 if no initrd
+	 *   r5: initrd_end - unused if r4 is 0
+	 *   r6: Start of command line string
+	 *   r7: End   of command line string
+	*/
+	(*kernel)((bd_t *)0xFF000001, initrd_start, initrd_end, cmd_start, cmd_end);
+}
+
+/* vim: set ts=4: */
diff -urN u-boot-86xx/board/linkstation/config.mk u-boot-86xx-kuro_clean/board/linkstation/config.mk
--- u-boot-86xx/board/linkstation/config.mk	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/config.mk	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,50 @@
+#
+# (C) Copyright 2001-2003
+# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+#
+# See file CREDITS for list of people who contributed to this
+# project.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+
+# LinkStation/LinkStation-HG:
+#
+#       Valid values for TEXT_BASE are:
+#
+#	Standard configuration - all models
+#       0xFFF00000   boot from flash
+#
+#	Test configuration (boot from RAM using uloader.o)
+#	LinkStation HD-HLAN and KuroBox Standard
+#       0x03F00000   boot from RAM
+#	LinkStation HD-HGLAN and KuroBox HG
+#       0x07F00000   boot from RAM
+#
+
+sinclude $(TOPDIR)/board/$(BOARDDIR)/config.tmp
+
+ifndef TEXT_BASE
+# For flash image - all models
+TEXT_BASE = 0xFFF00000
+# For RAM image
+# HLAN and LAN
+#TEXT_BASE = 0x03F00000
+# HGLAN and HGTL
+#TEXT_BASE = 0x07F00000
+endif
+
+PLATFORM_CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
diff -urN u-boot-86xx/board/linkstation/early_init.S u-boot-86xx-kuro_clean/board/linkstation/early_init.S
--- u-boot-86xx/board/linkstation/early_init.S	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/early_init.S	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,432 @@
+/*
+ * board/linkstation/early_init.S
+ *
+ * Begin at some arbitrary location in RAM or Flash
+ *  Initialize core registers
+ *  Configure memory controller (Not executing from RAM)
+ *  Initialize UARTs
+ *  Simple RAM test (currently suspended)
+ *
+ * Copyright (C) 2006 Mihai Georgian <u-boot@linuxnotincluded.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * Modified for U-Boot from arch/ppc/boot/linkstation/head.S from
+ * the GPL code for the Buffalo Terastation, derived in its turn from:
+ *
+ * arch/ppc/boot/sandpoint/head.S
+ *
+ * Initial board bringup code for Motorola SPS Sandpoint test platform
+ *
+ * Author: Mark A. Greer
+ *	   mgreer@mvista.com
+ * Derived from arch/ppc/boot/pcore/head.S (mporter@mvista.com)
+ *
+ * Copyright 2001 MontaVista Software Inc.
+ */
+
+#include <config.h>
+#include <ppc_asm.tmpl>
+#include <mpc824x.h>
+#include <ppc_defs.h>
+#include <asm/cache.h> 
+
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN)
+#define RAM_SIZE        0x04000000
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+#define RAM_SIZE        0x08000000
+#endif
+
+#define UART1           0x80004500
+#define UART1_IER       0x80004501
+#define UART1_FCR       0x80004502
+#define UART1_LCR       0x80004503
+#define UART1_DCR       0x80004511
+#define UART2           0x80004600
+#define UART2_IER       0x80004601
+#define UART2_FCR       0x80004602
+#define UART2_LCR       0x80004603
+#define UART2_DCR       0x80004611
+
+#define WM32(address,data) \
+	lis	r3, address@h; \
+	ori	r3, r3, address@l; \
+	lis	r4, data@h; \
+	ori	r4, r4, data@l; \
+	stw	r4, 0x0000(r3); \
+	sync;  \
+	isync;
+
+#define WM16(address,data) \
+	lis	r3, address@h; \
+	ori	r3, r3, address@l; \
+	li	r4, data; \
+	sth	r4, 0x0000(r3); \
+	sync;  \
+	isync;
+
+#define WM8(address,data) \
+	lis	r3, address@h; \
+	ori	r3, r3, address@l; \
+	li	r4, data; \
+	stb	r4, 0(r3); \
+	sync;  \
+	isync;
+
+	.text
+
+	.globl	early_init_f
+early_init_f:
+/*
+ * Configure core registers
+ */
+
+	/* Establish default MSR value, exception prefix 0xFFF */
+	li	r3,MSR_IP|MSR_FP
+	mtmsr	r3
+
+	/* Clear BATS */
+	li      r8,0
+	mtspr   DBAT0U,r8
+	mtspr	DBAT0L,r8
+	mtspr   DBAT1U,r8
+	mtspr	DBAT1L,r8
+	mtspr   DBAT2U,r8
+	mtspr	DBAT2L,r8
+	mtspr   DBAT3U,r8
+	mtspr	DBAT3L,r8
+	mtspr   IBAT0U,r8
+	mtspr	IBAT0L,r8
+	mtspr   IBAT1U,r8
+	mtspr	IBAT1L,r8
+	mtspr	IBAT2U,r8
+	mtspr   IBAT2L,r8
+	mtspr   IBAT3U,r8
+	mtspr	IBAT3L,r8
+	isync
+	sync
+	sync
+
+	/* Set segment registers */
+	lis	r8, 0x0000
+	isync
+	mtsr	SR0,r8
+	mtsr	SR1,r8
+	mtsr	SR2,r8
+	mtsr	SR3,r8
+	mtsr	SR4,r8
+	mtsr	SR5,r8
+	mtsr	SR6,r8
+	mtsr	SR7,r8
+	mtsr	SR8,r8
+	mtsr	SR9,r8
+	mtsr	SR10,r8
+	mtsr	SR11,r8
+	mtsr	SR12,r8
+	mtsr	SR13,r8
+	mtsr	SR14,r8
+	mtsr	SR15,r8
+	isync
+	sync
+	sync
+
+	/* Disable L1 icache/dcache */
+	li	r4,0x0000
+	isync
+	mtspr	HID0,r4
+	sync
+	isync
+	
+	/* Flash Invalidate L1 icache/dcache */
+	
+	ori	r4,r4,0x8000
+	ori	r8,r4,0x0800
+	isync
+	mtspr	HID0,r8
+	sync
+	isync
+	
+	/* Older cores need to manually clear ICFI bit */
+	
+	mtspr	HID0,r4
+	sync
+	isync
+
+#if !defined(CFG_RAMBOOT)
+melco_config_start:
+	/* --- CPU Configration registor setting for LinkStation --- */
+	WM32(0x80041020,0x000000a0) /* Reset EPIC */
+
+	/* errata for latency timer */
+	WM32(0xFEC00000,0x0d000080)
+	WM8(0xFEE00001,0x20)
+	/* cash size */
+	WM32(0xFEC00000,0x0c000080)
+	WM8(0xFEE00000,0x08)
+	/*  PCI configuration command register */
+	WM32(0xFEC00000,0x04000080)
+	WM16(0xFEE00000,0x0600)
+	/* Processor interface configuration register 1 */
+	WM32(0xFEC00000,0xa8000080)
+	/* WM32(0xFEE00000,0xd8131400) */
+	lis	r3, 0xFEE00000@h 
+	ori	r3, r3, 0xFEE00000@l
+	
+	lwz r5, 0(r3)  /* load PCIR1 Config */
+	lis r4, 0x0
+	ori r4, r4, 0x1000
+	and r5, r4, r5  /* Get Bit20(RCS0) */
+		
+	lis	r4, 0xd8130400@h
+	ori	r4, r4, 0xd8130400@l
+	or  r4, r4, r5   /* Save (RCS0) */
+	
+	stw	r4, 0x0000(r3)
+	sync
+	isync
+	
+	/* Processor interface configuration register 2 */
+	WM32(0xFEC00000,0xac000080)
+	WM32(0xFEE00000,0x00000004)
+	/* Embeded Utility Memory Block Base Address register */
+	WM32(0xFEC00000,0x78000080)
+	WM32(0xFEE00000,0x00000080)
+	/* Address map B option register */
+	WM32(0xFEC00000,0xe0000080)
+	WM8(0xFEE00000,0x20) /* DLL_RESET on */
+	
+	/* Address map B option register */
+	WM32(0xFEC00000,0xe0000080)
+	WM8(0xFEE00000,0xc0)
+	/* PCI arbiter control register */
+	WM32(0xFEC00000,0x46000080)
+	WM16(0xFEE00002,0x00c0)
+
+	/* Added to use the high drive strength for the memory selects & addressing */
+	WM32(0xFEC00000,0x73000080)
+		/* WM8(0xFEE00003,0x15) */  /*0x17*/
+		/* Motorola Errata refer to User's Manual Errata#19 */
+		/* WM8(0xFEE00003,0xD5) */
+	WM8(0xFEE00003,0x95)
+
+	/* set miscellaneous I/O control register 1 */
+	WM32(0xFEC00000,0x76000080)
+	WM8(0xFEE00002,0x00) /*0x02*/
+	/* set miscellaneous I/O control register 2 */
+	WM32(0xFEC00000,0x77000080)
+	WM8(0xFEE00003,0x30)  /* 0x30 */
+
+	/* init memory controller */
+	WM32(0xFEC00000,0x80000080)
+	WM32(0xFEE00000,0x00FFFFFF)
+
+	WM32(0xFEC00000,0x84000080)
+	WM32(0xFEE00000,0xFFFFFFFF)
+	
+	WM32(0xFEC00000,0x90000080)
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN)
+	WM32(0xFEE00000,0x3FFFFFFF) /* 64MB */
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+	WM32(0xFEE00000,0x7FFFFFFF) /* 128MB */
+#endif
+
+	WM32(0xFEC00000,0x94000080)
+	WM32(0xFEE00000,0xFFFFFFFF)
+	
+	WM32(0xFEC00000,0x88000080)
+	WM32(0xFEE00000,0x00030303)
+	/* EMSAR2 */
+	WM32(0xFEC00000,0x8C000080)
+	WM32(0xFEE00000,0x03030303)
+	/* select EMSER1 */
+	WM32(0xFEC00000,0x98000080)
+	WM32(0xFEE00000,0x00030303)
+	/* select EMSER2 */
+	WM32(0xFEC00000,0x9C000080)
+	WM32(0xFEE00000,0x03030303)
+
+	/* MMCR1 */
+	WM32(0xFEC00000,0xf0000080)
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN)
+	WM32(0xFEE00000,0x0200E005)	/* bank 0 13xnx4 */
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+	WM32(0xFEE00000,0x0200E005)	/* bank 0 13xnx4 */
+#endif
+	/* MCCR2 */
+	WM32(0xFEC00000,0xf4000080)
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN)
+	WM32(0xFEE00000,0xe0150000) /* 100MHz Memory bus */
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+	WM32(0xFEE00000,0x80150000) /* 133MHz Memory bus */
+#endif
+	/* MCCR3 */
+	WM32(0xFEC00000,0xf8000080)	
+	WM32(0xFEE00000,0x00000077)	/* BSTOPRE_M =7 / REFREC=8 */
+
+	/* MCCR4 */
+	WM32(0xFEC00000,0xfc000080)
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN)
+	WM32(0xFEE00000,0x29233222)	/* CAS latency=2, burst length=8, Ext Rom=eable */
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+	WM32(0xFEE00000,0x29323222)	/* CAS latency=3, burst length=4, Ext Rom=eable */
+#endif
+
+	/* Output driver control register */
+	WM32(0xFEC00000,0x73000080)
+	WM8(0xFEE00003,0x15)			/*  for all 40 ohm */
+	/* CLK driver Control Register */
+	WM32(0xFEC00000,0x74000080)
+	WM16(0xFEE00000,0x7078)
+	/* select MBEN */
+	WM32(0xFEC00000,0xa0000080)
+	WM8(0xFEE00000, 0x01)
+	/* MPM */
+	WM32(0xFEC00000,0xa3000080)
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN)
+	WM8(0xFEE00003,0xF2)	/* PGMAX = 242 */
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+	WM8(0xFEE00003,0xC9)	/* PGMAX = 201 */
+#endif
+	/* ERCR s */
+	WM32(0xFEC00000,0xd0000080) /*	; select ERCR1 */
+	WM32(0xFEE00000,0xffffff85)
+	WM32(0xFEC00000,0xd4000080) /*	; select ERCR2 */
+	WM32(0xFEE00000,0xffffff05)
+	WM32(0xFEC00000,0xd8000080) /*	; select ERCR3 */
+	WM32(0xFEE00000,0x0000f80f)
+	WM32(0xFEC00000,0xdc000080) /*  ; select ERCR4 */
+	WM32(0xFEE00000,0x0e000000)
+
+	/* MCCR1 */
+	WM32(0xFEC00000,0xf0000080)
+	WM32(0xFEE00000,0x0200E805)  /* 11 + 3 clock wait MEMGO on */
+
+	/* Init UART for AVR */
+	WM8(UART1_LCR,0x00) /* clear LCR */
+	WM8(UART1_IER,0x00) /* disable interrupt */
+	WM8(UART1_LCR,0x80) /* set LCR[DLAB] bit */
+	WM8(UART1_DCR,0x01) /* set DUART mode */
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN)
+	WM8(UART1,    0x8B) /* set DLL(baudrate 9600bps, 100MHz) */
+	WM8(UART1_IER,0x02) /* set DLM(baudrate 9600bps, 100MHz) */
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+	WM8(UART1,    0x61) /* set DLL(baudrate 9600bps, 133MHz) */
+	WM8(UART1_IER,0x03) /* set DLM(baudrate 9600bps, 133MHz) */
+#endif
+	WM8(UART1_LCR,0x1b) /* set 8data, 1stop, even parity */
+	WM8(UART1,    0x00) /* clear MCR */
+	WM8(UART1_FCR,0x07) /* clear & enable FIFO */
+
+	/* Init UART for CONSOLE */
+	WM8(UART2_LCR,0x00) /* clear LCR */
+	WM8(UART2_IER,0x00) /* disable interrupt */
+	WM8(UART2_LCR,0x80) /* set LCR[DLAB] bit */
+	WM8(UART1_DCR,0x01) /* set DUART mode */
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN)
+	WM8(UART2,    0x6C) /* set DLL(baudrate 57600bps, 100MHz) */
+	WM8(UART2_IER,0x00) /* set DLM(baudrate 57600bps, 100MHz) */
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+	WM8(UART2,    0x90) /* set DLL(baudrate 57600bps, 133MHz) */
+	WM8(UART2_IER,0x00) /* set DLM(baudrate 57600bps, 133MHz) */
+#endif
+	WM8(UART2_LCR,0x03) /* set 8data, 1stop, non parity */
+	WM8(UART2,    0x00) /* clear MCR */
+	WM8(UART2_FCR,0x07) /* clear & enable FIFO */
+#endif /* !defined (CFG_RAMBOOT)
+
+	/* PCI Command Register initialize */
+	lis r3, 0x8000
+	ori r3, r3, 0x0004
+	lis r4, 0xFEC0
+	ori r4, r4, 0x0000
+	stwbrx r4, 0, r3
+	sync
+	isync
+
+	li r6, 0x0006
+	lis r5, 0xFEE0
+	ori r5, r5, 0x0000
+	sthbrx r5, 0, r6
+	sync
+	isync
+
+#if !defined(CFG_RAMBOOT)
+check_ram:
+	/* Wait 1 sec  for AVR become enable */
+	li	r3,1000
+	mulli	r3,r3,1000
+	mulli	r4,r3,1000	/* nanoseconds */
+	addi	r4,r4,39
+	li	r5,40		/* 40ns if for 100 Mhz bus */
+	divw	r4,r4,r5	/* BUS ticks */
+1:	mftbu	r5
+	mftb	r6
+	mftbu	r7
+	cmp	0,r5,r7
+	bne	1b		/* Get [synced] base time */
+	addc	r9,r6,r4	/* Compute end time */
+	addze	r8,r5
+2:	mftbu	r5
+	cmp	0,r5,r8
+	blt	2b
+	bgt	3f
+	mftb	r6
+	cmp	0,r6,r9
+	blt	2b
+#if 1
+3:
+#else
+	/* Check RAM */
+	/* set start address(0x00000000) */
+3:	xor r4,r4,r4
+	lis r5,     RAM_SIZE@h
+	ori r5, r5, RAM_SIZE@l
+	lis r6,     0xaaaa  /* mask pattern a */
+	ori r6, r6, 0xaaaa
+	lis r7,     0x5555  /* mask pattern b */
+	ori r7, r7, 0x5555
+	lis r8,     0x0000  /* check step size */
+	ori r8, r8, 0x0100
+check_ram_loop:	
+	cmp 0,r4,r5
+	beq  check_ram_end
+	stw r6,0(r4)
+	isync
+	lwz r3,0(r4)
+	isync
+	cmp 0,r3,r6
+	bne ram_error
+	stw r7,0x00fc(r4)
+	isync
+	lwz r3,0x00fc(r4)
+	isync
+	cmp 0,r3,r7
+	bne ram_error
+	add r4,r4,r8
+	b   check_ram_loop
+ram_error:
+#if defined(CONFIG_LAN)
+	WM8(UART1,0x39)  /* ram error */
+#elif defined(CONFIG_HGLAN) ||defined(CONFIG_HLAN) || defined(CONFIG_HTGL)
+	WM8(UART1,0x6F)  /* ram error */
+#endif
+	b   ram_error
+check_ram_end:
+#endif /* #if 1 */
+#endif /* !defined (CFG_RAMBOOT) */
+
+/* The instruction cache is enabled and the data cache is disabled */
+	blr
diff -urN u-boot-86xx/board/linkstation/firminfo.h u-boot-86xx-kuro_clean/board/linkstation/firminfo.h
--- u-boot-86xx/board/linkstation/firminfo.h	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/firminfo.h	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,27 @@
+#define FIRMNAME_MAX   31
+#define SUBVERSION_MAX 31
+#define FIRMINFO_VER 1
+
+struct firminfo {
+		unsigned long info_ver;
+		unsigned long  firmid;
+		char           firmname[FIRMNAME_MAX+1];
+		char           subver[SUBVERSION_MAX+1];
+		unsigned short ver_major;
+		unsigned short ver_minor;
+		unsigned short build;
+		char           year;
+		char           mon;
+		char           day;
+		char           hour;
+		char           min;
+		char           sec;
+		unsigned long size;
+		unsigned long chksum;
+		
+		unsigned long kernel_offset;
+		unsigned long kernel_size;
+		unsigned long initrd_offset;
+		unsigned long initrd_size;
+	} __attribute((aligned(4)));
+// ----------------------------------------------------
diff -urN u-boot-86xx/board/linkstation/flash.c u-boot-86xx-kuro_clean/board/linkstation/flash.c
--- u-boot-86xx/board/linkstation/flash.c	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/flash.c	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,893 @@
+/*
+ * flash.c
+ *
+ * Flash device interface for LinkStation
+ * Supports CFI flash devices using the AMD standard command set
+ *
+ * Copyright (C) 2006 Mihai Georgin <u-boot@linuxnotincluded.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * Based on the MTD code from the Linux kernel
+ * 
+ * Based on include/melco/flashd.c (linux-2.4.17_mvl21-sandpoint)
+ * Copyright (C) 2001-2004  BUFFALO INC.
+ */
+#include <common.h>
+#include <asm/io.h>
+#include <mpc824x.h>
+
+#if 0
+#define DEBUG_CFI
+#endif
+
+#undef  debug
+#ifdef  DEBUG_CFI
+#define debug(fmt,args...)      printf(fmt,##args)
+#else
+#define debug(fmt,args...)
+#endif  /* DEBUG_CFI */
+
+#if CFG_MAX_FLASH_BANKS > 1
+#error Only 1 flash bank supported
+#endif
+
+#define perror(fmt,args...)		printf("%s: ",__FUNCTION__);printf(fmt,##args)
+
+#define MAX_ERASE_REGIONS		4
+
+#define P_ID_NONE			    0
+#define P_ID_INTEL_EXT		    1
+#define P_ID_AMD_STD		    2
+#define P_ID_INTEL_STD		    3
+#define P_ID_AMD_EXT		    4
+#define P_ID_MITSUBISHI_STD	  256
+#define P_ID_MITSUBISHI_EXT	  257
+#define P_ID_RESERVED 		65535
+
+#define CFI_DEVICETYPE_X8	 (8 / 8)
+#define CFI_DEVICETYPE_X16	(16 / 8)
+
+#define FLASH_DATA_MASK		0xFF
+
+#define FUJ_MANUFACT_LS		(FUJ_MANUFACT    & FLASH_DATA_MASK)
+#define STM_MANUFACT_LS		(STM_MANUFACT    & FLASH_DATA_MASK)
+#define MX_MANUFACT_LS		(MX_MANUFACT     & FLASH_DATA_MASK)
+
+/* Unknown manufacturer */
+#define FLASH_MAN_UNKNOWN	0xFFFF0000
+
+/* Fujitsu MBM29PL320MT which is using the same */
+/* codes as the AMD Am29LV320MT "mirror" flash */
+#define AMD_ID_MIRROR_LS	(AMD_ID_MIRROR   & FLASH_DATA_MASK)
+#define AMD_ID_LV320T_2_LS	(AMD_ID_LV320T_2 & FLASH_DATA_MASK)
+#define AMD_ID_LV320T_3_LS	(AMD_ID_LV320T_3 & FLASH_DATA_MASK)
+
+/* ST Micro M29W320DT and M29W320DB */
+#define STM_ID_29W320DT_LS	(STM_ID_29W320DT & FLASH_DATA_MASK)
+#define STM_ID_29W320DB_LS	(STM_ID_29W320DB & FLASH_DATA_MASK)
+
+/* ST Micro M29DW324DT and M29DW324DB */
+#define STM_ID_29W324DT_LS	(STM_ID_29W324DT & FLASH_DATA_MASK)
+#define STM_ID_29W324DB_LS	(STM_ID_29W324DB & FLASH_DATA_MASK)
+
+/* Macronix MX29LV320T */
+#define MX_ID_LV320T_LS		(MX_ID_LV320T    & FLASH_DATA_MASK)
+
+/* Basic Query Structure */
+struct cfi_ident {
+  __u8  qry[3];
+  __u16 P_ID;
+  __u16 P_ADR;
+  __u16 A_ID;
+  __u16 A_ADR;
+  __u8  VccMin;
+  __u8  VccMax;
+  __u8  VppMin;
+  __u8  VppMax;
+  __u8  WordWriteTimeoutTyp;
+  __u8  BufWriteTimeoutTyp;
+  __u8  BlockEraseTimeoutTyp;
+  __u8  ChipEraseTimeoutTyp;
+  __u8  WordWriteTimeoutMax;
+  __u8  BufWriteTimeoutMax;
+  __u8  BlockEraseTimeoutMax;
+  __u8  ChipEraseTimeoutMax;
+  __u8  DevSize;
+  __u16 InterfaceDesc;
+  __u16 MaxBufWriteSize;
+  __u8  NumEraseRegions;
+  __u32 EraseRegionInfo[MAX_ERASE_REGIONS];
+} __attribute__((packed));
+
+struct cfi_private {
+	__u32 base;
+	int device_type;
+	int addr_unlock1;
+	int addr_unlock2;
+	struct cfi_ident *cfiq;
+	int mfr;
+	int id[3]; /* Supports AMD MirrorBit flash */
+	char *flash_name;
+	int  wrd_wr_time;
+	int  buf_wr_time;
+	int  erase_time;
+	int (*blk_erase)(flash_info_t *info, int s_first, int s_last);
+	int (*blk_write)(flash_info_t *info, __u8 *buf, __u32 addr, int sz);
+};
+
+static inline __u8 cfi_read8(__u32 addr)
+{
+	return (*(volatile __u8 *)(addr));
+}
+
+static inline void cfi_write8(__u8 val, __u32 addr)
+{
+	*(volatile __u8 *)(addr) = val;
+	sync();
+}
+
+/*
+ * Sends a CFI command to a bank of flash for the given type.
+ * Returns the offset to the sent command
+ */
+static inline __u32 cfi_cmd(__u8 cmd, __u32 cmd_addr, __u32 base, int type)
+{
+	__u32 addr;
+
+	addr = base + cmd_addr * type;
+	if (cmd_addr * type == 0x554)
+		++addr;
+
+	cfi_write8(cmd, addr);
+
+	return addr - base;
+}
+
+static inline __u8 cfi_read_query(__u32 addr)
+{
+	return cfi_read8(addr);
+}
+
+flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
+static struct cfi_private cfis;
+static struct cfi_ident   cfi_idents;
+static struct cfi_private *cfi;
+
+static int cfi_probe_chip(struct cfi_private *cfi);
+static unsigned long cfi_amdstd_setup(struct cfi_private *cfi, int primary);
+static void print_cfi_ident(struct cfi_ident *);
+static int flash_amdstd_erase(flash_info_t *info, int s_first, int s_last);
+static int flash_amdstd_wbuff(flash_info_t *info, __u8 *buf, __u32 addr,int sz);
+static int flash_amdstd_wubyp(flash_info_t *info, __u8 *buf, __u32 addr,int sz);
+static int flash_amdstd_write(flash_info_t *info, __u8 *buf, __u32 addr,int sz);
+
+
+
+unsigned long flash_init(void)
+{
+	unsigned long flash_size;
+	__u16 type;
+
+	debug("%s\n", __FUNCTION__);
+
+	cfi = &cfis;
+	memset(cfi, 0, sizeof(struct cfi_private));
+
+	cfi->base = CFG_FLASH_BASE;
+
+	/* Identify CFI chip */
+	/* Probe for X8 device first */
+	cfi->device_type = CFI_DEVICETYPE_X8;
+	if (cfi_probe_chip(cfi)) {
+		/* The probe didn't like it */
+		/* so probe for X16/X8 device */
+		cfi->device_type = CFI_DEVICETYPE_X16;
+		if (cfi_probe_chip(cfi)) {
+			/* The probe didn't like it */
+			return 0UL;
+		}
+	}		
+
+	/* Check if it is AMD standard cmd set */
+	type = cfi->cfiq->P_ID;
+	if (type == P_ID_AMD_STD)
+		flash_size = cfi_amdstd_setup(cfi, 1);
+	else {
+		perror("Primary cmd set is not AMD std. Trying alternate.\n");
+		flash_size = 0;
+	}
+	if (!flash_size) {
+		type = cfi->cfiq->A_ID;
+		if (type == P_ID_AMD_STD)
+			flash_size = cfi_amdstd_setup(cfi, 0);
+		else {
+			perror("Alternate cmd set is not AMD std.\n");
+			return 0UL;
+		}
+	}
+
+	if (flash_size && flash_size == 4*1024*1024) {
+		/* Flash protection ON by default */
+		flash_protect(FLAG_PROTECT_SET, cfi->base, cfi->base+flash_size-1, flash_info);
+
+		return flash_size;
+	}
+
+	if (flash_size) {
+		perror("Unsupported flash size: %d\n", flash_size);
+	} else {
+		perror("Vendor Command Set not supported\n");
+		printf("Primary: 0x%04X, Alternate: 0x%04X\n",
+				cfi->cfiq->P_ID, cfi->cfiq->A_ID);
+	}
+	return 0UL;
+}
+
+void flash_print_info(flash_info_t *info)
+{
+	int i;
+
+	debug("%s\n", __FUNCTION__);
+
+	printf("Flash chip: %s\n\n",
+		   cfi->flash_name?cfi->flash_name:"UNKNOWN");
+	print_cfi_ident(cfi->cfiq);
+	printf("\nActual values used by U-Boot:\n");
+	printf("Word   write timeout: %6d ms\n", cfi->wrd_wr_time);
+	printf("Buffer write timeout: %6d ms\n", cfi->buf_wr_time);
+	printf("Sector erase timeout: %6d ms\n", cfi->erase_time);
+	printf("\nSize: %ld MiB in %d Sectors\n",info->size>>20,info->sector_count);
+	printf ("  Sector Start Addresses:");
+	for (i=0; i<info->sector_count; i++) {
+		if (!(i % 5))
+			printf ("\n   ");
+		printf (" %08lX%s", info->start[i], info->protect[i]?" (RO)" : " (RW)");
+	}
+	printf ("\n");
+}
+
+int flash_erase(flash_info_t *info, int s_first, int s_last)
+{
+	return (*(cfi->blk_erase))(info, s_first, s_last);
+}
+
+int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
+{
+	return (*(cfi->blk_write))(info, src, addr, cnt);
+}
+
+static int cfi_probe_chip(struct cfi_private *cfi)
+{
+	int ofs_factor = cfi->device_type;
+	__u32 base = cfi->base;
+	int num_erase_regions, scount;
+	int i;
+
+	debug("%s\n", __FUNCTION__);
+
+	cfi_cmd(0xF0, 0x00, base, cfi->device_type);
+	cfi_cmd(0x98, 0x55, base, cfi->device_type);
+
+	if (cfi_read8(base + ofs_factor * 0x10) != 'Q' ||
+	    cfi_read8(base + ofs_factor * 0x11) != 'R' ||
+	    cfi_read8(base + ofs_factor * 0x12) != 'Y') {
+		debug("Not a CFI flash\n");
+		/* Put the chip back into read array mode */
+		cfi_cmd(0xF0, 0x00, base, cfi->device_type);
+		return -1;
+	}
+
+	num_erase_regions = cfi_read_query(base + 0x2C * ofs_factor);
+	if (!num_erase_regions) {
+		perror("No erase regions\n");
+		/* Put the chip back into read read array mode */
+		cfi_cmd(0xF0, 0x00, base, cfi->device_type);
+		return -1;
+	}
+	if (num_erase_regions > MAX_ERASE_REGIONS) {
+		perror("Number of erase regions (%d) > MAX_ERASE_REGIONS (%d)\n",
+				num_erase_regions, MAX_ERASE_REGIONS);
+		/* Put the chip back into read read array mode */
+		cfi_cmd(0xF0, 0x00, base, cfi->device_type);
+		return -1;
+	}
+
+	cfi->cfiq = &cfi_idents;
+	memset(cfi->cfiq, 0, sizeof(struct cfi_ident));	
+	debug("cfi->cfiq: 0x%08X\n", cfi->cfiq);
+	
+	/* Read the CFI info structure */
+	for (i=0; i < sizeof(struct cfi_ident) + num_erase_regions * 4; i++)
+		((__u8 *)cfi->cfiq)[i] = cfi_read_query(base + (0x10 + i) * ofs_factor);
+	
+	/* Do any necessary byteswapping */
+	cfi->cfiq->P_ID            = __le16_to_cpu(cfi->cfiq->P_ID);
+	cfi->cfiq->P_ADR           = __le16_to_cpu(cfi->cfiq->P_ADR);
+	cfi->cfiq->A_ID            = __le16_to_cpu(cfi->cfiq->A_ID);
+	cfi->cfiq->A_ADR           = __le16_to_cpu(cfi->cfiq->A_ADR);
+	cfi->cfiq->InterfaceDesc   = __le16_to_cpu(cfi->cfiq->InterfaceDesc);
+	cfi->cfiq->MaxBufWriteSize = __le16_to_cpu(cfi->cfiq->MaxBufWriteSize);
+
+#if 0
+	/* Dump the information therein */
+	print_cfi_ident(cfi->cfiq);
+#endif
+
+	scount = 0;
+	for (i=0; i<cfi->cfiq->NumEraseRegions; i++) {
+		cfi->cfiq->EraseRegionInfo[i] = __le32_to_cpu(cfi->cfiq->EraseRegionInfo[i]);
+		scount += (cfi->cfiq->EraseRegionInfo[i] & 0xFFFF) + 1;
+		debug("  Erase Region #%d: sector size 0x%4.4X bytes, %d sectors\n",
+		       i, (cfi->cfiq->EraseRegionInfo[i] >> 8) & ~0xFF, 
+		       (cfi->cfiq->EraseRegionInfo[i] & 0xFFFF) + 1);
+	}
+	/* Put it back into Read Mode */
+	cfi_cmd(0xF0, 0, base, cfi->device_type);
+
+	if (scount > CFG_MAX_FLASH_SECT) {
+		perror("Number of sectors (%d) > CFG_MAX_FLASH_SECT (%d)\n",
+				scount, CFG_MAX_FLASH_SECT);
+		return -1;
+	}
+
+	debug("Found x%d device in 8-bit mode\n", cfi->device_type*8);
+	
+	return 0;
+}
+
+static char *vendorname(__u16 vendor) 
+{
+	switch (vendor) {
+	case P_ID_NONE:
+		return "None";
+	case P_ID_INTEL_EXT:
+		return "Intel/Sharp Extended";
+	case P_ID_AMD_STD:
+		return "AMD/Fujitsu Standard";
+	case P_ID_INTEL_STD:
+		return "Intel/Sharp Standard";
+	case P_ID_AMD_EXT:
+		return "AMD/Fujitsu Extended";
+	case P_ID_MITSUBISHI_STD:
+		return "Mitsubishi Standard";
+	case P_ID_MITSUBISHI_EXT:
+		return "Mitsubishi Extended";
+	case P_ID_RESERVED:
+		return "Not Allowed / Reserved for Future Use";
+	default:
+		return "Unknown";
+	}
+}
+
+static void print_cfi_ident(struct cfi_ident *cfip)
+{
+	printf("CFI Query Results:\n");
+	printf("Primary Vendor Command Set: 0x%4.4X (%s)\n",
+			cfip->P_ID, vendorname(cfip->P_ID));
+	if (cfip->P_ADR)
+		printf("Primary Algorithm Table at 0x%4.4X\n", cfip->P_ADR);
+	else
+		printf("No Primary Algorithm Table\n");
+	
+	printf("Alternate Vendor Command Set: 0x%4.4X (%s)\n",
+		cfip->A_ID, vendorname(cfip->A_ID));
+	if (cfip->A_ADR)
+		printf("Alternate Algorithm Table at 0x%4.4X\n", cfip->A_ADR);
+	else
+		printf("No Alternate Algorithm Table\n");
+		
+	printf("Vcc Min.: %d.%d V\n", cfip->VccMin >> 4, cfip->VccMin & 0xF);
+	printf("Vcc Max.: %d.%d V\n", cfip->VccMax >> 4, cfip->VccMax & 0xF);
+	if (cfip->VppMin) {
+		printf("Vpp Min.: %d.%d V\n", cfip->VppMin >> 4, cfip->VppMin & 0xF);
+		printf("Vpp Max.: %d.%d V\n", cfip->VppMax >> 4, cfip->VppMax & 0xF);
+	}
+	else
+		printf("No Vpp line\n");
+	
+	printf("Typical byte/word write timeout: %d us\n",
+			1<<cfip->WordWriteTimeoutTyp);
+	printf("Maximum byte/word write timeout: %d us\n",
+			(1<<cfip->WordWriteTimeoutMax) * (1<<cfip->WordWriteTimeoutTyp));
+	
+	if (cfip->BufWriteTimeoutTyp || cfip->BufWriteTimeoutMax) {
+		printf("Typical full buffer write timeout: %d us\n",
+				1<<cfip->BufWriteTimeoutTyp);
+		printf("Maximum full buffer write timeout: %d us\n",
+				(1<<cfip->BufWriteTimeoutMax) * (1<<cfip->BufWriteTimeoutTyp));
+	}
+	else
+		printf("Full buffer write not supported\n");
+	
+	printf("Typical block erase timeout: %d ms\n",
+			1<<cfip->BlockEraseTimeoutTyp);
+	printf("Maximum block erase timeout: %d ms\n",
+			(1<<cfip->BlockEraseTimeoutMax) * (1<<cfip->BlockEraseTimeoutTyp));
+	if (cfip->ChipEraseTimeoutTyp || cfip->ChipEraseTimeoutMax) {
+		printf("Typical chip erase timeout: %d ms\n",
+				1<<cfip->ChipEraseTimeoutTyp); 
+		printf("Maximum chip erase timeout: %d ms\n",
+				(1<<cfip->ChipEraseTimeoutMax) * (1<<cfip->ChipEraseTimeoutTyp));
+	}
+	else
+		printf("Chip erase not supported\n");
+	
+	printf("Device size: 0x%X bytes (%d MiB)\n",
+			1 << cfip->DevSize, 1 << (cfip->DevSize - 20));
+	printf("Flash Device Interface description: 0x%4.4X\n",cfip->InterfaceDesc);
+	switch(cfip->InterfaceDesc) {
+	case 0:
+		printf("  - x8-only asynchronous interface\n");
+		break;
+	case 1:
+		printf("  - x16-only asynchronous interface\n");
+		break;
+	case 2:
+		printf("  - x8 / x16 via BYTE# with asynchronous interface\n");
+		break;
+	case 3:
+		printf("  - x32-only asynchronous interface\n");
+		break;
+	case 65535:
+		printf("  - Not Allowed / Reserved\n");
+		break;
+	default:
+		printf("  - Unknown\n");
+		break;
+	}
+	printf("Max. bytes in buffer write: %d\n", 1 << cfip->MaxBufWriteSize);
+	printf("Number of Erase Block Regions: %d\n", cfip->NumEraseRegions);
+}
+
+static unsigned long cfi_amdstd_setup(struct cfi_private *cfi, int primary)
+{
+	flash_info_t *info = &flash_info[0];
+	__u32 base         = cfi->base;
+	int ofs_factor     = cfi->device_type;
+	__u32 addr_et      = primary?cfi->cfiq->P_ADR:cfi->cfiq->A_ADR;
+	__u8 major, minor, bootloc;
+	__u32 offset, ernum, ersize;
+	int i, j;
+
+	/* Put the chip into read array mode */
+	cfi_cmd(0xF0, 0x00, base, cfi->device_type);
+	/* Autoselect */
+	cfi_cmd(0xAA, 0x555, base, cfi->device_type);
+	cfi_cmd(0x55, 0x2AA, base, cfi->device_type);
+	cfi_cmd(0x90, 0x555, base, cfi->device_type);
+	/* Read manufacturer and device id */
+	cfi->mfr = cfi_read_query(base + 0x00 * ofs_factor);
+	if ((cfi->id[0] = cfi_read_query(base + 0x01 * ofs_factor)) == 0x7E) {   
+		 cfi->id[1] = cfi_read_query(base + 0x0E * ofs_factor);
+		 cfi->id[2] = cfi_read_query(base + 0x0F * ofs_factor);
+	}
+	/* Put the chip into read array mode */
+	cfi_cmd(0xF0, 0x00, base, cfi->device_type);
+
+	/* Put the chip into read query mode */
+	cfi_cmd(0x98, 0x55, base, cfi->device_type);
+	/* Find the boot block location and swap the erase regions as necessary */
+	major = cfi_read_query(base + (addr_et + 3) * ofs_factor);
+	minor = cfi_read_query(base + (addr_et + 4) * ofs_factor);
+	debug(" Amd/Fujitsu Extended Query Table v%c.%c at 0x%4.4X\n",
+	       major, minor, addr_et);
+
+	if (((major << 8) | minor) < 0x3131) {
+		/* CFI version 1.0 => don't trust bootloc */
+		if (cfi->id[0] & 0x80) {
+			printf("Device ID is 0x%02X. Assuming broken CFI table.\n",
+					cfi->id[0]);
+			bootloc = 3;	/* top boot */
+		} else
+			bootloc = 2;	/* bottom boot */
+	} else
+		bootloc = cfi_read_query(base + (addr_et + 0xF) * ofs_factor);
+
+	if (bootloc == 3 && cfi->cfiq->NumEraseRegions > 1) {
+		debug("Top boot block. Swapping erase regions.\n");
+		for (i=0; i<cfi->cfiq->NumEraseRegions / 2; i++) {
+			int j = (cfi->cfiq->NumEraseRegions-1)-i;
+			__u32 swap;
+			
+			swap = cfi->cfiq->EraseRegionInfo[i];
+			cfi->cfiq->EraseRegionInfo[i] = cfi->cfiq->EraseRegionInfo[j];
+			cfi->cfiq->EraseRegionInfo[j] = swap;
+		}
+	}
+
+	/* Put the chip into read array mode */
+	cfi_cmd(0xF0, 0x00, base, cfi->device_type);
+
+	switch (cfi->device_type) {
+	case CFI_DEVICETYPE_X8:
+		/* X8 chip */
+		cfi->addr_unlock1 = 0x555; 
+		cfi->addr_unlock2 = 0x2AA; 
+		break;
+	case CFI_DEVICETYPE_X16:
+		/* X16 chip in X8 mode */
+		cfi->addr_unlock1 = 0xAAA;
+		cfi->addr_unlock2 = 0x555;
+		break;
+	default:
+		perror("Unsupported device type %d\n", cfi->device_type);
+		return 0UL;
+	}
+
+	cfi->wrd_wr_time  = 1 << cfi->cfiq->WordWriteTimeoutTyp;
+	cfi->wrd_wr_time *= 1 << cfi->cfiq->WordWriteTimeoutMax;
+	/* Word write time is in us, convert to ms */
+	cfi->wrd_wr_time  = cfi->wrd_wr_time / 1000 + 1;
+	if (cfi->wrd_wr_time == 1)
+		/* Account for the timer resolution which is 1 ms */
+		cfi->wrd_wr_time = 2;
+	cfi->buf_wr_time  = 1 << cfi->cfiq->BufWriteTimeoutTyp;
+	cfi->buf_wr_time *= 1 << cfi->cfiq->BufWriteTimeoutMax;
+	/* Buffer write time is in us, convert to ms */
+	cfi->buf_wr_time  = cfi->buf_wr_time / 1000 + 1;
+	if (cfi->buf_wr_time == 1)
+		/* Account for the timer resolution which is 1 ms */
+		cfi->buf_wr_time = 2;
+	cfi->erase_time   = 1 << cfi->cfiq->BlockEraseTimeoutTyp;
+	cfi->erase_time  *= 1 << cfi->cfiq->BlockEraseTimeoutMax;
+	
+	info->size = (1 << cfi->cfiq->DevSize);
+	
+	info->sector_count = 0;
+	offset = CFG_FLASH_BASE;
+	for (i=0; i < cfi->cfiq->NumEraseRegions; i++) {
+		ersize = ((cfi->cfiq->EraseRegionInfo[i] >> 8) & ~0xFF);
+		ernum = (cfi->cfiq->EraseRegionInfo[i] & 0xFFFF) + 1;
+		
+		for (j=0; j < ernum; j++) {
+			info->start[info->sector_count + j] = offset;
+			offset += ersize;
+		}
+
+		info->sector_count += ernum;
+	}
+
+	switch (cfi->mfr) {
+	case FUJ_MANUFACT_LS:
+		info->flash_id = FLASH_MAN_FUJ;
+		switch (cfi->id[0]) {
+		case AMD_ID_MIRROR_LS:
+			if (cfi->id[1] == AMD_ID_LV320T_2_LS &&
+			    cfi->id[2] == AMD_ID_LV320T_3_LS) {
+				info->flash_id += FLASH_AMLV320T;
+				cfi->blk_write = flash_amdstd_wbuff;
+				cfi->flash_name = "FUJITSU MBM29PL32TM";
+			} else
+				info->flash_id += FLASH_UNKNOWN;
+			break;
+		default:
+			info->flash_id += FLASH_UNKNOWN;
+			break;
+		}
+		break;
+	case STM_MANUFACT_LS:
+		info->flash_id = FLASH_MAN_STM;
+		switch (cfi->id[0]) {
+		case STM_ID_29W320DT_LS:
+			info->flash_id += FLASH_STMW320DT;
+			cfi->blk_write = flash_amdstd_wubyp;
+			cfi->flash_name = "STMICRO M29W320DT";
+			break;
+		case STM_ID_29W320DB_LS:
+			info->flash_id += FLASH_STMW320DB;
+			cfi->blk_write = flash_amdstd_wubyp;
+			cfi->flash_name = "STMICRO M29W320DB";
+			break;
+		case STM_ID_29W324DT_LS:
+			info->flash_id += FLASH_STMW324DT;
+			cfi->blk_write = flash_amdstd_wubyp;
+			cfi->flash_name = "STMICRO M29W324DT";
+			break;
+		case STM_ID_29W324DB_LS:
+			info->flash_id += FLASH_STMW324DB;
+			cfi->blk_write = flash_amdstd_wubyp;
+			cfi->flash_name = "STMICRO M29W324DB";
+			break;
+		default:
+			info->flash_id += FLASH_UNKNOWN;
+			break;
+		}
+		break;
+	case MX_MANUFACT_LS:
+		info->flash_id = FLASH_MAN_MX;
+		switch (cfi->id[0]) {
+		case MX_ID_LV320T_LS:
+			info->flash_id += FLASH_MXLV320T;
+			cfi->blk_write = flash_amdstd_write;
+			cfi->flash_name = "MXIC MX29LV320T";
+			break;
+		default:
+			info->flash_id += FLASH_UNKNOWN;
+			break;
+		}
+		break;
+	default:
+		info->flash_id = FLASH_AMD_COMP;
+		break;
+	}
+
+	if ((info->flash_id & FLASH_TYPEMASK) == FLASH_UNKNOWN) {
+		/* Unknown but supported CFI flash */
+		cfi->flash_name = NULL;
+		if (cfi->cfiq->MaxBufWriteSize)
+			cfi->blk_write = flash_amdstd_wbuff;
+		else
+			cfi->blk_write = flash_amdstd_write;
+	}
+
+	cfi->blk_erase = flash_amdstd_erase;
+
+	return info->size;
+}
+
+#define BIT(x) (1<<x)
+/*
+ * Check the flash command state
+ */
+static int flash_amdstd_state(__u32 addr, __u32 target, int timeout)
+{
+	__u32 start_time = get_timer(0);
+	__u32 data;
+
+	debug("%s\n", __FUNCTION__);
+
+	do {
+		data = cfi_read8(addr);
+		if((data & BIT(7)) == (target & BIT(7)))
+			return 0;
+		if(data & BIT(5)) {
+			data = cfi_read8(addr);
+			if((data & BIT(7)) == (target & BIT(7))) 
+				return 0;
+			else
+				return -1;
+		}
+	} while (get_timer(start_time) < timeout);
+	return -1;
+}
+
+/*
+ * Verify data written to flash
+ */
+static int flash_amdstd_vrfy(flash_info_t *info, __u8 *buf, __u32 addr, int sz)
+{
+	__u32 base = cfi->base;
+	__u8  *faddr;
+	long  i;
+
+	debug("%s\n", __FUNCTION__);
+
+	faddr = (__u8 *)addr;
+	for(i=0; i < sz; i++) {
+		if(faddr[i] != buf[i]) {
+			printf("Flash Write verify fail at %08x. ", &faddr[i]);
+			printf("Expecting: %02X, Actual: %02X\n", faddr[i], buf[i]);
+			printf("Retrying...");
+			cfi_cmd(0xAA, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+			cfi_cmd(0x55, cfi->addr_unlock2, base, CFI_DEVICETYPE_X8);
+			cfi_cmd(0xA0, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+			cfi_write8(buf[i], (__u32)&faddr[i]);
+			if (flash_amdstd_state((__u32)&faddr[i], buf[i], cfi->wrd_wr_time)) {
+				printf("failed again\n");
+				cfi_cmd(0xF0, 0, base, CFI_DEVICETYPE_X8);
+				return 1;
+			} else
+				printf("suceeded\n");
+		}
+	}
+	return 0;
+}
+
+/*
+ * Erase flash sectors
+ */
+static int flash_amdstd_erase(flash_info_t *info, int s_first, int s_last)
+{
+	int prot, sect, nsect, flag;
+	__u32 l_sect;
+	__u32 base = cfi->base;
+
+	debug("%s\n", __FUNCTION__);
+
+	if (!info->size) {
+		printf ("Flash erase: Can't erase unsupported flash\n");
+		return 1;
+	}
+
+	if (s_first < 0 || s_first > s_last    ||
+	    s_first > (info->sector_count - 1) ||
+		s_last  > (info->sector_count - 1)) {
+		printf ("Flash erase: no sectors to erase\n");
+		return 1;
+	}
+
+	printf("\nFlash erase: first = %d @ 0x%08lx\n",
+	        s_first, info->start[s_first]);
+	printf("             last  = %d @ 0x%08lx\n", s_last, info->start[s_last]);
+
+	nsect = s_last - s_first + 1;
+	for (prot = 0, sect=s_first; sect<=s_last; ++sect)
+		if (info->protect[sect])
+			prot++;
+	if (prot) {
+		if (prot == nsect) {
+			printf("Warning: All requested sectors are protected!\n");
+			printf("         No sectors to erase\n");
+			return 1;
+		}
+		else
+			printf("Warning: %d protected sectors will not be erased!\n", prot);
+	}
+	cfi_cmd(0xF0, 0x00, base, CFI_DEVICETYPE_X8);
+	udelay(1000);
+
+	/* Disable interrupts which might cause a timeout here */
+	flag = disable_interrupts();
+
+	cfi_cmd(0xAA, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+	cfi_cmd(0x55, cfi->addr_unlock2, base, CFI_DEVICETYPE_X8);
+	cfi_cmd(0x80, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+	cfi_cmd(0xAA, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+	cfi_cmd(0x55, cfi->addr_unlock2, base, CFI_DEVICETYPE_X8);
+	for (sect = s_first; sect <= s_last; sect++)
+		if (!info->protect[sect]) {
+			l_sect = info->start[sect];
+			cfi_write8(0x30, l_sect);
+		}
+	/* Erase begins 50us after the last sector address */
+	udelay(50);
+
+	/* All erase commands sent, enable interrupts */
+	if (flag)
+		enable_interrupts();
+
+	if (flash_amdstd_state(l_sect, 0xff, cfi->erase_time * nsect)) {
+		printf("Flash erase: Timeout\n");
+		cfi_cmd(0xF0, 0x00, base, CFI_DEVICETYPE_X8);
+		return 1;
+	}
+	printf("Flash erase: Done\n");
+	return 0;
+}
+
+/*
+ * Write to flash using Write Buffer programming
+ */
+static int flash_amdstd_wbuff(flash_info_t *info, __u8 *buf, __u32 addr, int sz)
+{
+	__u32 base = cfi->base;
+	__u32 wbufsz;
+	__u32 size, wsize, waddr, saddr;
+	__u8 *wbuf;
+	int i;
+
+	debug("%s\n", __FUNCTION__);
+
+	size = sz;
+	wbuf = buf;
+	wbufsz = 1 << cfi->cfiq->MaxBufWriteSize;
+
+	waddr = (addr + wbufsz - 1) & ~(wbufsz - 1);
+	if (waddr > addr)
+		wsize = waddr-addr;
+	else
+		wsize = wbufsz;
+	if (wsize > size)
+		wsize = size;
+	waddr = addr;
+
+	while (size > 0) {
+		for (i = 0; i < info->sector_count; i++)
+			if (waddr < info->start[i])
+				break;
+		saddr = info->start[i-1];
+
+       	cfi_cmd(0xAA, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+       	cfi_cmd(0x55, cfi->addr_unlock2, base, CFI_DEVICETYPE_X8);
+		cfi_write8(0x25, saddr);
+		cfi_write8(wsize-1, saddr);
+		for (i = 0; i < wsize; i++)
+			cfi_write8(*wbuf++, waddr++);
+		cfi_write8(0x29, saddr);
+
+    	if (flash_amdstd_state(waddr-1, *(wbuf-1), cfi->buf_wr_time)) {
+			printf("Flash write buffer: Timeout\n");
+			cfi_cmd(0xF0, 0x00, base, CFI_DEVICETYPE_X8);
+			return 1;
+		}
+
+		size -= wsize;
+		if ((wsize = wbufsz) > size)
+			wsize = size;
+	}
+			
+	return flash_amdstd_vrfy(info, buf, addr, sz);
+}
+
+/*
+ * Write to flash using Unlock Bypass command sequence
+ */
+static int flash_amdstd_wubyp(flash_info_t *info, __u8 *buf, __u32 addr, int sz)
+{
+	__u32 base = cfi->base;
+	__u32 waddr;
+	long  i;
+
+	debug("%s\n", __FUNCTION__);
+
+	waddr = addr;
+
+	cfi_cmd(0xAA, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+	cfi_cmd(0x55, cfi->addr_unlock2, base, CFI_DEVICETYPE_X8);
+	cfi_cmd(0x20, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+
+	for(i=0; i < sz; i++) {
+		cfi_write8(0xA0, waddr);
+		cfi_write8(buf[i], waddr);
+		if (flash_amdstd_state(waddr, buf[i], cfi->wrd_wr_time)) {
+			printf("Flash unlock bypass write: Timeout\n");
+			cfi_cmd(0x90, 0, base, CFI_DEVICETYPE_X8);
+			cfi_cmd(0x00, 0, base, CFI_DEVICETYPE_X8);
+			cfi_cmd(0xF0, 0, base, CFI_DEVICETYPE_X8);
+			return 1;
+		}
+		waddr++;
+	}
+	cfi_cmd(0x90, 0, base, CFI_DEVICETYPE_X8);
+	cfi_cmd(0x00, 0, base, CFI_DEVICETYPE_X8);
+	cfi_cmd(0xF0, 0, base, CFI_DEVICETYPE_X8);
+
+	return flash_amdstd_vrfy(info, buf, addr, sz);
+}
+
+/*
+ * Write to flash using Word/Byte Program command sequence
+ */
+static int flash_amdstd_write(flash_info_t *info, __u8 *buf, __u32 addr, int sz)
+{
+	__u32 base = cfi->base;
+	__u32 waddr;
+	long  i;
+
+	debug("%s\n", __FUNCTION__);
+
+	waddr = addr;
+
+	cfi_cmd(0xF0, 0, base, CFI_DEVICETYPE_X8);
+	for (i = 0; i < sz; i++) {
+		cfi_cmd(0xAA, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+		cfi_cmd(0x55, cfi->addr_unlock2, base, CFI_DEVICETYPE_X8);
+		cfi_cmd(0xA0, cfi->addr_unlock1, base, CFI_DEVICETYPE_X8);
+		cfi_write8(buf[i], waddr);
+		if (flash_amdstd_state(waddr, buf[i], cfi->wrd_wr_time)) {
+			printf("Flash write: Timeout\n");
+			cfi_cmd(0xF0, 0, base, CFI_DEVICETYPE_X8);
+			return 1;
+		}
+		waddr++;
+	}
+	cfi_cmd(0xF0, 0, base, CFI_DEVICETYPE_X8);
+
+	return flash_amdstd_vrfy(info, buf, addr, sz);
+}
+
+/* vim: set ts=4: */
diff -urN u-boot-86xx/board/linkstation/hwctl.c u-boot-86xx-kuro_clean/board/linkstation/hwctl.c
--- u-boot-86xx/board/linkstation/hwctl.c	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/hwctl.c	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,258 @@
+/*
+ * hwctl.c
+ *
+ * LinkStation HW Control Driver
+ *
+ * Copyright (C) 2001-2004  BUFFALO INC.
+ *
+ * This software may be used and distributed according to the terms of
+ * the GNU General Public License (GPL), incorporated herein by reference.
+ * Drivers based on or derived from this code fall under the GPL and must
+ * retain the authorship, copyright and license notice.  This file is not
+ * a complete program and may only be used when the entire operating
+ * system is licensed under the GPL.
+ *
+ */
+
+#include <config.h>
+#include <common.h>
+#include <command.h>
+
+#define mdelay(n)	udelay((n)*1000)
+
+#define AVR_PORT CFG_NS16550_COM2
+extern void udelay(unsigned long usec);
+
+
+// output BYTE data
+static inline void out_b(volatile unsigned char *addr, int val)
+{
+	__asm__ __volatile__("stb%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" (val));
+}
+
+#if 0
+// PWR,DISK_FULL/STATUS,DIAG LED controll
+void blink_led(unsigned char state)
+{
+#ifdef CONFIG_HTGL
+	switch (state)
+	{
+		case FLASH_CLEAR_START:
+		case FLASH_UPDATE_START:
+			out_b(AVR_PORT, 0x61);
+			out_b(AVR_PORT, 0x61);
+			out_b(AVR_PORT, 0x38);
+			out_b(AVR_PORT, 0x30);
+			out_b(AVR_PORT, 0x34);
+			out_b(AVR_PORT, 0x31);
+			mdelay(10);
+			out_b(AVR_PORT, 0x61);
+			out_b(AVR_PORT, 0x61);
+			out_b(AVR_PORT, 0x38);
+			out_b(AVR_PORT, 0x31);
+			out_b(AVR_PORT, 0x34);
+			out_b(AVR_PORT, 0x31);
+			mdelay(10);
+			out_b(AVR_PORT, 0x71);
+			out_b(AVR_PORT, 0x71);
+//			out_b(AVR_PORT, 0x71);
+//			out_b(AVR_PORT, 0x71);
+			mdelay(10);
+			out_b(AVR_PORT, 0x73);
+			out_b(AVR_PORT, 0x73);
+//			out_b(AVR_PORT, 0x73);
+//			out_b(AVR_PORT, 0x73);
+			mdelay(10);
+			break;
+		case FLASH_CLEAR_END:
+		case FLASH_UPDATE_END:
+			out_b(AVR_PORT, 0x70);
+			out_b(AVR_PORT, 0x70);
+//			out_b(AVR_PORT, 0x70);
+//			out_b(AVR_PORT, 0x70);
+			mdelay(10);
+			out_b(AVR_PORT, 0x72);
+			out_b(AVR_PORT, 0x72);
+//			out_b(AVR_PORT, 0x72);
+//			out_b(AVR_PORT, 0x72);
+			mdelay(10);
+			break;
+		case RAID_RESYNC_START:
+			break;
+		case RAID_RESYNC_END:
+			break;
+		default:
+			out_b(AVR_PORT, state);
+			out_b(AVR_PORT, state);
+			out_b(AVR_PORT, state);
+			out_b(AVR_PORT, state);
+			break;
+	}
+#else
+	out_b(AVR_PORT, state);
+	out_b(AVR_PORT, state);
+	out_b(AVR_PORT, state);
+	out_b(AVR_PORT, state);
+#endif
+
+}
+#endif
+
+// 2005.5.10 BUFFALO add
+//--------------------------------------------------------------
+static inline void miconCntl_SendUart(unsigned char dat)
+{
+	out_b((char *)AVR_PORT, dat);
+	udelay(1000);
+}
+
+//--------------------------------------------------------------
+void miconCntl_SendCmd(unsigned char dat)
+{
+	int i;
+	
+	for (i=0; i<4; i++){
+		miconCntl_SendUart(dat);
+	}
+}
+
+//--------------------------------------------------------------
+void miconCntl_FanLow(void)
+{
+	debug("%s\n",__FUNCTION__);
+#ifdef CONFIG_HTGL
+	miconCntl_SendCmd(0x5C);
+#endif
+}
+//--------------------------------------------------------------
+void miconCntl_FanHigh(void)
+{
+	debug("%s\n",__FUNCTION__);
+#ifdef CONFIG_HTGL
+	miconCntl_SendCmd(0x5D);
+#endif
+}
+
+//--------------------------------------------------------------
+//1000Mbps
+void miconCntl_Eth1000M(int up)
+{
+	debug("%s (%d)\n",__FUNCTION__,up);
+#ifdef CONFIG_HTGL
+	if (up){
+		miconCntl_SendCmd(0x93);
+	}else{
+		miconCntl_SendCmd(0x92);
+	}
+#else
+	if (up){
+		miconCntl_SendCmd(0x5D);
+	}else{
+		miconCntl_SendCmd(0x5C);
+	}
+#endif
+}
+//--------------------------------------------------------------
+//100Mbps
+void miconCntl_Eth100M(int up)
+{
+	debug("%s (%d)\n",__FUNCTION__,up);
+#ifdef CONFIG_HTGL
+	if (up){
+		miconCntl_SendCmd(0x91);
+	}else{
+		miconCntl_SendCmd(0x90);
+	}
+#else
+	if (up){
+		miconCntl_SendCmd(0x5C);
+	}
+#endif
+}
+//--------------------------------------------------------------
+//10Mbps
+void miconCntl_Eth10M(int up)
+{
+	debug("%s (%d)\n",__FUNCTION__,up);
+#ifdef CONFIG_HTGL
+	if (up){
+		miconCntl_SendCmd(0x8F);
+	}else{
+		miconCntl_SendCmd(0x8E);
+	}
+#else
+	if (up){
+		miconCntl_SendCmd(0x5C);
+	}
+#endif
+}
+//--------------------------------------------------------------
+//��������
+void miconCntl_5f(void)
+{
+	debug("%s\n",__FUNCTION__);
+	miconCntl_SendCmd(0x5F);
+	mdelay(100);
+}
+
+//--------------------------------------------------------------
+// "reboot start" signal
+void miconCntl_Reboot(void)
+{
+	debug("%s\n",__FUNCTION__);
+	miconCntl_SendCmd(0x43);
+}
+#if 0
+//--------------------------------------------------------------
+// Raid recovery start
+void miconCntl_RadiRecovery(void)
+{
+	debug("%s\n",__FUNCTION__);
+#ifdef CONFIG_HTGL
+	miconCntl_SendUart(0x61); // a
+	miconCntl_SendUart(0x61); // a
+	miconCntl_SendUart(0x38); // 8
+	miconCntl_SendUart(0x30); // 0
+	miconCntl_SendUart(0x34); // 4
+	miconCntl_SendUart(0x31); // 1
+	miconCntl_SendCmd(0x71); // q
+#endif
+}
+//--------------------------------------------------------------
+// Raid recovery finish
+void miconCntl_RadiRecoveryFin(void)
+{
+	debug("%s\n",__FUNCTION__);
+#ifdef CONFIG_HTGL
+	miconCntl_SendCmd(0x70);
+#endif
+}
+#endif
+
+// ---------------------------------------------------------------
+// Disable watchdog timer
+void miconCntl_DisWDT(void)
+{
+	debug("%s\n",__FUNCTION__);
+	miconCntl_SendCmd(0x41); // A
+	miconCntl_SendCmd(0x46); // F
+	miconCntl_SendCmd(0x4A); // J
+	miconCntl_SendCmd(0x3E); // >
+	miconCntl_SendCmd(0x56); // V
+	miconCntl_SendCmd(0x3E); // >
+	miconCntl_SendCmd(0x5A); // Z
+	miconCntl_SendCmd(0x56); // V
+	miconCntl_SendCmd(0x4B); // K
+}
+// ---------------------------------------------------------------
+// U-Boot calls this function
+int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+	disable_interrupts();
+	miconCntl_Reboot();
+	while (1)
+		miconCntl_SendUart(0x47);	/* Wait for reboot */
+
+}
+
+/* vim: set ts=4: */
diff -urN u-boot-86xx/board/linkstation/ide.c u-boot-86xx-kuro_clean/board/linkstation/ide.c
--- u-boot-86xx/board/linkstation/ide.c	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/ide.c	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,101 @@
+/*
+ * (C) Copyright 2000
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+/* ide.c - ide support functions */
+
+
+#include <common.h>
+
+#ifdef CFG_CMD_IDE
+#include <ata.h>
+#include <ide.h>
+#include <pci.h>
+
+#define IT8212_PCI_CpuCONTROL			0x5e
+#define IT8212_PCI_PciModeCONTROL		0x50
+#define IT8212_PCI_IdeIoCONFIG			0x40
+#define IT8212_PCI_IdeBusSkewCONTROL	0x4c
+#define IT8212_PCI_IdeDrivingCURRENT	0x42
+
+extern ulong ide_bus_offset[CFG_IDE_MAXBUS];
+extern struct pci_controller hose;
+
+int ide_preinit (void)
+{
+	int status;
+	pci_dev_t devbusfn;
+	int l;
+
+	status = 1;
+	for (l = 0; l < CFG_IDE_MAXBUS; l++) {
+		ide_bus_offset[l] = -ATA_STATUS;
+	}
+	devbusfn = pci_find_device (PCI_VENDOR_ID_CMD, PCI_DEVICE_ID_SII_680, 0);
+	if (devbusfn == -1)
+		devbusfn = pci_find_device (PCI_VENDOR_ID_ITE,PCI_DEVICE_ID_ITE_8212,0);
+	if (devbusfn != -1) {
+		status = 0;
+
+		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_0,
+							   (u32 *) &ide_bus_offset[0]);
+		ide_bus_offset[0] &= 0xfffffffe;
+		ide_bus_offset[0] = pci_hose_bus_to_phys(&hose,
+												 ide_bus_offset[0] & 0xfffffffe,
+												 PCI_REGION_IO);
+		pci_read_config_dword (devbusfn, PCI_BASE_ADDRESS_2,
+							   (u32 *) &ide_bus_offset[1]);
+		ide_bus_offset[1] &= 0xfffffffe;
+		ide_bus_offset[1] = pci_hose_bus_to_phys(&hose,
+												 ide_bus_offset[1] & 0xfffffffe,
+												 PCI_REGION_IO);
+	}
+
+	if (pci_find_device (PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8212, 0) != -1) {
+		pci_write_config_byte(devbusfn, IT8212_PCI_CpuCONTROL, 0x01);
+		pci_write_config_byte(devbusfn, IT8212_PCI_PciModeCONTROL, 0x00);
+		pci_write_config_word(devbusfn, PCI_COMMAND, 0x0047);
+#ifdef CONFIG_IT8212_SECONDARY_ENABLE
+		pci_write_config_word(devbusfn, IT8212_PCI_IdeIoCONFIG, 0xA0F3);
+#else
+		pci_write_config_word(devbusfn, IT8212_PCI_IdeIoCONFIG, 0x8031);
+#endif
+		pci_write_config_dword(devbusfn, IT8212_PCI_IdeBusSkewCONTROL, 0x02040204);
+// __LS_COMMENT__ BUFFALO changed 2004.11.10  changed for EMI
+        pci_write_config_byte(devbusfn, IT8212_PCI_IdeDrivingCURRENT, 0x36); // 10mA
+//      pci_write_config_byte(dev, IT8212_PCI_IdeDrivingCURRENT, 0x09); // 4mA
+//      pci_write_config_byte(dev, IT8212_PCI_IdeDrivingCURRENT, 0x12); // 6mA
+//      pci_write_config_byte(dev, IT8212_PCI_IdeDrivingCURRENT, 0x24); // 6mA,2mA
+//      pci_write_config_byte(dev, IT8212_PCI_IdeDrivingCURRENT, 0x2D); // 8mA,4mA
+        pci_write_config_byte(devbusfn, PCI_LATENCY_TIMER, 0x00);
+	}
+
+	return (status);
+}
+
+void ide_set_reset (int flag) {
+	return;
+}
+
+#endif /* of CONFIG_CMDS_IDE */
+
+/* vim: set ts=4: */
diff -urN u-boot-86xx/board/linkstation/linkstation.c u-boot-86xx-kuro_clean/board/linkstation/linkstation.c
--- u-boot-86xx/board/linkstation/linkstation.c	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/linkstation.c	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,127 @@
+/*
+ * linkstation.c
+ *
+ * Misc LinkStation specific functions
+ *
+ * Copyright (C) 2006 Mihai Georgin <u-boot@linuxnotincluded.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <version.h>
+#include <common.h>
+#include <mpc824x.h>
+#include <asm/io.h>
+#include <ns16550.h>
+
+#ifdef CONFIG_PCI
+#include <pci.h>
+#endif
+
+extern void init_AVR_DUART(void);
+extern void hw_watchdog_reset(void);
+
+int checkboard (void)
+{
+	DECLARE_GLOBAL_DATA_PTR;
+	ulong busfreq = get_bus_freq (0);
+	char buf[32];
+	char *p;
+	bd_t *bd = gd->bd;
+
+	init_AVR_DUART();
+	hw_watchdog_reset();
+
+	if ((p = getenv ("console_nr")) != NULL) {
+		unsigned long con_nr = simple_strtoul (p, NULL, 10) & 3;
+
+		bd->bi_baudrate &= ~3;
+		bd->bi_baudrate |= con_nr & 3;
+	}
+	return 0;
+}
+
+long int initdram (int board_type)
+{
+	return (get_ram_size(CFG_SDRAM_BASE, CFG_MAX_RAM_SIZE));
+}
+
+/*
+ * Initialize PCI Devices
+ */
+#ifdef CONFIG_PCI
+
+#ifndef CONFIG_PCI_PNP
+
+static struct pci_config_table pci_linkstation_config_table[] = {
+	/* vendor, device, class */
+	/* bus, dev, func */
+	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+	  PCI_ANY_ID, 0x0b, 0,		/* AN983B or RTL8110S  */
+								/* ethernet controller */
+	  pci_cfgfunc_config_device, { PCI_ETH_IOADDR,
+				       PCI_ETH_MEMADDR,
+				       PCI_COMMAND_IO |
+				       PCI_COMMAND_MEMORY |
+				       PCI_COMMAND_MASTER }},
+	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+	  PCI_ANY_ID, 0x0c, 0,		/* SII680 or IT8211AF */
+								/* ide controller     */
+	  pci_cfgfunc_config_device, { PCI_IDE_IOADDR,
+				       PCI_IDE_MEMADDR,
+				       PCI_COMMAND_IO |
+				       PCI_COMMAND_MEMORY |
+				       PCI_COMMAND_MASTER }},
+	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+	  PCI_ANY_ID, 0x0e, 0,		/* D720101 USB controller, 1st USB 1.1 */
+	  pci_cfgfunc_config_device, { PCI_USB0_IOADDR,
+				       PCI_USB0_MEMADDR,
+				       PCI_COMMAND_MEMORY |
+				       PCI_COMMAND_MASTER }},
+	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+	  PCI_ANY_ID, 0x0e, 1,		/* D720101 USB controller, 2nd USB 1.1 */
+	  pci_cfgfunc_config_device, { PCI_USB1_IOADDR,
+				       PCI_USB1_MEMADDR,
+				       PCI_COMMAND_MEMORY |
+				       PCI_COMMAND_MASTER }},
+	{ PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+	  PCI_ANY_ID, 0x0e, 2,		/* D720101 USB controller, USB 2.0 */
+	  pci_cfgfunc_config_device, { PCI_USB2_IOADDR,
+				       PCI_USB2_MEMADDR,
+				       PCI_COMMAND_MEMORY |
+				       PCI_COMMAND_MASTER }},
+	{ }
+};
+#endif
+
+struct pci_controller hose = {
+#ifndef CONFIG_PCI_PNP
+	config_table:pci_linkstation_config_table,
+#endif
+};
+
+void pci_init_board (void)
+{
+	pci_mpc824x_init (&hose);
+
+	/* Reset USB 1.1 */
+	out_le32(PCI_USB0_MEMADDR+8, 1);
+	out_le32(PCI_USB1_MEMADDR+8, 1);
+
+}
+#endif /* CONFIG_PCI */
+
+/* vim: set ts=4: */
diff -urN u-boot-86xx/board/linkstation/nc.sh u-boot-86xx-kuro_clean/board/linkstation/nc.sh
--- u-boot-86xx/board/linkstation/nc.sh	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/nc.sh	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,10 @@
+#! /bin/bash
+
+[ $# = 1 ] || { echo "Usage: $0 target_ip" >&2 ; exit 1 ; }
+TARGET_IP=$1
+
+stty -icanon -echo intr ^T
+#nc -u -l -p 6666 < /dev/null &
+nc -u -p 6666 -v -v ${TARGET_IP} 6666
+stty icanon echo intr ^C
+
diff -urN u-boot-86xx/board/linkstation/u-boot.lds u-boot-86xx-kuro_clean/board/linkstation/u-boot.lds
--- u-boot-86xx/board/linkstation/u-boot.lds	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/board/linkstation/u-boot.lds	2006-11-06 22:05:38.000000000 +0100
@@ -0,0 +1,138 @@
+/*
+ * (C) Copyright 2001
+ * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+OUTPUT_ARCH(powerpc)
+/*
+SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); SEARCH_DIR(/usr/lib/gcc-lib/ppc-linux/3.3.3);
+*/
+/* Do we need any of these for elf?
+   __DYNAMIC = 0;    */
+SECTIONS
+{
+  /* Read-only sections, merged into text segment: */
+  . = + SIZEOF_HEADERS;
+  .interp        : { *(.interp)		}
+  .hash          : { *(.hash)		}
+  .dynsym        : { *(.dynsym)		}
+  .dynstr        : { *(.dynstr)		}
+  .rel.text      : { *(.rel.text)	}
+  .rela.text     : { *(.rela.text) 	}
+  .rel.data      : { *(.rel.data)	}
+  .rela.data     : { *(.rela.data) 	}
+  .rel.rodata    : { *(.rel.rodata) 	}
+  .rela.rodata   : { *(.rela.rodata) 	}
+  .rel.got       : { *(.rel.got)	}
+  .rela.got      : { *(.rela.got)	}
+  .rel.ctors     : { *(.rel.ctors)	}
+  .rela.ctors    : { *(.rela.ctors)	}
+  .rel.dtors     : { *(.rel.dtors)	}
+  .rela.dtors    : { *(.rela.dtors)	}
+  .rel.bss       : { *(.rel.bss)	}
+  .rela.bss      : { *(.rela.bss)	}
+  .rel.plt       : { *(.rel.plt)	}
+  .rela.plt      : { *(.rela.plt)	}
+  .init          : { *(.init)		}
+  .plt           : { *(.plt) 		}
+  .text      :
+  {
+    cpu/mpc824x/start.o		(.text)
+    lib_ppc/board.o		(.text)
+    lib_ppc/ppcstring.o		(.text)
+    lib_generic/vsprintf.o	(.text)
+    lib_generic/crc32.o		(.text)
+    lib_generic/zlib.o		(.text)
+
+    . = DEFINED(env_offset) ? env_offset : .;
+    common/environment.o	(.text)
+
+    *(.text)
+
+    *(.fixup)
+    *(.got1)
+    . = ALIGN(16);
+    *(.rodata)
+    *(.rodata1)
+    *(.rodata.str1.4)
+    *(.eh_frame)
+  }
+  .fini      : { *(.fini)    } =0
+  .ctors     : { *(.ctors)   }
+  .dtors     : { *(.dtors)   }
+
+  /* Read-write section, merged into data segment: */
+  . = (. + 0x0FFF) & 0xFFFFF000;
+  _erotext = .;
+  PROVIDE (erotext = .);
+  .reloc   :
+  {
+    *(.got)
+    _GOT2_TABLE_ = .;
+    *(.got2)
+    _FIXUP_TABLE_ = .;
+    *(.fixup)
+  }
+  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
+  __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
+
+  .data    :
+  {
+    *(.data)
+    *(.data1)
+    *(.sdata)
+    *(.sdata2)
+    *(.dynamic)
+    CONSTRUCTORS
+  }
+  _edata  =  .;
+  PROVIDE (edata = .);
+
+  . = .;
+  __u_boot_cmd_start = .;
+  .u_boot_cmd : { *(.u_boot_cmd) }
+  __u_boot_cmd_end = .;
+
+
+  . = .;
+  __start___ex_table = .;
+  __ex_table : { *(__ex_table) }
+  __stop___ex_table = .;
+
+  . = ALIGN(4096);
+  __init_begin = .;
+  .text.init : { *(.text.init) }
+  .data.init : { *(.data.init) }
+  . = ALIGN(4096);
+  __init_end = .;
+
+  __bss_start = .;
+  .bss       :
+  {
+   *(.sbss) *(.scommon)
+   *(.dynbss)
+   *(.bss)
+   *(COMMON)
+  }
+
+  _end = . ;
+  PROVIDE (end = .);
+}
diff -urN u-boot-86xx/common/cmd_bootm.c u-boot-86xx-kuro_clean/common/cmd_bootm.c
--- u-boot-86xx/common/cmd_bootm.c	2006-10-13 00:27:16.000000000 +0200
+++ u-boot-86xx-kuro_clean/common/cmd_bootm.c	2006-11-06 22:05:38.000000000 +0100
@@ -193,6 +193,12 @@
 			verify = 0;
 		} else
 #endif	/* __I386__ */
+#ifdef CONFIG_LINKSTATION
+		extern boot_os_Fcn do_boot_lskernel;
+		do_boot_lskernel(cmdtp, flag, argc, argv,
+				addr, NULL, verify);
+		return 1; /* Only returns on error */
+#endif
 	    {
 		puts ("Bad Magic Number\n");
 		SHOW_BOOT_PROGRESS (-1);
diff -urN u-boot-86xx/common/cmd_ext2.c u-boot-86xx-kuro_clean/common/cmd_ext2.c
--- u-boot-86xx/common/cmd_ext2.c	2006-10-13 00:27:16.000000000 +0200
+++ u-boot-86xx-kuro_clean/common/cmd_ext2.c	2006-11-06 22:05:38.000000000 +0100
@@ -283,7 +283,8 @@
 	sprintf(buf, "%lX", filelen);
 	setenv("filesize", buf);
 
-	return(filelen);
+//	return(filelen);
+	return(0);
 }
 
 U_BOOT_CMD(
diff -urN u-boot-86xx/common/console.c u-boot-86xx-kuro_clean/common/console.c
--- u-boot-86xx/common/console.c	2006-10-13 00:27:16.000000000 +0200
+++ u-boot-86xx-kuro_clean/common/console.c	2006-11-06 22:05:38.000000000 +0100
@@ -48,7 +48,7 @@
 
 #endif /* CFG_CONSOLE_IS_IN_ENV */
 
-static int console_setfile (int file, device_t * dev)
+int console_setfile (int file, device_t * dev)
 {
 	int error = 0;
 
@@ -444,22 +444,27 @@
 	gd->flags |= GD_FLG_DEVINIT;	/* device initialization completed */
 
 #ifndef CFG_CONSOLE_INFO_QUIET
+	if (strcmp(stdio_devices[stdout]->name, "serial")) {
+		extern char version_string[];
+		printf ("\n%s\n", version_string);
+	}
+
 	/* Print information */
-	puts ("In:    ");
+	puts ("stdin :   ");
 	if (stdio_devices[stdin] == NULL) {
 		puts ("No input devices available!\n");
 	} else {
 		printf ("%s\n", stdio_devices[stdin]->name);
 	}
 
-	puts ("Out:   ");
+	puts ("stdout:   ");
 	if (stdio_devices[stdout] == NULL) {
 		puts ("No output devices available!\n");
 	} else {
 		printf ("%s\n", stdio_devices[stdout]->name);
 	}
 
-	puts ("Err:   ");
+	puts ("stderr:   ");
 	if (stdio_devices[stderr] == NULL) {
 		puts ("No error devices available!\n");
 	} else {
diff -urN u-boot-86xx/common/main.c u-boot-86xx-kuro_clean/common/main.c
--- u-boot-86xx/common/main.c	2006-10-13 00:27:16.000000000 +0200
+++ u-boot-86xx-kuro_clean/common/main.c	2006-11-06 22:05:38.000000000 +0100
@@ -84,6 +84,11 @@
 extern void mdm_init(void); /* defined in board.c */
 #endif
 
+#ifdef CONFIG_LINKSTATION
+extern int avr_input(void);
+extern void avr_StopBoot(void);
+#endif
+
 /***************************************************************************
  * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
  * returns: 0 -  no key string, allow autoboot
@@ -162,7 +167,14 @@
 	/* In order to keep up with incoming data, check timeout only
 	 * when catch up.
 	 */
+	uint64_t onesec = endtick(1);
+	int bootremain = bootdelay;
 	while (!abort && get_ticks() <= etime) {
+		if (get_ticks() >= onesec) {
+			onesec = endtick(1);
+			putc('\r');
+			printf (CONFIG_AUTOBOOT_PROMPT, --bootremain);
+		}
 		for (i = 0; i < sizeof(delaykey) / sizeof(delaykey[0]); i ++) {
 			if (delaykey[i].len > 0 &&
 			    presskey_len >= delaykey[i].len &&
@@ -183,6 +195,20 @@
 			}
 		}
 
+#ifdef CONFIG_LINKSTATION
+		int avr_action = avr_input();
+		if (avr_action == -3)
+			/* Abort boot */
+			abort = 1;
+		else if (avr_action == -2) {
+			/* Restart boot */
+			putc('\r');
+			printf (CONFIG_AUTOBOOT_PROMPT, bootdelay);
+			etime = endtick(bootdelay);
+			onesec = endtick(1);
+			bootremain = bootdelay;
+		}
+#endif
 		if (tstc()) {
 			if (presskey_len < presskey_max) {
 				presskey [presskey_len ++] = getc();
@@ -195,6 +221,7 @@
 			}
 		}
 	}
+	putc('\n');
 #  if DEBUG_BOOTKEYS
 	if (!abort)
 		puts ("key timeout\n");
@@ -411,6 +438,10 @@
 		int prev = disable_ctrlc(1);	/* disable Control C checking */
 # endif
 
+#ifdef CONFIG_LINKSTATION
+		s = getenv("bootcmd");	/* bootcmd can change (see avr.c) */
+#endif
+
 # ifndef CFG_HUSH_PARSER
 		run_command (s, 0);
 # else
@@ -445,6 +476,10 @@
 	}
 #endif
 
+#ifdef CONFIG_LINKSTATION
+		avr_StopBoot();
+#endif
+
 	/*
 	 * Main Loop for Monitor Command Processing
 	 */
@@ -469,6 +504,10 @@
 			strcpy (lastcommand, console_buffer);
 		else if (len == 0)
 			flag |= CMD_FLAG_REPEAT;
+#ifdef CONFIG_LINKSTATION
+		else if (len == -2)
+			return;
+#endif
 #ifdef CONFIG_BOOT_RETRY_TIME
 		else if (len == -2) {
 			/* -2 means timed out, retry autoboot
@@ -978,6 +1017,15 @@
 			show_activity(0);
 		}
 #endif
+#ifdef CONFIG_LINKSTATION
+		while (!tstc()) {
+			int avr_ret = avr_input();
+			if (avr_ret == -2)
+				return (-2);
+			else if (avr_ret > 0)
+				return avr_ret;
+		}
+#endif
 		c = getc();
 
 		/*
diff -urN u-boot-86xx/cpu/mpc824x/cpu.c u-boot-86xx-kuro_clean/cpu/mpc824x/cpu.c
--- u-boot-86xx/cpu/mpc824x/cpu.c	2006-10-13 00:27:17.000000000 +0200
+++ u-boot-86xx-kuro_clean/cpu/mpc824x/cpu.c	2006-11-06 22:05:38.000000000 +0100
@@ -92,6 +92,7 @@
 
 /*------------------------------------------------------------------- */
 
+#ifndef CONFIG_LINKSTATION
 int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	ulong msr, addr;
@@ -125,6 +126,7 @@
 	return 1;
 
 }
+#endif
 
 /* ------------------------------------------------------------------------- */
 
diff -urN u-boot-86xx/cpu/mpc824x/start.S u-boot-86xx-kuro_clean/cpu/mpc824x/start.S
--- u-boot-86xx/cpu/mpc824x/start.S	2006-10-13 00:27:17.000000000 +0200
+++ u-boot-86xx-kuro_clean/cpu/mpc824x/start.S	2006-11-06 22:05:38.000000000 +0100
@@ -130,7 +130,7 @@
 
 
 in_flash:
-#if defined(CONFIG_BMW)
+#if defined(CONFIG_BMW) || defined(CONFIG_LINKSTATION)
 	bl early_init_f /* Must be ASM: no stack yet! */
 #endif
 	/*
@@ -155,6 +155,7 @@
 	mtspr	HID0, r2
 	sync
 
+#if !defined(CONFIG_LINKSTATION)
 	/* Allocate Initial RAM in data cache.
 	 */
 	lis	r3, CFG_INIT_RAM_ADDR@h
@@ -175,6 +176,7 @@
 	ori	r3, r3, 0x0080
 	sync
 	mtspr	1011, r3
+#endif /* !CONFIG_LINKSTATION */
 #endif /* !CONFIG_BMW */
 	/*
 	 * Thisk the stack pointer *somewhere* sensible. Doesnt
@@ -195,7 +197,9 @@
 	GET_GOT			/* initialize GOT access			*/
 
 	/* r3: IMMR */
+#if !defined(CONFIG_LINKSTATION)
 	bl	cpu_init_f	/* run low-level CPU init code     (from Flash)	*/
+#endif
 
 	mr	r3, r21
 	/* r3: BOOTFLAG */
@@ -475,7 +479,7 @@
 	mr	r10, r5		/* Save copy of Destination Address	*/
 
 	mr	r3,  r5				/* Destination Address	*/
-#ifdef CFG_RAMBOOT
+#if defined(CFG_RAMBOOT) && !defined(CONFIG_LINKSTATION)
 	lis	r4, CFG_SDRAM_BASE@h		/* Source      Address	*/
 	ori	r4, r4, CFG_SDRAM_BASE@l
 #else
@@ -689,6 +693,14 @@
 	cmplw	0, r7, r8
 	blt	4b
 
+	mfmsr	r7			/* Exception prefix 0x000 */
+	li	r8,0
+	ori	r8,r8,MSR_IP
+	andc	r7,r7,r8
+	SYNC
+	mtmsr	r7
+	SYNC
+
 	mtlr	r4			/* restore link register	*/
 	blr
 
diff -urN u-boot-86xx/drivers/dc2114x.c u-boot-86xx-kuro_clean/drivers/dc2114x.c
--- u-boot-86xx/drivers/dc2114x.c	2006-10-13 00:27:17.000000000 +0200
+++ u-boot-86xx-kuro_clean/drivers/dc2114x.c	2006-11-06 22:05:38.000000000 +0100
@@ -27,14 +27,20 @@
 #include <net.h>
 #include <pci.h>
 
+#if 0
+#define DEBUG_TRACE
+#define DEBUG_TULIP
+#endif
+
 #undef DEBUG_SROM
 #undef DEBUG_SROM2
 
 #undef UPDATE_SROM
 
-/* PCI Registers.
+/*
+ *  PCI Registers.
  */
-#define PCI_CFDA_PSM		0x43
+#define PCI_CFDA_PSM	0x43
 
 #define CFRV_RN		0x000000f0	/* Revision Number */
 
@@ -43,10 +49,12 @@
 
 #define DC2114x_BRK	0x0020		/* CFRV break between DC21142 & DC21143 */
 
-/* Ethernet chip registers.
+/*
+ * Ethernet chip registers.
  */
 #define DE4X5_BMR	0x000		/* Bus Mode Register */
 #define DE4X5_TPD	0x008		/* Transmit Poll Demand Reg */
+#define DE4X5_RPD	0x010		/* Receive Poll Demand Reg */
 #define DE4X5_RRBA	0x018		/* RX Ring Base Address Reg */
 #define DE4X5_TRBA	0x020		/* TX Ring Base Address Reg */
 #define DE4X5_STS	0x028		/* Status Register */
@@ -54,7 +62,8 @@
 #define DE4X5_SICR	0x068		/* SIA Connectivity Register */
 #define DE4X5_APROM	0x048		/* Ethernet Address PROM */
 
-/* Register bits.
+/*
+ * Register bits.
  */
 #define BMR_SWR		0x00000001	/* Software Reset */
 #define STS_TS		0x00700000	/* Transmit Process State */
@@ -64,8 +73,10 @@
 #define OMR_PS		0x00040000	/* Port Select */
 #define OMR_SDP		0x02000000	/* SD Polarity - MUST BE ASSERTED */
 #define OMR_PM		0x00000080	/* Pass All Multicast */
+#define OMR_PMS		0x00000040	/* Promiscuous */
 
-/* Descriptor bits.
+/*
+ * Descriptor bits.
  */
 #define R_OWN		0x80000000	/* Own Bit */
 #define RD_RER		0x02000000	/* Receive End Of Ring */
@@ -85,10 +96,10 @@
 
 #define SROM_HWADD	    0x0014	/* Hardware Address offset in SROM */
 #define SROM_RD		0x00004000	/* Read from Boot ROM */
-#define EE_DATA_WRITE	      0x04	/* EEPROM chip data in. */
+#define EE_DATA_WRITE     0x04	/* EEPROM chip data in. */
 #define EE_WRITE_0	    0x4801
 #define EE_WRITE_1	    0x4805
-#define EE_DATA_READ	      0x08	/* EEPROM chip data out. */
+#define EE_DATA_READ	  0x08	/* EEPROM chip data out. */
 #define SROM_SR		0x00000800	/* Select Serial ROM when set */
 
 #define DT_IN		0x00000004	/* Serial Data In */
@@ -97,6 +108,36 @@
 
 #define POLL_DEMAND	1
 
+#ifndef PCI_VENDOR_ID_ADMTEK
+#  define PCI_VENDOR_ID_ADMTEK 0x1317
+#endif
+#ifndef PCI_DEVICE_ID_ADMTEK_AN983B
+#  define PCI_DEVICE_ID_ADMTEK_AN983B 0x985
+#endif
+
+/* The chip types have been taken from linux-2.4.31
+ * drivers/net/tulip/tulip.h
+ * Only COMET is used for now
+ */
+enum chips {
+	DC21040 = 0,
+	DC21041 = 1,
+	DC21140 = 2,
+	DC21142 = 3, DC21143 = 3,
+	LC82C168,
+	MX98713,
+	MX98715,
+	MX98725,
+	AX88140,
+	PNIC2,
+	COMET,
+	COMPEX9881,
+	I21145,
+	DM910X,
+	CONEXANT,
+};
+static int chip_idx = DC21143;
+
 #ifdef CONFIG_TULIP_FIX_DAVICOM
 #define RESET_DM9102(dev) {\
     unsigned long i;\
@@ -108,58 +149,63 @@
 #else
 #define RESET_DE4X5(dev) {\
     int i;\
-    i=INL(dev, DE4X5_BMR);\
-    udelay(1000);\
+    i=0x01A04000;\
     OUTL(dev, i | BMR_SWR, DE4X5_BMR);\
     udelay(1000);\
     OUTL(dev, i, DE4X5_BMR);\
     udelay(1000);\
-    for (i=0;i<5;i++) {INL(dev, DE4X5_BMR); udelay(10000);}\
-    udelay(1000);\
 }
 #endif
 
 #define START_DE4X5(dev) {\
-    s32 omr; \
+    u32 omr; \
     omr = INL(dev, DE4X5_OMR);\
     omr |= OMR_ST | OMR_SR;\
     OUTL(dev, omr, DE4X5_OMR);		/* Enable the TX and/or RX */\
 }
 
 #define STOP_DE4X5(dev) {\
-    s32 omr; \
+    u32 omr; \
     omr = INL(dev, DE4X5_OMR);\
     omr &= ~(OMR_ST|OMR_SR);\
     OUTL(dev, omr, DE4X5_OMR);		/* Disable the TX and/or RX */ \
 }
 
-#define NUM_RX_DESC PKTBUFSRX
+#define NUM_RX_DESC		4
 #ifndef CONFIG_TULIP_FIX_DAVICOM
-	#define NUM_TX_DESC 1			/* Number of TX descriptors   */
+	#define NUM_TX_DESC	2			/* Number of TX descriptors   */
 #else
 	#define NUM_TX_DESC 4
 #endif
-#define RX_BUFF_SZ  PKTSIZE_ALIGN
+#define BUFLEN  1536
 
 #define TOUT_LOOP   1000000
 
 #define SETUP_FRAME_LEN 192
 #define ETH_ALEN	6
+#define ETH_ZLEN	60
 
 struct de4x5_desc {
-	volatile s32 status;
+	volatile u32 status;
 	u32 des1;
 	u32 buf;
 	u32 next;
 };
 
-static struct de4x5_desc rx_ring[NUM_RX_DESC] __attribute__ ((aligned(32))); /* RX descriptor ring         */
-static struct de4x5_desc tx_ring[NUM_TX_DESC] __attribute__ ((aligned(32))); /* TX descriptor ring         */
-static int rx_new;                             /* RX descriptor ring pointer */
-static int tx_new;                             /* TX descriptor ring pointer */
+/* Note: transmit and receive buffers must be longword aligned and
+   longword divisable */
 
-static char rxRingSize;
-static char txRingSize;
+/* TX descriptor ring */
+static struct de4x5_desc tx_ring[NUM_TX_DESC] __attribute__ ((aligned(4)));
+/* TX buffer */
+static unsigned char txb[BUFLEN] __attribute__ ((aligned(32)));
+
+/* RX descriptor ring */
+static struct de4x5_desc rx_ring[NUM_RX_DESC] __attribute__ ((aligned(4)));
+/* RX buffers */
+static unsigned char rxb[NUM_RX_DESC * BUFLEN] __attribute__ ((aligned(32)));
+
+static int rx_new;		/* RX descriptor ring pointer */
 
 #if defined(UPDATE_SROM) || !defined(CONFIG_TULIP_FIX_DAVICOM)
 static void  sendto_srom(struct eth_device* dev, u_int command, u_long addr);
@@ -204,6 +250,7 @@
 static struct pci_device_id supported[] = {
 	{ PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_TULIP_FAST },
 	{ PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142 },
+	{ PCI_VENDOR_ID_ADMTEK, PCI_DEVICE_ID_ADMTEK_AN983B },
 #ifdef CONFIG_TULIP_FIX_DAVICOM
 	{ PCI_VENDOR_ID_DAVICOM, PCI_DEVICE_ID_DAVICOM_DM9102A },
 #endif
@@ -214,29 +261,44 @@
 {
 	int             	idx=0;
 	int             	card_number = 0;
-	unsigned int           	cfrv;
+	unsigned int        cfrv;
 	unsigned char   	timer;
-	pci_dev_t		devbusfn;
+	pci_dev_t			devbusfn;
 	unsigned int		iobase;
 	unsigned short		status;
 	struct eth_device* 	dev;
+	u16					vendor;
+	u16					device;
 
+#ifdef DEBUG_TULIP
+	printf("%s\n", __FUNCTION__);
+#endif
 	while(1) {
 		devbusfn =  pci_find_devices(supported, idx++);
 		if (devbusfn == -1) {
 			break;
 		}
+		pci_read_config_word(devbusfn, PCI_VENDOR_ID, &vendor);
+		pci_read_config_word(devbusfn, PCI_DEVICE_ID, &device);
 
-		/* Get the chip configuration revision register. */
-		pci_read_config_dword(devbusfn, PCI_REVISION_ID, &cfrv);
+		debug("dc21x4x: devbusfn: %08lX, VID: %08lX, DID: %08lX\n",
+			devbusfn, vendor, device);
+
+		if (vendor == PCI_VENDOR_ID_ADMTEK && \
+		    device == PCI_DEVICE_ID_ADMTEK_AN983B) {
+			chip_idx = COMET;
+		} else {
+			/* Get the chip configuration revision register. */
+			pci_read_config_dword(devbusfn, PCI_REVISION_ID, &cfrv);
 
 #ifndef CONFIG_TULIP_FIX_DAVICOM
-		if ((cfrv & CFRV_RN) < DC2114x_BRK ) {
-			printf("Error: The chip is not DC21143.\n");
-			continue;
-		}
+			if ((cfrv & CFRV_RN) < DC2114x_BRK ) {
+				printf("Error: The chip is not DC21143.\n");
+				idx++;
+				continue;
+			}
 #endif
-
+		}
 		pci_read_config_word(devbusfn, PCI_COMMAND, &status);
 		status |=
 #ifdef CONFIG_TULIP_USE_IO
@@ -286,7 +348,10 @@
 #ifdef CONFIG_TULIP_FIX_DAVICOM
 		sprintf(dev->name, "Davicom#%d", card_number);
 #else
-		sprintf(dev->name, "dc21x4x#%d", card_number);
+		if (chip_idx == COMET)
+			sprintf(dev->name, "COMET#%d", card_number);
+		else
+			sprintf(dev->name, "dc21x4x#%d", card_number);
 #endif
 
 #ifdef CONFIG_TULIP_USE_IO
@@ -303,8 +368,6 @@
 		/* Ensure we're not sleeping. */
 		pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);
 
-		udelay(10 * 1000);
-
 #ifndef CONFIG_TULIP_FIX_DAVICOM
 		read_hw_addr(dev, bis);
 #endif
@@ -321,8 +384,9 @@
 	int		i;
 	int		devbusfn = (int) dev->priv;
 
-	/* Ensure we're not sleeping. */
-	pci_write_config_byte(devbusfn, PCI_CFDA_PSM, WAKEUP);
+#if defined(DEBUG_TULIP) || defined(DEBUG_TRACE)
+	serial_printf("%0lu %s\n", get_timer(0), __FUNCTION__);
+#endif
 
 #ifdef CONFIG_TULIP_FIX_DAVICOM
 	RESET_DM9102(dev);
@@ -330,57 +394,71 @@
 	RESET_DE4X5(dev);
 #endif
 
-	if ((INL(dev, DE4X5_STS) & (STS_TS | STS_RS)) != 0) {
-		printf("Error: Cannot reset ethernet controller.\n");
-		return 0;
-	}
-
 #ifdef CONFIG_TULIP_SELECT_MEDIA
 	dc21x4x_select_media(dev);
 #else
-	OUTL(dev, OMR_SDP | OMR_PS | OMR_PM, DE4X5_OMR);
+	if (chip_idx == COMET) {
+		/* No multicast */
+		OUTL(dev, 0, 0xAC);
+		OUTL(dev, 0, 0xB0);
+	} else {
+		OUTL(dev, OMR_SDP | OMR_PS | OMR_PM, DE4X5_OMR);
+	}
 #endif
 
 	for (i = 0; i < NUM_RX_DESC; i++) {
 		rx_ring[i].status = cpu_to_le32(R_OWN);
-		rx_ring[i].des1 = cpu_to_le32(RX_BUFF_SZ);
-		rx_ring[i].buf = cpu_to_le32(phys_to_bus((u32) NetRxPackets[i]));
-#ifdef CONFIG_TULIP_FIX_DAVICOM
-		rx_ring[i].next = cpu_to_le32(phys_to_bus((u32) &rx_ring[(i+1) % NUM_RX_DESC]));
-#else
-		rx_ring[i].next = 0;
-#endif
+		rx_ring[i].des1 = cpu_to_le32(BUFLEN);
+		rx_ring[i].buf = cpu_to_le32(phys_to_bus((u32)&rxb[i * BUFLEN]));
+		rx_ring[i].next = cpu_to_le32(phys_to_bus((u32)&rx_ring[i+1]));
 	}
+	/* Write the end of list marker to the descriptor lists. */
+	rx_ring[NUM_RX_DESC - 1].des1 |= cpu_to_le32(RD_RER);
+	rx_ring[NUM_RX_DESC - 1].next = cpu_to_le32(phys_to_bus((u32)&rx_ring[0]));
 
-	for (i=0; i < NUM_TX_DESC; i++) {
-		tx_ring[i].status = 0;
-		tx_ring[i].des1 = 0;
-		tx_ring[i].buf = 0;
+	/* Point to the first descriptor */
+	rx_new = 0;
 
-#ifdef CONFIG_TULIP_FIX_DAVICOM
-	tx_ring[i].next = cpu_to_le32(phys_to_bus((u32) &tx_ring[(i+1) % NUM_TX_DESC]));
-#else
-		tx_ring[i].next = 0;
-#endif
-	}
+	/* We only use 1 transmit buffer, but we use 2 descriptors so
+	   transmit engines have somewhere to point to if they feel the need */
 
-	rxRingSize = NUM_RX_DESC;
-	txRingSize = NUM_TX_DESC;
+	tx_ring[0].status = 0;
+	tx_ring[0].des1 = 0;
+	tx_ring[0].buf = cpu_to_le32(phys_to_bus((u32)&txb[0]));
+	tx_ring[0].next = cpu_to_le32(phys_to_bus((u32)&tx_ring[1]));
+
+	/* this descriptor should never get used, since it will never be owned
+	   by the machine (status will always == 0) */
+
+	tx_ring[1].status = 0;
+	tx_ring[1].des1 = 0;
+	tx_ring[1].buf = cpu_to_le32(phys_to_bus((u32)&txb[0]));
+	tx_ring[1].next = cpu_to_le32(phys_to_bus((u32)&tx_ring[0]));
 
 	/* Write the end of list marker to the descriptor lists. */
-	rx_ring[rxRingSize - 1].des1 |= cpu_to_le32(RD_RER);
-	tx_ring[txRingSize - 1].des1 |= cpu_to_le32(TD_TER);
+	tx_ring[1].des1 |= cpu_to_le32(TD_TER);
 
 	/* Tell the adapter where the TX/RX rings are located. */
-	OUTL(dev, phys_to_bus((u32) &rx_ring), DE4X5_RRBA);
-	OUTL(dev, phys_to_bus((u32) &tx_ring), DE4X5_TRBA);
+	OUTL(dev, phys_to_bus((u32) &rx_ring[0]), DE4X5_RRBA);
+	OUTL(dev, phys_to_bus((u32) &tx_ring[0]), DE4X5_TRBA);
+
+	if (chip_idx == COMET) {
+		/* Bit 18 (0x00040000) is reserved in the AN983B */
+		/* datasheet, but it is used by the tulip driver */
+		OUTL(dev, (INL(dev, (DE4X5_OMR)) & ~(OMR_PMS | OMR_PM)) | OMR_PS, DE4X5_OMR);
+		/* Enable automatic Tx underrun recovery */
+		OUTL(dev, INL(dev, 0x88) | 1, 0x88);
+//		OUTL(dev, INL(dev, 0x88) | 0x19, 0x88);
+	}
 
 	START_DE4X5(dev);
 
-	tx_new = 0;
-	rx_new = 0;
+	/* Start receiving */
+	OUTL(dev, POLL_DEMAND, DE4X5_RPD);
 
-	send_setup_frame(dev, bis);
+	if (chip_idx != COMET) {	/* No setup frame needed by COMET */
+		send_setup_frame(dev, bis);
+	}
 
 	return 1;
 }
@@ -389,90 +467,117 @@
 {
 	int		status = -1;
 	int		i;
+	u32		len = length;
 
 	if (length <= 0) {
 		printf("%s: bad packet size: %d\n", dev->name, length);
 		goto Done;
 	}
 
-	for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+	for(i = 0; tx_ring[0].status & cpu_to_le32(T_OWN); i++) {
 		if (i >= TOUT_LOOP) {
-			printf("%s: tx error buffer not ready\n", dev->name);
+			printf(".%s: Tx not ready\n", dev->name);
 			goto Done;
 		}
 	}
 
-	tx_ring[tx_new].buf    = cpu_to_le32(phys_to_bus((u32) packet));
-	tx_ring[tx_new].des1   = cpu_to_le32(TD_TER | TD_LS | TD_FS | length);
-	tx_ring[tx_new].status = cpu_to_le32(T_OWN);
+	/* Disable the TX */
+	OUTL(dev, INL(dev, DE4X5_OMR) & ~OMR_ST, DE4X5_OMR);
+
+	memcpy(txb, (char*)packet, length);
+
+	/* setup the transmit descriptor */
+	tx_ring[0].des1 = cpu_to_le32(TD_LS | TD_FS | length);
+	tx_ring[0].status = cpu_to_le32(T_OWN);
 
+	/* Point to transmit descriptor */
+	OUTL(dev, phys_to_bus((u32) &tx_ring[0]), DE4X5_TRBA);
+
+	/* Enable the TX */
+	OUTL(dev, INL(dev, DE4X5_OMR) | OMR_ST, DE4X5_OMR);
+
+	/* Immediate transmit demand */
 	OUTL(dev, POLL_DEMAND, DE4X5_TPD);
 
-	for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+	for(i = 0; tx_ring[0].status & cpu_to_le32(T_OWN); i++) {
 		if (i >= TOUT_LOOP) {
-			printf(".%s: tx buffer not ready\n", dev->name);
+			printf(".%s: Tx Timeout\n", dev->name);
 			goto Done;
 		}
 	}
 
-	if (le32_to_cpu(tx_ring[tx_new].status) & TD_ES) {
-#if 0 /* test-only */
+#ifdef DEBUG_TRACE
+	serial_printf("%0lu Tx L2: %d P: %04X IP: %08X\n",
+					get_timer(0), i, *((u16 *)(packet+0xC)),
+					*((u32 *)(packet+0x1E)));
+#endif
+
+	if (le32_to_cpu(tx_ring[0].status) & TD_ES) {
+#if 1 /* test-only */
 		printf("TX error status = 0x%08X\n",
-			le32_to_cpu(tx_ring[tx_new].status));
+			le32_to_cpu(tx_ring[0].status));
 #endif
-		tx_ring[tx_new].status = 0x0;
+		tx_ring[0].status = 0x0;
 		goto Done;
 	}
 
 	status = length;
 
  Done:
-    tx_new = (tx_new+1) % NUM_TX_DESC;
 	return status;
 }
 
 static int dc21x4x_recv(struct eth_device* dev)
 {
-	s32		status;
+	u32		status;
+	int		rx_prv;
 	int		length    = 0;
 
-	for ( ; ; ) {
-		status = (s32)le32_to_cpu(rx_ring[rx_new].status);
+#ifdef DEBUG_TULIP
+	u32 csr5 = INL(dev, DE4X5_STS);
+	if ((csr5 & STS_RS) != 0x00060000) {
+		OUTL(dev, 0x0001ffff, DE4X5_STS);
+		printf("Receive status: 0x%08X\n", csr5);
+	}
+#endif
 
-		if (status & R_OWN) {
-			break;
-		}
+	status = (u32)le32_to_cpu(rx_ring[rx_new].status);
+	if (status & R_OWN)
+		return 0;
 
-		if (status & RD_LS) {
-			/* Valid frame status.
-			 */
-			if (status & RD_ES) {
-
-				/* There was an error.
-				 */
-				printf("RX error status = 0x%08X\n", status);
-			} else {
-				/* A valid frame received.
-				 */
-				length = (le32_to_cpu(rx_ring[rx_new].status) >> 16);
-
-				/* Pass the packet up to the protocol
-				 * layers.
-				 */
-				NetReceive(NetRxPackets[rx_new], length - 4);
-			}
+#ifdef DEBUG_TULIP
+	printf("recv status: 0x%08X\n", status);
+#endif
 
-			/* Change buffer ownership for this frame, back
-			 * to the adapter.
-			 */
+	if (status & RD_LS) {
+#ifdef DEBUG_TRACE
+		serial_printf("rx: %d status: %08X\n", rx_new, status);
+#endif
+		/* Valid frame status */
+		if (status & RD_ES) {
+			/* There was an error */
+			printf("RX error status = 0x%08X\n", status);
 			rx_ring[rx_new].status = cpu_to_le32(R_OWN);
-		}
+		} else {
+			/* Received valid frame */
+			length = (int)(le32_to_cpu(rx_ring[rx_new].status) >> 16);
+
+			/* Pass the packet up to the protocol layers. */
+			unsigned char rxdata[BUFLEN];
+			memcpy(rxdata, rxb + rx_new * BUFLEN, length - 4);
 
-		/* Update entry information.
-		 */
-		rx_new = (rx_new + 1) % rxRingSize;
+			/* Give buffer ownership for this
+			 * frame back to the adapter */
+			rx_ring[rx_new].status = cpu_to_le32(R_OWN);
+
+			/* Pass the received packet to the upper layer */
+			NetReceive(rxdata, length - 4);
+		}
 	}
 
+	/* Update current descriptor index */
+	rx_new = (rx_new + 1) % NUM_RX_DESC;
+
 	return length;
 }
 
@@ -480,10 +585,12 @@
 {
 	int		devbusfn = (int) dev->priv;
 
+#ifdef DEBUG_TULIP
+	printf("%s\n", __FUNCTION__);
+#endif
 	STOP_DE4X5(dev);
 	OUTL(dev, 0, DE4X5_SICR);
 
-	pci_write_config_byte(devbusfn, PCI_CFDA_PSM, SLEEP);
 }
 
 static void send_setup_frame(struct eth_device* dev, bd_t *bis)
@@ -501,30 +608,29 @@
 		}
 	}
 
-	for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+	for(i = 0; tx_ring[0].status & cpu_to_le32(T_OWN); i++) {
 		if (i >= TOUT_LOOP) {
 			printf("%s: tx error buffer not ready\n", dev->name);
 			goto Done;
 		}
 	}
 
-	tx_ring[tx_new].buf = cpu_to_le32(phys_to_bus((u32) &setup_frame[0]));
-	tx_ring[tx_new].des1 = cpu_to_le32(TD_TER | TD_SET| SETUP_FRAME_LEN);
-	tx_ring[tx_new].status = cpu_to_le32(T_OWN);
+	tx_ring[0].buf = cpu_to_le32(phys_to_bus((u32) &setup_frame[0]));
+	tx_ring[0].des1 = cpu_to_le32(TD_TER | TD_SET| SETUP_FRAME_LEN);
+	tx_ring[0].status = cpu_to_le32(T_OWN);
 
 	OUTL(dev, POLL_DEMAND, DE4X5_TPD);
 
-	for(i = 0; tx_ring[tx_new].status & cpu_to_le32(T_OWN); i++) {
+	for(i = 0; tx_ring[0].status & cpu_to_le32(T_OWN); i++) {
 		if (i >= TOUT_LOOP) {
 			printf("%s: tx buffer not ready\n", dev->name);
 			goto Done;
 		}
 	}
 
-	if (le32_to_cpu(tx_ring[tx_new].status) != 0x7FFFFFFF) {
-		printf("TX error status2 = 0x%08X\n", le32_to_cpu(tx_ring[tx_new].status));
+	if (le32_to_cpu(tx_ring[0].status) != 0x7FFFFFFF) {
+		printf("TX error status2 = 0x%08X\n", le32_to_cpu(tx_ring[0].status));
 	}
-	tx_new = (tx_new+1) % NUM_TX_DESC;
 
 Done:
 	return;
@@ -543,7 +649,7 @@
 static int
 getfrom_srom(struct eth_device* dev, u_long addr)
 {
-	s32 tmp;
+	u32 tmp;
 
 	tmp = INL(dev, addr);
 	udelay(1);
@@ -708,19 +814,27 @@
 #ifndef CONFIG_TULIP_FIX_DAVICOM
 static void read_hw_addr(struct eth_device *dev, bd_t *bis)
 {
-	u_short tmp, *p = (u_short *)(&dev->enetaddr[0]);
-	int i, j = 0;
-
-	for (i = 0; i < (ETH_ALEN >> 1); i++) {
-		tmp = read_srom(dev, DE4X5_APROM, ((SROM_HWADD >> 1) + i));
-		*p = le16_to_cpu(tmp);
-		j += *p++;
-	}
-
-	if ((j == 0) || (j == 0x2fffd)) {
-		memset (dev->enetaddr, 0, ETH_ALEN);
-		debug ("Warning: can't read HW address from SROM.\n");
-		goto Done;
+	if (chip_idx == COMET) {
+		/* COMET reads the ehernet address directly from the EEPROM */
+		*(u32 *)dev->enetaddr = cpu_to_le32(INL(dev, 0xA4));
+		*(u16 *)(dev->enetaddr+4) = cpu_to_le16(INL(dev, 0xA8));
+		*(u32 *)bis->bi_enetaddr = *(u32 *)dev->enetaddr;
+		*(u16 *)(bis->bi_enetaddr+4) = *(u16 *)(dev->enetaddr+4);
+	} else {
+		u_short tmp, *p = (u_short *)(&dev->enetaddr[0]);
+		int i, j = 0;
+
+		for (i = 0; i < (ETH_ALEN >> 1); i++) {
+			tmp=read_srom(dev, DE4X5_APROM, ((SROM_HWADD >> 1)+i));
+			*p = le16_to_cpu(tmp);
+			j += *p++;
+		}
+
+		if ((j == 0) || (j == 0x2fffd)) {
+			memset (dev->enetaddr, 0, ETH_ALEN);
+			debug ("Warning: can't read HW address from SROM.\n");
+			goto Done;
+		}
 	}
 
 	return;
@@ -769,3 +883,5 @@
 #endif	/* UPDATE_SROM */
 
 #endif	/* CFG_CMD_NET && CONFIG_NET_MULTI && CONFIG_TULIP */
+
+/* vim: set ts=4: */
diff -urN u-boot-86xx/drivers/netconsole.c u-boot-86xx-kuro_clean/drivers/netconsole.c
--- u-boot-86xx/drivers/netconsole.c	2006-10-13 00:27:17.000000000 +0200
+++ u-boot-86xx-kuro_clean/drivers/netconsole.c	2006-11-06 22:05:38.000000000 +0100
@@ -27,6 +27,7 @@
 
 #include <command.h>
 #include <devices.h>
+#include <console.h>
 #include <net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -124,6 +125,26 @@
 		output_packet_len = len;
 		NetLoop (NETCONS);	/* wait for arp reply and send packet */
 		output_packet_len = 0;
+#if defined(CFG_CONSOLE_IS_IN_ENV) || defined(CONFIG_SILENT_CONSOLE)
+		if (NetState == NETLOOP_FAIL) {
+			/* ARP failed, fail back to serial console */
+			device_t *idev;
+			device_t *odev;
+
+			idev = search_device(DEV_FLAGS_INPUT,  "serial");
+			odev = search_device(DEV_FLAGS_OUTPUT, "serial");
+
+			console_setfile (stdin,  idev);
+			console_setfile (stdout, odev);
+			console_setfile (stderr, odev);
+
+#if defined(CONFIG_LINKSTATION)
+			void next_cons_choice(int console);
+			/* Console 0 is the serial console */
+			next_cons_choice(0);
+#endif
+		}
+#endif
 		return;
 	}
 
@@ -236,7 +257,8 @@
 
 	input_recursion = 1;
 
-	net_timeout = 1;
+//	net_timeout = 1;
+	net_timeout = 50;
 	NetLoop (NETCONS);	/* kind of poll */
 
 	input_recursion = 0;
diff -urN u-boot-86xx/drivers/rtl8169.c u-boot-86xx-kuro_clean/drivers/rtl8169.c
--- u-boot-86xx/drivers/rtl8169.c	2006-10-13 00:27:17.000000000 +0200
+++ u-boot-86xx-kuro_clean/drivers/rtl8169.c	2006-11-06 22:05:38.000000000 +0100
@@ -48,7 +48,10 @@
 *
 *    Indent Options: indent -kr -i8
 ***************************************************************************/
-
+/*
+ * 26 August 2006 Mihai Georgian <u-boot@linuxnotincluded.org.uk>
+ * Modified to use le32_to_cpu and cpu_to_le32 properly
+ */
 #include <common.h>
 #include <malloc.h>
 #include <net.h>
@@ -68,6 +71,7 @@
 static u32 ioaddr;
 
 /* Condensed operations for readability. */
+#define virt_to_bus(addr)	cpu_to_le32(addr)
 #define virt_to_le32desc(addr)	cpu_to_le32(virt_to_bus(addr))
 #define le32desc_to_virt(addr)	bus_to_virt(le32_to_cpu(addr))
 
@@ -413,23 +417,23 @@
 	ioaddr = dev->iobase;
 
 	cur_rx = tpc->cur_rx;
-	if ((tpc->RxDescArray[cur_rx].status & OWNbit) == 0) {
-		if (!(tpc->RxDescArray[cur_rx].status & RxRES)) {
+	if ((le32_to_cpu(tpc->RxDescArray[cur_rx].status) & OWNbit) == 0) {
+		if (!(le32_to_cpu(tpc->RxDescArray[cur_rx].status) & RxRES)) {
 			unsigned char rxdata[RX_BUF_LEN];
-			length = (int) (tpc->RxDescArray[cur_rx].
-						status & 0x00001FFF) - 4;
+			length = (int) (le32_to_cpu(tpc->RxDescArray[cur_rx].
+						status) & 0x00001FFF) - 4;
 
 			memcpy(rxdata, tpc->RxBufferRing[cur_rx], length);
 			NetReceive(rxdata, length);
 
 			if (cur_rx == NUM_RX_DESC - 1)
 				tpc->RxDescArray[cur_rx].status =
-				    (OWNbit | EORbit) + RX_BUF_SIZE;
+				cpu_to_le32((OWNbit | EORbit) + RX_BUF_SIZE);
 			else
 				tpc->RxDescArray[cur_rx].status =
-				    OWNbit + RX_BUF_SIZE;
+				cpu_to_le32(OWNbit + RX_BUF_SIZE);
 			tpc->RxDescArray[cur_rx].buf_addr =
-			    virt_to_bus(tpc->RxBufferRing[cur_rx]);
+			    cpu_to_le32(tpc->RxBufferRing[cur_rx]);
 		} else {
 			puts("Error Rx");
 		}
@@ -454,6 +458,7 @@
 	u8 *ptxb;
 	int entry = tpc->cur_tx % NUM_TX_DESC;
 	u32 len = length;
+	int ret;
 
 #ifdef DEBUG_RTL8169_TX
 	int stime = currticks();
@@ -465,39 +470,46 @@
 
 	/* point to the current txb incase multiple tx_rings are used */
 	ptxb = tpc->Tx_skbuff[entry * MAX_ETH_FRAME_SIZE];
+#ifdef DEBUG_RTL8169_TX
+	printf("ptxb: %08X, length: %d\n", ptxb, (int)length);
+#endif
 	memcpy(ptxb, (char *)packet, (int)length);
 
 	while (len < ETH_ZLEN)
 		ptxb[len++] = '\0';
 
-	tpc->TxDescArray[entry].buf_addr = virt_to_bus(ptxb);
+	tpc->TxDescArray[entry].buf_addr = cpu_to_le32(ptxb);
 	if (entry != (NUM_TX_DESC - 1)) {
 		tpc->TxDescArray[entry].status =
-		    (OWNbit | FSbit | LSbit) | ((len > ETH_ZLEN) ?
-						len : ETH_ZLEN);
+		    cpu_to_le32((OWNbit | FSbit | LSbit) |
+				((len > ETH_ZLEN) ? len : ETH_ZLEN));
 	} else {
 		tpc->TxDescArray[entry].status =
-		    (OWNbit | EORbit | FSbit | LSbit) |
-		    ((len > ETH_ZLEN) ? length : ETH_ZLEN);
+		    cpu_to_le32((OWNbit | EORbit | FSbit | LSbit) |
+		    		((len > ETH_ZLEN) ? len : ETH_ZLEN));
 	}
 	RTL_W8(TxPoll, 0x40);	/* set polling bit */
 
 	tpc->cur_tx++;
 	to = currticks() + TX_TIMEOUT;
-	while ((tpc->TxDescArray[entry].status & OWNbit) && (currticks() < to));	/* wait */
+	while ((le32_to_cpu(tpc->TxDescArray[entry].status) & OWNbit)
+				&& (currticks() < to));	/* wait */
 
 	if (currticks() >= to) {
 #ifdef DEBUG_RTL8169_TX
 		puts ("tx timeout/error\n");
 		printf ("%s elapsed time : %d\n", __FUNCTION__, currticks()-stime);
 #endif
-		return 0;
+		ret = 0;
 	} else {
 #ifdef DEBUG_RTL8169_TX
 		puts("tx done\n");
 #endif
-		return length;
+		ret = length;
 	}
+	/* Delay to make net console (nc) work properly */
+	udelay(20);
+	return ret;
 }
 
 static void rtl8169_set_rx_mode(struct eth_device *dev)
@@ -603,13 +615,14 @@
 	for (i = 0; i < NUM_RX_DESC; i++) {
 		if (i == (NUM_RX_DESC - 1))
 			tpc->RxDescArray[i].status =
-			    (OWNbit | EORbit) + RX_BUF_SIZE;
+			cpu_to_le32((OWNbit | EORbit) + RX_BUF_SIZE);
 		else
-			tpc->RxDescArray[i].status = OWNbit + RX_BUF_SIZE;
+			tpc->RxDescArray[i].status =
+			cpu_to_le32(OWNbit + RX_BUF_SIZE);
 
 		tpc->RxBufferRing[i] = &rxb[i * RX_BUF_SIZE];
 		tpc->RxDescArray[i].buf_addr =
-		    virt_to_bus(tpc->RxBufferRing[i]);
+		    cpu_to_le32(tpc->RxBufferRing[i]);
 	}
 
 #ifdef DEBUG_RTL8169
@@ -635,17 +648,23 @@
 	if (tpc->TxDescArrays == 0)
 		puts("Allot Error");
 	/* Tx Desscriptor needs 256 bytes alignment; */
-	TxPhyAddr = virt_to_bus(tpc->TxDescArrays);
+	TxPhyAddr = tpc->TxDescArrays;
 	diff = 256 - (TxPhyAddr - ((TxPhyAddr >> 8) << 8));
 	TxPhyAddr += diff;
 	tpc->TxDescArray = (struct TxDesc *) (tpc->TxDescArrays + diff);
+#ifdef DEBUG_RTL8169
+	printf("tpc->TxDescArray: %08X\n", tpc->TxDescArray);
+#endif
 
 	tpc->RxDescArrays = rx_ring;
 	/* Rx Desscriptor needs 256 bytes alignment; */
-	RxPhyAddr = virt_to_bus(tpc->RxDescArrays);
+	RxPhyAddr = tpc->RxDescArrays;
 	diff = 256 - (RxPhyAddr - ((RxPhyAddr >> 8) << 8));
 	RxPhyAddr += diff;
 	tpc->RxDescArray = (struct RxDesc *) (tpc->RxDescArrays + diff);
+#ifdef DEBUG_RTL8169
+	printf("tpc->RxDescArray: %08X\n", tpc->RxDescArray);
+#endif
 
 	if (tpc->TxDescArrays == NULL || tpc->RxDescArrays == NULL) {
 		puts("Allocate RxDescArray or TxDescArray failed\n");
@@ -733,7 +752,7 @@
 
 	/* Get MAC address.  FIXME: read EEPROM */
 	for (i = 0; i < MAC_ADDR_LEN; i++)
-		dev->enetaddr[i] = RTL_R8(MAC0 + i);
+		bis->bi_enetaddr[i] = dev->enetaddr[i] = RTL_R8(MAC0 + i);
 
 #ifdef DEBUG_RTL8169
 	printf("MAC Address");
@@ -805,33 +824,68 @@
 			   PHY_Enable_Auto_Nego | PHY_Restart_Auto_Nego);
 		udelay(100);
 
+#ifdef CONFIG_LINKSTATION
+void miconCntl_FanLow(void);
+void miconCntl_FanHigh(void);
+void miconCntl_Eth1000M(int up);
+void miconCntl_Eth100M(int up);
+void miconCntl_Eth10M(int up);
+void miconCntl_5f(void);
+
+		miconCntl_FanLow();
+#endif
+
 		/* wait for auto-negotiation process */
 		for (i = 10000; i > 0; i--) {
 			/* check if auto-negotiation complete */
 			if (mdio_read(PHY_STAT_REG) & PHY_Auto_Neco_Comp) {
 				udelay(100);
 				option = RTL_R8(PHYstatus);
+#if defined(CONFIG_LINKSTATION) && defined(CONFIG_HTGL)
 				if (option & _1000bpsF) {
 #ifdef DEBUG_RTL8169
 					printf("%s: 1000Mbps Full-duplex operation.\n",
 					     dev->name);
 #endif
-				} else {
+					miconCntl_Eth1000M(1);
+				} else if (option & _100bps) {
+#ifdef DEBUG_RTL8169
+					printf("%s: 100Mbps %s-duplexoperation.\n",
+						dev->name,
+						(option & FullDup) ? "Full" : "Half");
+#endif
+					miconCntl_Eth100M(1);
+				} else if (option & _10bps) {
 #ifdef DEBUG_RTL8169
 					printf
-					    ("%s: %sMbps %s-duplex operation.\n",
+					    ("%s: 10Mbps %s-duplex operation.\n",
 					     dev->name,
-					     (option & _100bps) ? "100" :
-					     "10",
-					     (option & FullDup) ? "Full" :
-					     "Half");
+					     (option & FullDup) ? "Full" : "Half");
+#endif
+					miconCntl_Eth100M(1);
+				}
+				miconCntl_5f();
+#else /* !defined(CONFIG_LINKSTATION) || !defined(CONFIG_HTGL) */
+				if (option & _1000bpsF) {
+#ifdef DEBUG_RTL8169
+					printf("%s: 1000Mbps Full-duplex operation.\n",
+						dev->name);
+#endif
+					miconCntl_FanHigh();
+				} else {
+#ifdef DEBUG_RTL8169
+					printk("%s: %sMbps %s-duplex operation.\n",
+						dev->name,
+						(option & _100bps) ? "100" : "10",
+						(option & FullDup) ? "Full" : "Half");
 #endif
 				}
+#endif
 				break;
 			} else {
 				udelay(100);
 			}
-		}		/* end for-loop to wait for auto-negotiation process */
+		}	/* end for-loop to wait for auto-negotiation process */
 
 	} else {
 		udelay(100);
@@ -886,3 +940,5 @@
 }
 
 #endif
+
+/* vim: set ts=4: */
diff -urN u-boot-86xx/fs/ext2/ext2fs.c u-boot-86xx-kuro_clean/fs/ext2/ext2fs.c
--- u-boot-86xx/fs/ext2/ext2fs.c	2006-10-13 00:27:17.000000000 +0200
+++ u-boot-86xx-kuro_clean/fs/ext2/ext2fs.c	2006-11-06 22:05:38.000000000 +0100
@@ -35,6 +35,8 @@
 
 /* Magic value used to identify an ext2 filesystem.  */
 #define	EXT2_MAGIC		0xEF53
+/* Magic value used to identify Buffalo's idea of ext2 */
+#define LINKSTATION_MAGIC	0xEF54
 /* Amount of indirect blocks in an inode.  */
 #define INDIRECT_BLOCKS		12
 /* Maximum lenght of a pathname.  */
@@ -851,7 +853,8 @@
 		goto fail;
 	}
 	/* Make sure this is an ext2 filesystem.  */
-	if (__le16_to_cpu (data->sblock.magic) != EXT2_MAGIC) {
+	if ((__le16_to_cpu (data->sblock.magic) != EXT2_MAGIC) &&
+	    (__le16_to_cpu (data->sblock.magic) != LINKSTATION_MAGIC)) {
 		goto fail;
 	}
 	data->diropen.data = data;
diff -urN u-boot-86xx/include/configs/linkstation.h u-boot-86xx-kuro_clean/include/configs/linkstation.h
--- u-boot-86xx/include/configs/linkstation.h	1970-01-01 01:00:00.000000000 +0100
+++ u-boot-86xx-kuro_clean/include/configs/linkstation.h	2006-11-06 22:30:33.000000000 +0100
@@ -0,0 +1,492 @@
+/*
+ * Copyright (C) 2006 Mihai Georgian <u-boot@linuxnotincluded.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#if 0
+#define DEBUG
+#endif
+
+/*-----------------------------------------------------------------------
+ * User configurable settings:
+ *   Mandatory settings:
+ *     CONFIG_IPADDR_LS		- the IP address of the LinkStation
+ *     CONFIG_SERVERIP_LS	- the address of the server for NFS/TFTP/DHCP/BOOTP
+ *   Optional settins:
+ *     CONFIG_NCIP_LS		- the adress of the computer running net console
+ *							  if not configured, it will be set to
+ *							  CONFIG_SERVERIP_LS
+ */
+
+#define CONFIG_IPADDR_LS	192.168.11.150
+#define CONFIG_SERVERIP_LS	192.168.11.149
+
+#if !defined(CONFIG_IPADDR_LS) || !defined(CONFIG_SERVERIP_LS)
+#error Both CONFIG_IPADDR_LS and CONFIG_SERVERIP_LS must be defined
+#endif
+
+#if !defined(CONFIG_NCIP_LS)
+#define CONFIG_NCIP_LS		CONFIG_SERVERIP_LS
+#endif
+
+/*----------------------------------------------------------------------
+ * DO NOT CHANGE ANYTHING BELOW, UNLESS YOU KNOW WHAT YOU ARE DOING
+ *---------------------------------------------------------------------*/
+
+#define CONFIG_MPC8245		1
+#define CONFIG_LINKSTATION	1
+
+/*---------------------------------------
+ * Supported models
+ *
+ * LinkStation HDLAN /KuroBox Standard (CONFIG_HLAN)
+ * LinkStation old model               (CONFIG_LAN) - totally untested
+ * LinkStation HGLAN / KuroBox HG      (CONFIG_HGLAN)
+ *
+ * Models not supported yet
+ * TeraStatin                          (CONFIG_HTGL)
+ */
+
+#if defined(CONFIG_HLAN) || defined(CONFIG_LAN)
+#define CONFIG_IDENT_STRING		" LinkStation / KuroBox"
+#elif defined(CONFIG_HGLAN)
+#define CONFIG_IDENT_STRING		" LinkStation HG / KuroBox HG"
+#elif defined(CONFIG_HTGL)
+#define CONFIG_IDENT_STRING		" TeraStation"
+#else
+#error No LinkStation model defined
+#endif
+
+#define CONFIG_BOOTDELAY	10
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+#undef CONFIG_BOOT_RETRY_TIME
+
+#define CONFIG_AUTOBOOT_KEYED
+#define CONFIG_AUTOBOOT_PROMPT		"Boot in %02d seconds ('s' to stop)..."
+#define CONFIG_AUTOBOOT_STOP_STR	"s"
+
+#define CONFIG_COMMANDS	   (CFG_CMD_BDI		| \
+							CFG_CMD_LOADS	| \
+							CFG_CMD_LOADB	| \
+							CFG_CMD_FLASH	| \
+							CFG_CMD_MEMORY	| \
+							CFG_CMD_NET		| \
+							CFG_CMD_ENV		| \
+							CFG_CMD_IDE		| \
+							CFG_CMD_PCI		| \
+							CFG_CMD_BOOTD	| \
+							CFG_CMD_CONSOLE	| \
+							CFG_CMD_RUN		| \
+							CFG_CMD_ECHO	| \
+							CFG_CMD_DHCP	| \
+							CFG_CMD_PING	| \
+							CFG_CMD_NFS		| \
+							CFG_CMD_EXT2	)
+#define CONFIG_BOOTP_MASK   CONFIG_BOOTP_ALL
+
+/* this must be included AFTER the definition of CONFIG_COMMANDS (if any) */
+#include <cmd_confdefs.h>
+
+/*
+ * Miscellaneous configurable options
+ */
+#define CFG_LONGHELP			/* undef to save memory		*/
+#define CFG_PROMPT		"=> "	/* Monitor Command Prompt	*/
+#define CFG_CBSIZE		256		/* Console I/O Buffer Size	*/
+
+#define CFG_PBSIZE		(CFG_CBSIZE + sizeof(CFG_PROMPT) + 16)
+#define CFG_MAXARGS		16			/* Max number of command args	*/
+#define CFG_BARGSIZE	CFG_CBSIZE	/* Boot Argument Buffer Size	*/
+#define CFG_LOAD_ADDR	0x00800000	/* Default load address: 8 MB	*/
+
+//#define CONFIG_BOOTCOMMAND  	"run nfsboot"
+#define CONFIG_BOOTCOMMAND  	"run bootcmd1"
+#define CONFIG_BOOTARGS			"root=/dev/hda1"
+#define CONFIG_NFSBOOTCOMMAND  	"bootp;run nfsargs;bootm"
+
+#define CFG_CONSOLE_IS_IN_ENV
+
+#define XMK_STR(x)		#x
+#define MK_STR(x)		XMK_STR(x)
+
+#if defined(CONFIG_HLAN) || defined(CONFIG_LAN)
+#define UBFILE			"share/u-boot/u-boot-hd.flash.bin"
+#elif defined(CONFIG_HGLAN)
+#define UBFILE			"share/u-boot/u-boot-hg.flash.bin"
+#elif defined(CONFIG_HTGL)
+#define UBFILE			"share/u-boot/u-boot-ht.flash.bin"
+#else
+#error No LinkStation model defined
+#endif
+
+#define CONFIG_EXTRA_ENV_SETTINGS				\
+    "autoload=no\0"								\
+	"stdin=nc\0"								\
+	"stdout=nc\0"								\
+	"stderr=nc\0"								\
+	"ipaddr="MK_STR(CONFIG_IPADDR_LS)"\0"		\
+	"netmask=255.255.255.0\0"					\
+	"serverip="MK_STR(CONFIG_SERVERIP_LS)"\0"	\
+	"ncip="MK_STR(CONFIG_NCIP_LS)"\0"			\
+	"netretry=no\0"								\
+	"nc=setenv stdin nc;setenv stdout nc;setenv stderr nc\0"	\
+	"ser=setenv stdin serial;setenv stdout serial;setenv stderr serial\0"	\
+    "ldaddr=800000\0"							\
+    "hdpart=0:1\0"								\
+    "hdfile=boot/vmlinux.UBoot\0"				\
+    "hdload=echo Loading ${hdpart}:${hdfile};ext2load ide ${hdpart} ${ldaddr} ${hdfile}\0"	\
+    "boothd=setenv bootargs root=/dev/hda1;bootm ${ldaddr}\0"	\
+    "hdboot=run hdload boothd\0"				\
+    "flboot=setenv bootargs root=/dev/hda1;bootm ffc00000\0"	\
+    "emboot=setenv bootargs root=/dev/ram0;bootm ffc00000\0"	\
+	"nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} "	\
+	"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off\0"	\
+	"bootretry=30\0"							\
+	"bootcmd1=run hdboot;run flboot\0"			\
+	"bootcmd2=run flboot\0"						\
+	"bootcmd3=run emboot\0"						\
+	"writeng=protect off fff70000 fff7ffff;era fff70000 fff7ffff;mw.l 800000 4e474e47 1;cp.b 800000 fff70000 4\0" \
+	"writeok=protect off fff70000 fff7ffff;era fff70000 fff7ffff;mw.l 800000 4f4b4f4b 1;cp.b 800000 fff70000 4\0" \
+	"ubpart=0:3\0"								\
+	"ubfile="UBFILE"\0"							\
+	"ubload=echo Loading ${ubpart}:${ubfile};ext2load ide ${ubpart} ${ldaddr} ${ubfile}\0" \
+	"ubsaddr=fff00000\0"						\
+	"ubeaddr=fff2ffff\0"						\
+	"ubflash=protect off ${ubsaddr} ${ubeaddr};era ${ubsaddr} ${ubeaddr};cp.b ${ldaddr} ${ubsaddr} ${filesize};cmp.b ${ldaddr} ${ubsaddr} ${filesize}\0" \
+	"upgrade=run ubload ubflash\0"
+
+/*-----------------------------------------------------------------------
+ * PCI stuff
+ */
+#define CONFIG_PCI
+#undef  CONFIG_PCI_PNP
+#define CONFIG_PCI_SCAN_SHOW
+
+#ifndef CONFIG_PCI_PNP
+/* Keep the following defines in sync with the BAT mappings */
+
+#define PCI_ETH_IOADDR      0xbfff00
+#define PCI_ETH_MEMADDR     0xbffffc00
+#define PCI_IDE_IOADDR      0xbffed0
+#define PCI_IDE_MEMADDR     0xbffffb00
+#define PCI_USB0_IOADDR     0
+#define PCI_USB0_MEMADDR    0xbfffe000
+#define PCI_USB1_IOADDR     0
+#define PCI_USB1_MEMADDR    0xbfffd000
+#define PCI_USB2_IOADDR     0
+#define PCI_USB2_MEMADDR    0xbfffcf00
+
+#endif
+
+/*-----------------------------------------------------------------------
+ * Ethernet stuff
+ */
+#define CONFIG_NET_MULTI
+
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN)
+#define CONFIG_TULIP
+#define CONFIG_TULIP_USE_IO
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+#define CONFIG_RTL8169
+#endif
+
+#define CONFIG_NET_RETRY_COUNT		5
+
+#define CONFIG_NETCONSOLE
+
+/*-----------------------------------------------------------------------
+ * Start addresses for the final memory configuration
+ * (Set up by the startup code)
+ * Please note that CFG_SDRAM_BASE _must_ start at 0
+ */
+#define CFG_SDRAM_BASE	    	0x00000000
+
+#define CFG_FLASH_BASE      	0xFFC00000
+#define CFG_MONITOR_BASE    	TEXT_BASE
+
+#define CFG_RESET_ADDRESS   	0xFFF00100
+#define CFG_EUMB_ADDR	    	0x80000000
+#define CFG_PCI_MEM_ADDR		0xB0000000
+#define CFG_MISC_REGION_ADDR	0xFE000000
+
+#define CFG_MONITOR_LEN     	0x00040000	/* 256 kB */
+#define CFG_MALLOC_LEN      	(512 << 10) /* Reserve some kB for malloc() */
+
+#define CFG_MEMTEST_START   	0x00100000	/* memtest works on		*/
+#define CFG_MEMTEST_END	    	0x00800000	/* 1M ... 8M in DRAM	*/
+
+/* Maximum amount of RAM */
+#if defined(CONFIG_HLAN) || defined(CONFIG_LAN)
+#define CFG_MAX_RAM_SIZE    	0x04000000	/* 64MB of SDRAM  */
+#elif defined(CONFIG_HGLAN) || defined(CONFIG_HTGL)
+#define CFG_MAX_RAM_SIZE    	0x08000000	/* 128MB of SDRAM */
+#else
+#error Unknown LinkStation type
+#endif
+
+/*-----------------------------------------------------------------------
+ * Change TEXT_BASE in bord/linkstation/config.mk to get a RAM build
+ *
+ * RAM based builds are for testing purposes. A Linux module, uloader.o,
+ * exists to load U-Boot and pass control to it
+ *
+ * Always do "make clean" after changing the build type
+ */
+#if CFG_MONITOR_BASE < CFG_FLASH_BASE
+#define CFG_RAMBOOT
+#endif
+
+/*-----------------------------------------------------------------------
+ * Definitions for initial stack pointer and data area
+ */
+#if 1 /* RAM is available when the first C function is called */
+#define CFG_INIT_RAM_ADDR		(CFG_SDRAM_BASE + CFG_MAX_RAM_SIZE - 0x1000)
+#else
+#define CFG_INIT_RAM_ADDR		0x40000000
+#endif
+#define CFG_INIT_RAM_END		0x1000
+#define CFG_GBL_DATA_SIZE		128
+#define CFG_GBL_DATA_OFFSET		(CFG_INIT_RAM_END - CFG_GBL_DATA_SIZE)
+
+/*----------------------------------------------------------------------
+ * Serial configuration
+ */
+#define CONFIG_CONS_INDEX	1
+#define CONFIG_BAUDRATE		57600
+#define CFG_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
+
+#define CFG_NS16550
+#define CFG_NS16550_SERIAL
+
+#define CFG_NS16550_REG_SIZE	1
+
+#define CFG_NS16550_CLK		get_bus_freq(0)
+
+#define CFG_NS16550_COM1	(CFG_EUMB_ADDR + 0x4600)	/* Console port */
+#define CFG_NS16550_COM2	(CFG_EUMB_ADDR + 0x4500)	/* AVR port */
+
+/*
+ * Low Level Configuration Settings
+ * (address mappings, register initial values, etc.)
+ * You should know what you are doing if you make changes here.
+ * For the detail description refer to the MPC8245 user's manual.
+ *
+ * Unless indicated otherwise, the values are
+ * taken from the orignal Linkstation boot code
+ *
+ * Most of the low level configuration setttings are normally used
+ * in cpu/mpc824x/cpu_init.c which is NOT used by this implementation.
+ * Low level initialisation is done in board/linkstation/early_init.S
+ * The values below are included for reference purpose only
+ */
+
+/* FIXME: 32.768 MHz is the crystal frequency but */
+/* the real frequency is lower by about 0.75%     */
+#define CONFIG_SYS_CLK_FREQ  32768000
+#define CFG_HZ		     	 1000
+
+/* Bit-field values for MCCR1.  */
+#define CFG_ROMNAL      0
+#define CFG_ROMFAL      11
+
+#define CFG_BANK0_ROW	2       /* Only bank 0 used: 13 x n x 4 */
+#define CFG_BANK1_ROW	0
+#define CFG_BANK2_ROW	0
+#define CFG_BANK3_ROW	0
+#define CFG_BANK4_ROW	0
+#define CFG_BANK5_ROW	0
+#define CFG_BANK6_ROW	0
+#define CFG_BANK7_ROW	0
+
+/* Bit-field values for MCCR2.  */
+#define CFG_TSWAIT      0
+#define CFG_REFINT      1400
+
+/* Burst To Precharge. Bits of this value go to MCCR3 and MCCR4.  */
+#define CFG_BSTOPRE     121
+
+/* Bit-field values for MCCR3.  */
+#define CFG_REFREC      7
+
+/* Bit-field values for MCCR4.  */
+#define CFG_PRETOACT    2
+#define CFG_ACTTOPRE    5		/* Original value was 2 */
+#define CFG_ACTORW      2
+#define CFG_SDMODE_CAS_LAT  2	/* For 100MHz bus. Use 3 for 133MHz */
+#define CFG_REGISTERD_TYPE_BUFFER 1
+#define CFG_EXTROM      1		/* Original setting but there is no EXTROM */
+#define CFG_REGDIMM     0
+#define CFG_DBUS_SIZE2  1
+#define CFG_SDMODE_WRAP 0
+
+#define CFG_PGMAX       0x32	/* All boards use this setting. Original 0x92 */
+#define CFG_SDRAM_DSCD  0x30
+
+/* Memory bank settings.
+ * Only bits 20-29 are actually used from these vales to set the
+ * start/end addresses. The upper two bits will always be 0, and the lower
+ * 20 bits will be 0x00000 for a start address, or 0xfffff for an end
+ * address. Refer to the MPC8240 book.
+ */
+
+#define CFG_BANK0_START	    0x00000000
+#define CFG_BANK0_END	    (CFG_MAX_RAM_SIZE - 1)
+#define CFG_BANK0_ENABLE    1
+#define CFG_BANK1_START     0x3ff00000
+#define CFG_BANK1_END       0x3fffffff
+#define CFG_BANK1_ENABLE    0
+#define CFG_BANK2_START     0x3ff00000
+#define CFG_BANK2_END       0x3fffffff
+#define CFG_BANK2_ENABLE    0
+#define CFG_BANK3_START     0x3ff00000
+#define CFG_BANK3_END       0x3fffffff
+#define CFG_BANK3_ENABLE    0
+#define CFG_BANK4_START     0x3ff00000
+#define CFG_BANK4_END       0x3fffffff
+#define CFG_BANK4_ENABLE    0
+#define CFG_BANK5_START     0x3ff00000
+#define CFG_BANK5_END       0x3fffffff
+#define CFG_BANK5_ENABLE    0
+#define CFG_BANK6_START     0x3ff00000
+#define CFG_BANK6_END       0x3fffffff
+#define CFG_BANK6_ENABLE    0
+#define CFG_BANK7_START     0x3ff00000
+#define CFG_BANK7_END       0x3fffffff
+#define CFG_BANK7_ENABLE    0
+
+#define CFG_ODCR	    0x95		/* 0x15 or 0x95 ? */
+
+/*----------------------------------------------------------------------
+ * Initial BAT mappings
+ */
+
+/* NOTES:
+ * 1) GUARDED and WRITETHROUGH not allowed in IBATS
+ * 2) CACHEINHIBIT and WRITETHROUGH not allowed together in same BAT
+ */
+
+/* SDRAM */
+#define CFG_IBAT0L (CFG_SDRAM_BASE | BATL_PP_10 | BATL_MEMCOHERENCE)
+#define CFG_IBAT0U (CFG_SDRAM_BASE | BATU_BL_128M | BATU_VS | BATU_VP)
+
+#define CFG_DBAT0L CFG_IBAT0L
+#define CFG_DBAT0U CFG_IBAT0U
+
+/* EUMB: 1MB of address space */
+#define CFG_IBAT1L (CFG_EUMB_ADDR | BATL_PP_10 | BATL_CACHEINHIBIT)
+#define CFG_IBAT1U (CFG_EUMB_ADDR | BATU_BL_1M | BATU_VS | BATU_VP)
+
+#define CFG_DBAT1L (CFG_IBAT1L | BATL_GUARDEDSTORAGE)
+#define CFG_DBAT1U CFG_IBAT1U
+
+/* PCI Mem: 256MB of address space */
+#define CFG_IBAT2L  (CFG_PCI_MEM_ADDR | BATL_PP_10 | BATL_CACHEINHIBIT)
+#define CFG_IBAT2U  (CFG_PCI_MEM_ADDR | BATU_BL_256M | BATU_VS | BATU_VP)
+
+#define CFG_DBAT2L  (CFG_IBAT2L | BATL_GUARDEDSTORAGE)
+#define CFG_DBAT2U  CFG_IBAT2U
+
+/* PCI and local ROM/Flash: last 32MB of address space */
+#define CFG_IBAT3L (CFG_MISC_REGION_ADDR | BATL_PP_10 | BATL_CACHEINHIBIT)
+#define CFG_IBAT3U (CFG_MISC_REGION_ADDR | BATU_BL_32M | BATU_VS | BATU_VP)
+
+#define CFG_DBAT3L (CFG_IBAT3L | BATL_GUARDEDSTORAGE)
+#define CFG_DBAT3U CFG_IBAT3U
+
+/*
+ * For booting Linux, the board info and command line data
+ * have to be in the first 8 MB of memory, since this is
+ * the maximum mapped by the Linux kernel during initialization.
+ *
+ * FIXME: This doesn't appear to be true for the newer kernels
+ * which map more that 8 MB
+ */
+#define CFG_BOOTMAPSZ	    (8 << 20)	/* Initial Memory map for Linux */
+
+/*-----------------------------------------------------------------------
+ * FLASH organization
+ */
+#undef  CFG_FLASH_PROTECTION
+#define CFG_MAX_FLASH_BANKS		1	/* Max number of flash banks		*/
+#define CFG_MAX_FLASH_SECT		72	/* Max number of sectors per flash	*/
+
+#define CFG_FLASH_ERASE_TOUT	12000
+#define CFG_FLASH_WRITE_TOUT	1000
+
+
+#define CFG_ENV_IS_IN_FLASH
+/*
+ * The original LinkStation flash organisation uses
+ * 448 kB (0xFFF00000 - 0xFFF6FFFF) for the boot loader
+ * We use the last sector of this area to store the environment
+ * which leaves max. 384 kB for the U-Boot itself
+ */
+#define CFG_ENV_ADDR		0xFFF60000
+#define CFG_ENV_SIZE		0x00010000
+#define CFG_ENV_SECT_SIZE	0x00010000
+
+/*-----------------------------------------------------------------------
+ * Cache Configuration
+ */
+#define CFG_CACHELINE_SIZE	32
+#if (CONFIG_COMMANDS & CFG_CMD_KGDB)
+#define CFG_CACHELINE_SHIFT	5	/* log base 2 of the above value	*/
+#endif
+
+/*-----------------------------------------------------------------------
+ * IDE/ATA definitions
+ */
+#undef  CONFIG_IDE_LED					/* No IDE LED					*/
+#define CONFIG_IDE_RESET				/* no reset for ide supported	*/
+#define CONFIG_IDE_PREINIT				/* check for units				*/
+#define CONFIG_LBA48					/* 48 bit LBA supported			*/
+
+#if defined(CONFIG_LAN) || defined(CONFIG_HLAN) || defined(CONFIG_HGLAN)
+#define CFG_IDE_MAXBUS			1		/* Scan only 1 IDE bus			*/
+#define CFG_IDE_MAXDEVICE		1		/* Only 1 drive per IDE bus		*/
+#elif defined(CONFIG_HGTL)
+#define CFG_IDE_MAXBUS			2		/* Max. 2 IDE busses			*/
+#define CFG_IDE_MAXDEVICE		2		/* max. 2 drives per IDE bus	*/
+#else
+#error Config IDE: Unknown LinkStation type
+#endif
+
+#define CFG_ATA_BASE_ADDR		0
+
+#define CFG_ATA_DATA_OFFSET		0		/* Offset for data I/O			*/
+#define CFG_ATA_REG_OFFSET		0		/* Offset for normal registers	*/
+#define CFG_ATA_ALT_OFFSET		0		/* Offset for alternate registers */
+
+/*-----------------------------------------------------------------------
+ * Partitions and file system
+ */
+#define CONFIG_DOS_PARTITION
+
+/*-----------------------------------------------------------------------
+ * Internal Definitions
+ *
+ * Boot Flags
+ */
+#define BOOTFLAG_COLD		0x01	/* Normal Power-On: Boot from FLASH	*/
+#define BOOTFLAG_WARM		0x02	/* Software reboot			*/
+
+#endif	/* __CONFIG_H */
+
+/* vim: set ts=4: */
diff -urN u-boot-86xx/include/devices.h u-boot-86xx-kuro_clean/include/devices.h
--- u-boot-86xx/include/devices.h	2006-10-13 00:27:18.000000000 +0200
+++ u-boot-86xx-kuro_clean/include/devices.h	2006-11-06 22:05:38.000000000 +0100
@@ -93,6 +93,7 @@
 int	devices_init (void);
 int	devices_done (void);
 int	device_deregister(char *devname);
+int	console_setfile (int file, device_t * dev);
 #ifdef CONFIG_LCD
 int	drv_lcd_init (void);
 #endif
@@ -111,5 +112,8 @@
 #ifdef CONFIG_NETCONSOLE
 int	drv_nc_init (void);
 #endif
+#if defined(CFG_CONSOLE_IS_IN_ENV) || defined(CONFIG_SPLASH_SCREEN) || defined(CONFIG_SILENT_CONSOLE)
+device_t *search_device (int flags, char *name);
+#endif
 
 #endif	/* _DEVICES_H_ */
diff -urN u-boot-86xx/include/flash.h u-boot-86xx-kuro_clean/include/flash.h
--- u-boot-86xx/include/flash.h	2006-10-13 00:27:18.000000000 +0200
+++ u-boot-86xx-kuro_clean/include/flash.h	2006-11-06 22:05:38.000000000 +0100
@@ -215,6 +215,8 @@
 
 #define AMD_ID_LV320B_2 0x221A221A	/* 2d ID word for AM29LV320MB at 0x38 */
 #define AMD_ID_LV320B_3 0x22002200	/* 3d ID word for AM29LV320MB at 0x3c */
+#define AMD_ID_LV320T_2 0x221A221A	/* 2d ID word for AM29LV320MT at 0x38 */
+#define AMD_ID_LV320T_3 0x22012201	/* 3d ID word for AM29LV320MT at 0x3c */
 
 #define AMD_ID_LV640U	0x22D722D7	/* 29LV640U ID (64 M, uniform sectors)	*/
 #define AMD_ID_LV650U	0x22D722D7	/* 29LV650U ID (64 M, uniform sectors)	*/
@@ -246,6 +248,8 @@
 #define STM_ID_x800AB	0x005B005B	/* M29W800AB ID (8M = 512K x 16 )	*/
 #define STM_ID_29W320DT 0x22CA22CA	/* M29W320DT ID (32 M, top boot sector) */
 #define STM_ID_29W320DB 0x22CB22CB	/* M29W320DB ID (32 M, bottom boot sect)	*/
+#define STM_ID_29W324DT 0x225C225C	/* M29W324DT ID (32 M, top boot sector) */
+#define STM_ID_29W324DB 0x225D225D	/* M29W324DB ID (32 M, bottom boot sect)	*/
 #define STM_ID_29W040B	0x00E300E3	/* M29W040B ID (4M = 512K x 8)	*/
 #define FLASH_PSD4256GV 0x00E9		/* PSD4256 Flash and CPLD combination	*/
 
@@ -353,6 +357,8 @@
 #define FLASH_STM800AB	0x0051		/* STM M29WF800AB  (  8M = 512K x 16 )	*/
 #define FLASH_STMW320DT 0x0052		/* STM M29W320DT   (32 M, top boot sector)	*/
 #define FLASH_STMW320DB 0x0053		/* STM M29W320DB   (32 M, bottom boot sect)*/
+#define FLASH_STMW324DT 0x005C		/* STM M29W320DT   (32 M, top boot sector)	*/
+#define FLASH_STMW324DB 0x005D		/* STM M29W320DB   (32 M, bottom boot sect)*/
 #define FLASH_STM320DB	0x00CB		/* STM M29W320DB (4M = 64K x 64, bottom)*/
 #define FLASH_STM800DT	0x00D7		/* STM M29W800DT (1M = 64K x 16, top)	*/
 #define FLASH_STM800DB	0x005B		/* STM M29W800DB (1M = 64K x 16, bottom)*/
diff -urN u-boot-86xx/include/pci_ids.h u-boot-86xx-kuro_clean/include/pci_ids.h
--- u-boot-86xx/include/pci_ids.h	2006-10-13 00:27:18.000000000 +0200
+++ u-boot-86xx-kuro_clean/include/pci_ids.h	2006-11-06 22:05:38.000000000 +0100
@@ -1473,6 +1473,8 @@
 #define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
 #define PCI_DEVICE_ID_ITE_IT8181	0x8181
 #define PCI_DEVICE_ID_ITE_8872		0x8872
+#define PCI_DEVICE_ID_ITE_8211		0x8211
+#define PCI_DEVICE_ID_ITE_8212		0x8212
 
 #define PCI_DEVICE_ID_ITE_IT8330G_0	0xe886
 
diff -urN u-boot-86xx/lib_ppc/board.c u-boot-86xx-kuro_clean/lib_ppc/board.c
--- u-boot-86xx/lib_ppc/board.c	2006-10-13 00:27:19.000000000 +0200
+++ u-boot-86xx-kuro_clean/lib_ppc/board.c	2006-11-06 22:05:38.000000000 +0100
@@ -439,6 +439,10 @@
 	 */
 	addr -= len;
 	addr &= ~(4096 - 1);
+#ifdef CONFIG_LINKSTATION
+	/* U-Boot code at 1 MB boundary to make it easier to debug */
+	addr &= ~(1048576 - 1);
+#endif
 #ifdef CONFIG_E500
 	/* round down to next 64 kB limit so that IVPR stays aligned */
 	addr &= ~(65536 - 1);
@@ -895,8 +899,10 @@
 	/* Initialize the jump table for applications */
 	jumptable_init ();
 
+#if !defined(CONFIG_LINKSTATION)
 	/* Initialize the console (after the relocation and devices init) */
 	console_init_r ();
+#endif
 
 #if defined(CONFIG_CCM)		|| \
     defined(CONFIG_COGENT)	|| \
@@ -949,6 +955,7 @@
 	if ((s = getenv ("loadaddr")) != NULL) {
 		load_addr = simple_strtoul (s, NULL, 16);
 	}
+	debug("load_addr: %08lx\n", load_addr);
 #if (CONFIG_COMMANDS & CFG_CMD_NET)
 	if ((s = getenv ("bootfile")) != NULL) {
 		copy_filename (BootFile, s, sizeof (BootFile));
@@ -998,6 +1005,11 @@
 	reset_phy ();
 #endif
 
+#if defined(CONFIG_LINKSTATION)
+	/* The LinkStation uses the net console by default */
+	console_init_r ();
+#endif
+
 #ifdef CONFIG_POST
 	post_run (NULL, POST_RAM | post_bootmode_get(0));
 #endif
diff -urN u-boot-86xx/lib_ppc/interrupts.c u-boot-86xx-kuro_clean/lib_ppc/interrupts.c
--- u-boot-86xx/lib_ppc/interrupts.c	2006-10-13 00:27:19.000000000 +0200
+++ u-boot-86xx-kuro_clean/lib_ppc/interrupts.c	2006-11-06 22:05:38.000000000 +0100
@@ -40,7 +40,7 @@
 #endif
 
 extern int interrupt_init_cpu (unsigned *);
-extern void timer_interrupt_cpu (struct pt_regs *);
+extern void timer_interrupt_cpu (struct pt_regs *, ulong timestamp);
 
 static unsigned decrementer_count; /* count value for 1e6/HZ microseconds */
 
@@ -111,7 +111,7 @@
 void timer_interrupt (struct pt_regs *regs)
 {
 	/* call cpu specific function from $(CPU)/interrupts.c */
-	timer_interrupt_cpu (regs);
+	timer_interrupt_cpu (regs, timestamp);
 
 	/* Restore Decrementer Count */
 	set_dec (decrementer_count);
diff -urN u-boot-86xx/net/net.c u-boot-86xx-kuro_clean/net/net.c
--- u-boot-86xx/net/net.c	2006-10-13 00:27:19.000000000 +0200
+++ u-boot-86xx-kuro_clean/net/net.c	2006-11-06 22:05:38.000000000 +0100
@@ -641,6 +641,11 @@
 {
 	uchar *pkt;
 
+#ifdef ET_DEBUG
+        printf("%s dest: %08lx, dport: %d, sport: %d, len: %d\n",
+		__FUNCTION__, dest, dport, sport, len);
+#endif
+
 	/* convert to new style broadcast */
 	if (dest == 0)
 		dest = 0xFFFFFFFF;
@@ -758,6 +763,8 @@
 	IPaddr_t tmp;
 	volatile IP_t *ip = (volatile IP_t *)pkt;
 
+	if (!pkt && !dest && !src && !len) /* ARP packet */
+		return;
 	tmp = NetReadIP((void *)&ip->ip_src);
 	if (tmp != NetPingIP)
 		return;
@@ -1146,7 +1153,7 @@
 	ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid;
 
 #ifdef ET_DEBUG
-	printf("packet received\n");
+	printf("%s: packet received\n", __FUNCTION__);
 #endif
 
 	NetRxPkt = inpkt;
@@ -1171,10 +1178,6 @@
 
 	x = ntohs(et->et_protlen);
 
-#ifdef ET_DEBUG
-	printf("packet received\n");
-#endif
-
 	if (x < 1514) {
 		/*
 		 *	Got a 802 packet.  Check the other protocol field.
@@ -1305,13 +1308,16 @@
 			/* matched waiting packet's address */
 			if (tmp == NetArpWaitReplyIP) {
 #ifdef ET_DEBUG
-				puts ("Got it\n");
+				puts ("ARP reply IP matches original pkt IP\n");
 #endif
 				/* save address for later use */
 				memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6);
 
 #ifdef CONFIG_NETCONSOLE
-				(*packetHandler)(0,0,0,0);
+				if (packetHandler)
+					(*packetHandler)(0,0,0,0);
+				else
+					printf("ARP: NULL packetHandler\n");
 #endif
 				/* modify header, and transmit it */
 				memcpy(((Ethernet_t *)NetArpWaitTxPacket)->et_dest, NetArpWaitPacketMAC, 6);
@@ -1354,7 +1360,10 @@
 				NetCopyIP(&NetServerIP, &arp->ar_data[ 6]);
 			memcpy (NetServerEther, &arp->ar_data[ 0], 6);
 
-			(*packetHandler)(0,0,0,0);
+			if (packetHandler)
+				(*packetHandler)(0,0,0,0);
+			else
+				printf("ARP: NULL packetHandler\n");
 		}
 		break;
 
diff -urN u-boot-86xx/net/nfs.c u-boot-86xx-kuro_clean/net/nfs.c
--- u-boot-86xx/net/nfs.c	2006-10-13 00:27:19.000000000 +0200
+++ u-boot-86xx-kuro_clean/net/nfs.c	2006-11-06 22:05:38.000000000 +0100
@@ -29,7 +29,7 @@
 #include "nfs.h"
 #include "bootp.h"
 
-/*#define NFS_DEBUG*/
+#undef NFS_DEBUG
 
 #if ((CONFIG_COMMANDS & CFG_CMD_NET) && (CONFIG_COMMANDS & CFG_CMD_NFS))
 
@@ -180,6 +180,9 @@
 	int sport;
 
 	id = ++rpc_id;
+#ifdef NFS_DEBUG
+        printf ("%s xid: %d, rpc_id: %d\n", __FUNCTION__, id, rpc_id);
+#endif
 	pkt.u.call.id = htonl(id);
 	pkt.u.call.type = htonl(MSG_CALL);
 	pkt.u.call.rpcvers = htonl(2);	/* use RPC version 2 */
@@ -213,6 +216,10 @@
 {
 	uint32_t data[16];
 
+#ifdef NFS_DEBUG
+        printf ("%s\n", __FUNCTION__);
+#endif
+
 	data[0] = 0; data[1] = 0;	/* auth credential */
 	data[2] = 0; data[3] = 0;	/* auth verifier */
 	data[4] = htonl(prog);
@@ -234,6 +241,10 @@
 	int len;
 	int pathlen;
 
+#ifdef NFS_DEBUG
+        printf ("%s\n", __FUNCTION__);
+#endif
+
 	pathlen = strlen (path);
 
 	p = &(data[0]);
@@ -259,6 +270,10 @@
 	uint32_t *p;
 	int len;
 
+#ifdef NFS_DEBUG
+        printf ("%s\n", __FUNCTION__);
+#endif
+
 	if ((NfsSrvMountPort == -1) || (!fs_mounted)) {
 		/* Nothing mounted, nothing to umount */
 		return;
@@ -286,6 +301,10 @@
 	uint32_t *p;
 	int len;
 
+#ifdef NFS_DEBUG
+        printf ("%s\n", __FUNCTION__);
+#endif
+
 	p = &(data[0]);
 	p = (uint32_t *)rpc_add_credentials ((long *)p);
 
@@ -308,6 +327,10 @@
 	int len;
 	int fnamelen;
 
+#ifdef NFS_DEBUG
+        printf ("%s\n", __FUNCTION__);
+#endif
+
 	fnamelen = strlen (fname);
 
 	p = &(data[0]);
@@ -335,6 +358,10 @@
 	uint32_t *p;
 	int len;
 
+#ifdef NFS_DEBUG
+        printf ("%s\n", __FUNCTION__);
+#endif
+
 	p = &(data[0]);
 	p = (uint32_t *)rpc_add_credentials ((long *)p);
 
@@ -405,8 +432,13 @@
 
 	if (rpc_pkt.u.reply.rstatus  ||
 	    rpc_pkt.u.reply.verifier ||
-	    rpc_pkt.u.reply.astatus  ||
 	    rpc_pkt.u.reply.astatus) {
+#ifdef NFS_DEBUG
+		printf ("rstatus: %d\n", rpc_pkt.u.reply.rstatus);
+		printf ("verifier: %08lx\n", rpc_pkt.u.reply.verifier);
+		printf ("v2: %08lx\n", rpc_pkt.u.reply.v2);
+		printf ("astatus: %d\n", rpc_pkt.u.reply.astatus);
+#endif
 		return -1;
 	}
 
@@ -433,13 +465,24 @@
 
 	memcpy ((unsigned char *)&rpc_pkt, pkt, len);
 
-	if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
+	if (ntohl(rpc_pkt.u.reply.id) != rpc_id) {
+#ifdef NFS_DEBUG
+		printf ("rpc_id error. expected: %d, got: %d\n", \
+			rpc_id, ntohl(rpc_pkt.u.reply.id));
+#endif
 		return -1;
+	}
 
 	if (rpc_pkt.u.reply.rstatus  ||
 	    rpc_pkt.u.reply.verifier ||
 	    rpc_pkt.u.reply.astatus  ||
 	    rpc_pkt.u.reply.data[0]) {
+#ifdef NFS_DEBUG
+		printf ("rstatus: %d\n", rpc_pkt.u.reply.rstatus);
+		printf ("verifier: %08lx\n", rpc_pkt.u.reply.verifier);
+		printf ("astatus: %d\n", rpc_pkt.u.reply.astatus);
+		printf ("data[0]: %08lx\n", rpc_pkt.u.reply.data[0]);
+#endif
 		return -1;
 	}
 
@@ -544,7 +587,7 @@
 	struct rpc_t rpc_pkt;
 	int rlen;
 
-#ifdef NFS_DEBUG_nop
+#ifdef NFS_DEBUG
 	printf ("%s\n", __FUNCTION__);
 #endif
 
@@ -601,6 +644,8 @@
 	printf ("%s\n", __FUNCTION__);
 #endif
 
+	if (!pkt && !dest && !src && !len) /* ARP packet */
+		return;
 	if (dest != NfsOurPort) return;
 
 	switch (NfsState) {
diff -urN u-boot-86xx/tools/Makefile u-boot-86xx-kuro_clean/tools/Makefile
--- u-boot-86xx/tools/Makefile	2006-10-13 00:27:19.000000000 +0200
+++ u-boot-86xx-kuro_clean/tools/Makefile	2006-11-06 22:18:42.000000000 +0100
@@ -21,10 +21,10 @@
 # MA 02111-1307 USA
 #
 
-BIN_FILES	= img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX)
+BIN_FILES	= img2srec$(SFX) mkimage$(SFX) envcrc$(SFX) gen_eth_addr$(SFX) bmp_logo$(SFX) ncb$(SFX)
 
 OBJ_LINKS	= environment.o crc32.o
-OBJ_FILES	= img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o
+OBJ_FILES	= img2srec.o mkimage.o envcrc.o gen_eth_addr.o bmp_logo.o ncb.o
 
 ifeq ($(ARCH),mips)
 BIN_FILES	+= inca-swap-bytes$(SFX)