Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | ============================================================================= |
2 | Instructions for OpenSPARC T2 Version 1.1 SPARC Architecture Model (SAM) | |
3 | ============================================================================= | |
4 | ||
5 | 1. Set up SAM | |
6 | ||
7 | Create a directory for installing SAM and change to that directory. | |
8 | ||
9 | e.g. | |
10 | ||
11 | mkdir -p /home/johndoe/OpenSPARC_SAM_work | |
12 | cd /home/johndoe/OpenSPARC_SAM_work | |
13 | ||
14 | copy the SAM package tarball into the directory | |
15 | and untar it. | |
16 | ||
17 | Setup environment variables by editing OpenSPARCT2_SAM.cshrc file. | |
18 | ||
19 | Please set the following variables in OpenSPARCT2_SAM.cshrc file | |
20 | ||
21 | SIM_ROOT Directory location where you Extracted | |
22 | the OpenSPARCT2_Arch_1.0.tar file. e.g. | |
23 | /home/johndoe/OpenSPARCT2_SAM | |
24 | ||
25 | SUN_STUDIO Directory location for Sun Studio installation | |
26 | e.g. /usr/dist/pkgs/sunstudio_sparc/SUNWspro | |
27 | ||
28 | Source the environment variable file above by using following command : | |
29 | ||
30 | source OpenSPARCT2_SAM.cshrc | |
31 | ||
32 | You may want to add the above command to your ~/.cshrc file, so that | |
33 | every time you login, it will source the above file. | |
34 | ||
35 | ||
36 | 2. Compile/build for RTL verification cosimulation : | |
37 | ||
38 | cd $SIM_ROOT/sam-t2/sam | |
39 | ||
40 | On a SPARC machine: | |
41 | make n2-cosim-pkg | |
42 | ||
43 | On a x86 machine: | |
44 | make ARCH=amd64 n2-cosim-pkg | |
45 | ||
46 | A nas,5.n2.opens.$USER directory will be created in the working directory, | |
47 | copy/move the directory to the proper RTL verification tool area, to be | |
48 | used in RTL verification. | |
49 | ||
50 | ||
51 | 3. Compile/build a full-system simulator : | |
52 | ||
53 | cd $SIM_ROOT/sam-t2/sam | |
54 | ||
55 | On a SPARC machine: | |
56 | make n2 | |
57 | ||
58 | On a x86 machine: | |
59 | make ARCH=amd64 n2 | |
60 | ||
61 | a install-n2 directory will be created in the working directory, which | |
62 | contains the binary files for a SAM full-system simulator. | |
63 | ||
64 | ||
65 | 4. Run SAM full-system simulator : | |
66 | ||
67 | Assuming you create a test directory $SIM_ROOT/test | |
68 | ||
69 | A. Set up Solaris boot files | |
70 | ||
71 | cd $SIM_ROOT/test | |
72 | $SIM_ROOT/sam-t2/sam/install-n2/bin/getsolaris \ | |
73 | -d $SIM_ROOT/sam-t2/config -v int12 -p n2 int12 | |
74 | ||
75 | This will create an int12 directory with all the related boot | |
76 | files in it. Change to that directory and run. | |
77 | ||
78 | ------------------------------------------------------------------- | |
79 | NOTE - "-d" option in getsolaris command must have absolute path. | |
80 | Relative path will not work. | |
81 | ------------------------------------------------------------------- | |
82 | ||
83 | cd $SIM_ROOT/test/int12 | |
84 | $SIM_ROOT/sam-t2/sam/install-n2/bin/simulate -c 1c1t -s -w 1 | |
85 | ||
86 | This will run a 1c1t configuration on one physical cpu. Available | |
87 | configurations are 1c1t, 1c2t, 1c8t, 2c8t, 4c8t, 8c8t. | |
88 | ||
89 | ------------------------------------------------------------------ | |
90 | NOTE - "getsolaris" command above will copy boot files from | |
91 | $SIM_ROOT/sam-t2/config/n2/solaris directory. If you have generated | |
92 | new binaries for reset, hypervisor, and/or OBP, then please copy | |
93 | those new binary images to $SIM_ROOT/sam-t2/config/n2/solaris | |
94 | directory so that SAM sees those new versions. | |
95 | ||
96 | You can use "setup_sam.sh" script provided in $SIM_ROOT/bin for | |
97 | this task. | |
98 | ------------------------------------------------------------------ | |
99 | ||
100 | B. This will run SAM which will pop-up two windows called "Guest Console" | |
101 | and "Hypervisor Console". | |
102 | ||
103 | C. From Sam Console's command prompt type 'run'. Shortly after, an 'ok' | |
104 | prompt will come up in the "Guest Console". | |
105 | ||
106 | Available user commands can be found at sam-t2/sam/docs/ui-cmds, | |
107 | a good starting point is the index.html file there. | |
108 | ||
109 | D. When 'ok' prompt shows up in "Guest Console", type | |
110 | boot vdisk | |
111 | or to display more informaiton during booting | |
112 | boot vdisk -vV | |
113 | ||
114 | E. When 'login:' prompt shows up in "Guest Console", type 'root', | |
115 | no password is needed. Now you are in Solaris as root. | |
116 | ||
117 | F. Type help from Sam Console's command prompt to learn the | |
118 | available commands for controlling the simulator. | |
119 | ||
120 | G. To generate a instruction trace file, do the following from | |
121 | Sam Console: | |
122 | stop | |
123 | mod load analyzer rstracer.so | |
124 | rstrace -o <outputfile> -n <number_of_instructions> | |
125 | run (or stepi <number_of_instructions>) | |
126 | stop | |
127 | mod unload analyzer | |
128 | ||
129 | The generated trace file can be viewed by trconv in bin directory. | |
130 | In general the trace files are compressed, the rstzip in bin | |
131 | directory can be used to unzip the files. In case rstzip | |
132 | encounters stacksize problem, try 'ulimit -s 1048576' | |
133 | (or if using csh 'unlimit stacksize') to increase stacksize. | |
134 | ||
135 | H. To generate a checkpoint for later restore purpose, enter the command | |
136 | ||
137 | dump <dirname> | |
138 | ||
139 | from Sam Console, the command will create a checkpoint (directory). | |
140 | The checkpoint data can then be restored by starting the sam simulator | |
141 | with -R option. | |
142 | ||
143 | When restore from a checkpoint, do not enter any command until the message | |
144 | "----- RESTORE COMPLETED -----" shows up. | |
145 | ||
146 | NOTE: when generating checkpoint, make sure you don't have commands like | |
147 | 'run' or 'stepi' in the config file (e.g., sam.rc) | |
148 | ||
149 | ||
150 | 5. Run SAM full-system simulator with Serial Attached SCSI driver (SAS) | |
151 | ||
152 | Assuming you create a test directory /home/johndoe/OpenSPARC_SAM_work/test | |
153 | ||
154 | A. Set up Solaris boot files | |
155 | ||
156 | cd $SIM_ROOT/test | |
157 | $SIM_ROOT/sam-t2/sam/install-n2/bin/getsolaris -d $SIM_ROOT/sam-t2/config -v sasdisk -p n2 sasdisk | |
158 | ||
159 | This will create an sasdisk directory with all the sas related boot | |
160 | files in it. Change to that directory and run. | |
161 | ||
162 | cd $SIM_ROOT/test/sasdisk | |
163 | $SIM_ROOT/sam-t2/sam/install-n2/bin/simulate -c 1c1t -s -w 1 -I system.rc | |
164 | ||
165 | This will run a 1c1t configuration on one physical cpu. Available | |
166 | configurations are 1c1t, 1c2t, 1c8t, 2c8t, 4c8t, 8c8t. | |
167 | ||
168 | The other steps are similar to Section 4 above, except step D, where | |
169 | the following boot command should be used: | |
170 | ||
171 | boot /pci@0/pci@0/pci@0/scsi@0/disk@0,0:c -vV | |
172 | ||
173 | Another new feature in this setup is the Local Loopback File System | |
174 | driver (llfs), llfs allows users to move files in and out of a | |
175 | simulated system. After login as described in step E, /ll/root is | |
176 | where the file system of the underlying real machine is mounted, any | |
177 | modification to a file under /ll/root or its subdirectories will have | |
178 | immediate effect on the real file. For example, from within a simulated | |
179 | system, one can modify files in | |
180 | ||
181 | /ll/root/home/johndoe/OpenSPARC_SAM_work/sam-t2 | |
182 | ||
183 | which will have the same effect as modify files in | |
184 | ||
185 | /home/johndoe/OpenSPARC_SAM_work/sam-t2 | |
186 | ||
187 | from a real machine. | |
188 | ||
189 | ||
190 | 6. Save a modified disk image | |
191 | ||
192 | When booting up a Solaris disk image, the SAM full-system simulator | |
193 | will display a message about the loaded disk image: | |
194 | ||
195 | UI(load): loading <disk1> memory image ... | |
196 | loading disk1, base addr 0x0000001f40000000, size 0x20000000 | |
197 | ||
198 | Remember the address and size, they will be needed in saving the content | |
199 | of the disk image to a new file (by using memdump command). | |
200 | ||
201 | After the simulated system is booted up, new file can be created in the | |
202 | system, or existing file can be modified. The 'memdump' command can then | |
203 | be used to save those changes. | |
204 | ||
205 | Before issuing the 'memdump' command, the simulated system's file system | |
206 | must be synced up first, to achieve that, enter the command 'sync' from the | |
207 | simulated system's shell prompt, followed by a 'halt' command. Wait until | |
208 | the following messages are displayed: | |
209 | ||
210 | syncing file systems... done | |
211 | Program terminated | |
212 | ||
213 | At this point, enter 'stop' from sam command console, followed by 'memdump' | |
214 | command, e.g., | |
215 | ||
216 | memdump disk.memdump 0x1f40000000 0x20000000 | |
217 | ||
218 | Do not issue other command until the message "----- MEMDUMP COMPLETED -----" | |
219 | is displayed. The created memdump file can then be examined (and move file | |
220 | in/out of it), by using lofiadm/mount commands on a real Solaris system. | |
221 | The new disk image can also be used for Solaris bootup. |