File: machine_rpi.html

package info (click to toggle)
gxemul 0.7.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,152 kB
  • sloc: ansic: 111,065; sh: 972; exp: 354; makefile: 118
file content (179 lines) | stat: -rw-r--r-- 4,701 bytes parent folder | download | duplicates (3)
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <title>GXemul: Raspberry Pi emulation</title>
  <meta name="robots" content="noarchive,nofollow,noindex">
</head>
<body style="font-family : sans-serif;">

<!-- 10 lines header.  -->

<h1>GXemul: Raspberry Pi emulation</h1>
<p>

<a href="./">Back to the index.</a>

<!--

Copyright (C) 2006-2019  Anders Gavare.  All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright
   notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
   notice, this list of conditions and the following disclaimer in the
   documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

-->



<p>The Raspberry Pi emulation is not working yet. This page
contains preliminary instructions for how to start debugging NetBSD,
FreeBSD, or HelenOS.</p>








<p><br>
<a name="netbsdrpi"></a>
<h3>NetBSD/raspberrypi:</h3>

<p><font color="red">This doesn't work yet.</font>

<p>Starting point for development:

<p>See <a href="http://wiki.netbsd.org/ports/evbarm/raspberry_pi/">http://wiki.netbsd.org/ports/evbarm/raspberry_pi/</a> for more info on NetBSD.

<p>To start debugging/development:
<ol>
	<li>Download something similar to:<pre>
	http://nyftp.netbsd.org/pub/NetBSD-daily/HEAD/201310032210Z/evbarm/binary/kernel/netbsd-RPI.gz
</pre>
	<li><tt><b>gxemul -tviK -E rpi netbsd-RPI.gz</b></tt>
</pre>
</ol>

<p>TODO: Everything.

<pre>
GXemul> u
&lt;kernel_text&gt;
c00081e0:  e10f1000	mrs	r1,CPSR
c00081e4:  e166f001	msr	SPSR_sx,r1
c00081e8:  e28f1048	add	r1,pc,#0x48
c00081ec:  e8912106	ldmia	r1,{r1,r2,r8,sp}
c00081f0:  ee0d8f90	mcr	15,0,r8,cr13,cr0,4

It starts up in kernel_text, which is in NetBSD usr/src/sys/arch/arm/arm32/locore.S:

ENTRY_NP(kernel_text)

ASENTRY_NP(start)
        mrs     r1, cpsr                /* fetch CPSR value */
        msr     spsr_sx, r1             /* set SPSR[23:8] to known value */

        adr     r1, .Lstart
        ldmia   r1, {r1, r2, r8, sp}    /* Set initial stack and */

#if defined(TPIDRPRW_IS_CURCPU) || defined(TPIDRPRW_IS_CURLWP)
        mcr     p15, 0, r8, c13, c0, 4
#endif
#if defined(TPIDRPRW_IS_CURLWP)
        ldr     r8, [r8, #L_CPU]        /* r8 needs curcpu in it */
#endif

        mov     r4, #0
#ifdef _ARM_ARCH_DWORD_OK
        mov     r5, #0
#endif

</pre>

<p>
Also useful for testing:
<pre>https://github.com/raspberrypi/firmware/blob/master/boot/kernel.img
<b>gxemul -tvK -E rpi 0x00000000:kernel.img</b>
</pre>




<p><br>
<a name="freebsdrpi"></a>
<h3>FreeBSD:</h3>

<p><font color="red">Dummy mode so far.</font>

<p>FreeBSD sd card image:

<pre>
http://www.db.net/downloads/bsd-pi-250580M.img.xz
# Extract the kernel from the second (2) slice' first partition (a):
mdconfig -a -t vnode -f bsd-pi-250580M.img
mount /dev/md0s2a /mnt/
cp /mnt/boot/kernel/kernel* .
umount /mnt
mdconfig -d -u 0
<b>gxemul -tK -E rpi kernel</b>
</pre>


</p>





<p><br>
<a name="helenosrpi"></a>
<h3>HelenOS/rpi:</h3>

<p><font color="red">The Raspberry Pi mode in GXemul is just a dummy so far.</font>

<p>These instructions are used as a reminder for me when I wish
to experiment with the HelenOS kernel:

<p>
<ol>
  <li>Download the HelenOS kernel:<pre>
	<a href="http://www.helenos.org/releases/HelenOS-0.7.2-arm32-raspberrypi.bin">http://www.helenos.org/releases/HelenOS-0.7.2-arm32-raspberrypi.bin</a>
  </pre>
  <li>Start GXemul using the following command line:<pre>
  	<b>gxemul -VE rpi -tv 0x8000:0x40:0x8000:HelenOS-0.7.2-arm32-raspberrypi.bin</b>
  </pre>
</ol>






<p><br>



</body>
</html>