|
34 | 34 | } |
35 | 35 | arch_gxemul_list = ['pmax', 'hpcmips', 'landisk'] |
36 | 36 | arch_simh_list = ['vax'] |
| 37 | +arch_uae_list = ['amiga'] |
37 | 38 |
|
38 | 39 | # External commands we rely on |
39 | 40 |
|
@@ -214,10 +215,10 @@ def dir2url(dir): |
214 | 215 | return "".join(chars) |
215 | 216 |
|
216 | 217 | def check_arch_supported(arch, dist_type): |
217 | | - if arch_qemu_map.get(arch) is None and not arch in (arch_gxemul_list + arch_simh_list): |
| 218 | + if arch_qemu_map.get(arch) is None and not arch in (arch_gxemul_list + arch_simh_list + arch_uae_list): |
218 | 219 | raise RuntimeError(("'%s' is not the name of a " + \ |
219 | 220 | "supported NetBSD port") % arch) |
220 | | - if arch in ['i386', 'amd64'] and dist_type != 'reltree': |
| 221 | + if arch in ['i386', 'amd64', 'amiga'] and dist_type != 'reltree': |
221 | 222 | raise RuntimeError(("NetBSD/%s must be installed from " + |
222 | 223 | "a release tree, not an ISO") % arch) |
223 | 224 | if (arch in ['sparc', 'sparc64', 'vax']) and dist_type != 'iso': |
@@ -453,10 +454,12 @@ def download(self): |
453 | 454 | download_if_missing_3(self.dist_url(), self.download_local_arch_dir(), ["binary", "kernel", file]) |
454 | 455 | download_if_missing_3(self.dist_url(), self.download_local_arch_dir(), ["binary", "gzimg", "armv7.img.gz"]) |
455 | 456 | return |
456 | | - if self.arch() == 'hpcmips': |
| 457 | + elif self.arch() == 'hpcmips': |
457 | 458 | download_if_missing_3(self.dist_url(), self.download_local_arch_dir(), ["installation", "netbsd.gz"]) |
458 | | - if self.arch() in ['hpcmips', 'landisk']: |
| 459 | + elif self.arch() in ['hpcmips', 'landisk']: |
459 | 460 | download_if_missing_3(self.dist_url(), self.download_local_arch_dir(), ["binary", "kernel", "netbsd-GENERIC.gz"]) |
| 461 | + elif self.arch() == 'amiga': |
| 462 | + download_if_missing_3(self.dist_url(), self.download_local_arch_dir(), ["installation", "miniroot", "miniroot.fs.gz"]) |
460 | 463 | i = 0 |
461 | 464 | for floppy in self.potential_floppies(): |
462 | 465 | download_if_missing_3(self.dist_url(), |
@@ -808,6 +811,33 @@ def configure_child(self, child): |
808 | 811 | child.delayafterterminate = 30.0 |
809 | 812 | self.child = child |
810 | 813 |
|
| 814 | + def start_uae(self, vmm_args = []): |
| 815 | + f = open(os.path.join(self.workdir, 'netbsd.uae'), 'w') |
| 816 | + f.write('kickstart_rom_file=/path/to/kickstart\n' + |
| 817 | + 'kbd_lang=us\n' + |
| 818 | + 'gfx_linemode=double\n' + |
| 819 | + 'sound_output=interrupts\n' + |
| 820 | + 'sound_channels=stereo\n' + |
| 821 | + 'sound_max_buff=44100\n' + |
| 822 | + 'cpu_type=68040\n' + |
| 823 | + 'cpu_speed=30' + |
| 824 | + 'cpu_compatible=false' + |
| 825 | + 'nr_floppies=1' + |
| 826 | + 'rtc=a3000\n' + |
| 827 | + 'wdc=both\n' + |
| 828 | + 'z3mem_size=1024\n' + |
| 829 | + 'wdcfile=rw,32,16,0,512,' + self.wd0_path() + '\n' + |
| 830 | + '\n'.join(vmm_args) + '\n' + |
| 831 | + 'ethercard=false\n' + |
| 832 | + 'gmtime=true\n' + |
| 833 | + 'use_gui=no\n' + |
| 834 | + 'vnc_screen=0\n' + |
| 835 | + 'vnc_password=\n' + |
| 836 | + 'vnc_viewonly=ok') |
| 837 | + f.close() |
| 838 | + child = self.pexpect_spawn('uae', [os.path.join(self.workdir, 'netbsd.uae')]) |
| 839 | + self.configure_child(child) |
| 840 | + return child |
811 | 841 | def start_simh(self, vmm_args = []): |
812 | 842 | f = open(os.path.join(self.workdir, 'netbsd.ini'), 'w') |
813 | 843 | f.write('set cpu ' + str(self.memory_megs()) + 'm\n' + |
@@ -910,7 +940,123 @@ def start_noemu(self, vmm_args): |
910 | 940 | self.configure_child(child) |
911 | 941 | return child |
912 | 942 |
|
913 | | - def _install(self): |
| 943 | + def install_amiga(self): |
| 944 | + print "Creating hard disk image...", |
| 945 | + sys.stdout.flush() |
| 946 | + spawn('dd',['dd', 'if=/dev/zero', 'of=' + self.wd0_path, 'bs=512', 'count=2000000']) |
| 947 | + print "Creating install image...", |
| 948 | + sys.stdout.flush() |
| 949 | + wd1_path = os.path.join(self.workdir, 'wd1.img') |
| 950 | + spawn('dd',['dd', 'if=/dev/zero', 'of=' + wd1_path, 'bs=512', 'count=2000000']) |
| 951 | + rdb_conf = os.path.join(self.workdir,'rdbedit.conf') |
| 952 | + f = open(rdb_conf, 'w+') |
| 953 | + f.write('c3 7000\n' + 'p3\n' + 'nmini\n' + 'fbootable\n' + 'o16\n' + 'tNBR\\7\n' + 'q\n' + |
| 954 | + 'c4 8624\n' + 'p4\n' + 'nsets\n' + 'o16\n' + 'tNBU\\12\n' + 'q\n' + 'q\n' + 'Y\n') |
| 955 | + f.seek(0) |
| 956 | + subprocess.Popen(['rdbedit', '-Fies 2', wd1_path], stdin=f) |
| 957 | + f.close() |
| 958 | + f = open(rdb_conf, 'w+') |
| 959 | + f.write('c3 7000\n' + 'p3\n' + 'nroot\n' + 'fbootable\n' + 'o16\n' + |
| 960 | + 'tNBR\\7\n' + 'q\n' + 'q\n' + 'Y\n') |
| 961 | + f.seek(0) |
| 962 | + subprocess.Popen(['rdbedit', '-Fies 2', self.wd0_path()], stdin=f) |
| 963 | + f.close() |
| 964 | + self.dist.make_iso() |
| 965 | + miniroot_fn = os.path.join(self.workdir, 'installation', 'miniroot', 'miniroot.fs.gz') |
| 966 | + if os.path.exists(miniroot_fn): |
| 967 | + subprocess.call('zcat' + miniroot_fn + ' | dd of=' + self.wd0_path() + 'oseek=128' + ' conv=osync,notrunc', shell = True) |
| 968 | + spawn('dd', ['dd', 'if=' + self.dist.iso_path, 'of=' + wd1_path, 'oseek=896128' + ' conv=osync,notrunc', shell = True]) |
| 969 | + vmm_args = ['wdcfile=rw,32,16,0,512,' + wd1_path] |
| 970 | + child = self.start_uae(vmm_args) |
| 971 | + loop = 0 |
| 972 | + while True: |
| 973 | + loop = loop + 1 |
| 974 | + if loop == 24: |
| 975 | + raise RuntimeError("loop detected") |
| 976 | + child.expect( |
| 977 | + # Group 1 |
| 978 | + "(map you want to activate)|" + |
| 979 | + # Group 2 |
| 980 | + "(pgrade)|" + |
| 981 | + # Group 3 |
| 982 | + "(Proceed with installation)|" + |
| 983 | + # Group 4 |
| 984 | + "(Look at which)|" + |
| 985 | + # Group 5 |
| 986 | + "(Which disk is the root disk)|" + |
| 987 | + # Group 6 |
| 988 | + "(Device name)|" + |
| 989 | + # Group 7 |
| 990 | + "(Ok to configure wd0b as a swap device)|" + |
| 991 | + # Group 8 |
| 992 | + "(Edit)|" + |
| 993 | + # Group 9 |
| 994 | + "(Configure the network)|" + |
| 995 | + # Group 10 |
| 996 | + "(Edit the fstab)|" + |
| 997 | + # Group 11 |
| 998 | + "(Use verbose listing for extractions)|" + |
| 999 | + # Group 12 |
| 1000 | + "(or local)|" + |
| 1001 | + # Group 13 |
| 1002 | + "(Is the file-system with the install sets already mounted)|" |
| 1003 | + # Group 14 |
| 1004 | + "(Which is the disk with the installation sets)|" + |
| 1005 | + # Group 15 |
| 1006 | + "(Partition)|" + |
| 1007 | + # Group 16 |
| 1008 | + "(Which filesystem type)|" + |
| 1009 | + # Group 17 |
| 1010 | + "(Continue extraction)|" + |
| 1011 | + # Group 18 |
| 1012 | + "(or all)|" + |
| 1013 | + # Group 19 |
| 1014 | + "(Extract more sets)|" + |
| 1015 | + # Group 20 |
| 1016 | + "(What timezone are you in)|" + |
| 1017 | + # Group 21 |
| 1018 | + "(Should a boot block be installed)|" |
| 1019 | + # Group 22 |
| 1020 | + "(the installer will restart itself)|", |
| 1021 | + 10800) |
| 1022 | + if child.match.group(1): |
| 1023 | + child.send("6\n") |
| 1024 | + elif child.match.group(2): |
| 1025 | + child.send("I\n") |
| 1026 | + elif child.match.group(3) or child.match.group (7) or child.match.group(11): |
| 1027 | + child.send("y\n") |
| 1028 | + elif child.match.group(4) or child.match.group(6) or child.match.group(17) |
| 1029 | + or child.match.group(20) or child.match.group(21): |
| 1030 | + child.send("\n") |
| 1031 | + elif child.match.group(5) or child.match.group(14): |
| 1032 | + child.send("wd0\n") |
| 1033 | + elif child.match.group(8) or child.match.group(9) or child.match.group(10) |
| 1034 | + or child.match.group(13) or child.match.group(19): |
| 1035 | + child.send("n\n") |
| 1036 | + elif child.match.group(12) or child.match.group(15): |
| 1037 | + child.send("d\n") |
| 1038 | + elif child.match.group(16): |
| 1039 | + child.send("cd9660\n") |
| 1040 | + elif child.match.group(18): |
| 1041 | + child.send("all\n") |
| 1042 | + elif child.match.group(22): |
| 1043 | + child.expect("(#)|(halting machine)|(halted by root)") |
| 1044 | + if child.match.group(1): |
| 1045 | + # Root shell prompt |
| 1046 | + child.send("halt\n") |
| 1047 | + else: |
| 1048 | + break |
| 1049 | + else: |
| 1050 | + raise AssertionError() |
| 1051 | + child.close() |
| 1052 | + # Make sure all refs go away |
| 1053 | + child = None |
| 1054 | + self.child = None |
| 1055 | + os.unlink(wd1_path) |
| 1056 | + os.unlink(rdb_conf) |
| 1057 | + self.dist.cleanup() |
| 1058 | + |
| 1059 | + def install_sysinst(self): |
914 | 1060 | # Download or build the install ISO |
915 | 1061 | self.dist.set_workdir(self.workdir) |
916 | 1062 | if self.dist.arch() == 'evbarm-earmv7hf': |
@@ -1600,7 +1746,10 @@ def install(self): |
1600 | 1746 | if os.path.exists(self.wd0_path()): |
1601 | 1747 | return |
1602 | 1748 | try: |
1603 | | - self._install() |
| 1749 | + if self.dist.arch() == 'amiga': |
| 1750 | + self.install_amiga() |
| 1751 | + else: |
| 1752 | + self.install_sysinst() |
1604 | 1753 | except: |
1605 | 1754 | if os.path.exists(self.wd0_path()): |
1606 | 1755 | os.unlink(self.wd0_path()) |
|
0 commit comments