File: Raspberry_Pi.txt

package info (click to toggle)
laserboy 2016.03.15-1.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 14,216 kB
  • ctags: 1,917
  • sloc: cpp: 45,305; makefile: 53
file content (240 lines) | stat: -rw-r--r-- 7,436 bytes parent folder | download
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
Even though I have been using Linux since about 1995, I'm still new to the Raspberry Pi, so some of this HOWTO does not come from years of experience, but rather what I was able to find in minutes on the web, that just happened to work for me, in the-here-and-now. So, take it for what it is worth!

This HOWTO assumes you are using the latest build of Raspbian Wheezy.

This HOWTO assumes you know a fair bit about Linux, in general, and presents a very terse guide for those who just want to get it going now. For anyone else, please feel free to contact me with questions and I will try to oblige.

First of all, you need to know how to become the root user. This is pretty much necessary for most of the following commands. So when I say, "get root", I mean find a command prompt, either on the Pi or via ssh into the Pi and issue the following command:

sudo su



Also, I happen to like 'joe' as a command-line text editor. So...
OK, let's go!


# --- Get root! ---
sudo su



I want you to be able to copy / paste these commands, one line at a time and follow that with the [enter] key, so I will not mess them up with unnecessary fake prompt junk.




# --- install the text editor joe ---
apt-get install joe




Install Boost C++. I bet there is a way smaller version of boost you could get to cover the needs of LaserBoy, but this is the whole enchilada!




# --- get boost libs ---
apt-get install libboost-all-dev
wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && chmod +x /usr/bin/rpi-update
apt-get install git-core
apt-get update
apt-get dist-upgrade
rpi-update 192
reboot




# --- get SDL libs ---
sudo su
apt-get install gcc build-essential libsdl1.2-dev
usermod -a -G video pi




# --- install samba ---
apt-get install samba
apt-get install samba-common-bin




# --- make a place for source code.
mkdir /home/pi/code
chown pi.pi /home/pi/code
chmod 777 /home/pi/code




# --- configure samba to share this place on a Windows workgroup share.
joe /etc/samba/smb.conf




Look for

workgroup = WORKGROUP

and edit this to be the name of your own Windows workgroup.




Uncomment

security = user




Uncomment

SO_RCVBUF=8192 SO_SNDBUF=8192
socket options = TCP_NODELAY




At the end of the text file smb.conf, add the following lines:

#--------------------------
[code]
comment = Pi code
path = /home/pi/code
writeable = Yes
only guest = No
create mask = 0777
directory mask = 0777
browseable = Yes
public = yes
#--------------------------





# --- restart and test the samba situation ---
service samba restart
testparm -s




# --- add the user pi to the smbpasswd file
smbpasswd -a pi




Now, from a Windows machine, you should be able to browse your Network Neighborhood and find the Pi! You should be able to open a folder window on the Pi and drag and drop stuff there. It will end up in /home/pi/code

Copy the latest version of the LaserBoy zip there and unzip it. You do not need to be root to do this.

# --- as the user pi, in a command prompt, navigate to /home/pi/code ---
unzip LaserBoy [Tab] ... blah blah blah version number ... [enter]



Once you have unzipped these files, you might want to edit them or otherwise fiddle or add to them from the outside and be able to move things in and out of the Windows workgroup shared folder from another machine.



To build the LaserBoy executable for the Pi, navigate to /home/pi/code/LaserBoy/src in a command prompt (either native or via SSH) and issue the following command:

time make

This will build all of the object files and link them together. It will also tell you exactly how long that process took. If you start from scratch and build the whole thing it should be just under 30 minutes.

Once the compile is done, back out of the src directory and issue the command

fbset

Not the resolution of the Linux Frame Buffer!

mode "1280x1024"
    geometry 1280 1024 1280 1024 16
    timings 0 0 0 0 0 0 0
    rgba 5/11,6/5,5/0,0/16
endmode

This example screen is 1280 pixels wide, 1024 high and each pixel takes 16 bits. The pixel resolution of the screen was chosen when the HDMI port detected the monitor. This is a 19 inch LCD monitor. Fortunately, it is not at all necessary to change the pixel resolution of the video system. The only thing that is of interests to change is the bits-per-pixel or color depth of the screen.

fbset -depth 24

This command sets the video display to be full 8 bits for each color channel of RGB.

The Pi supports 8, 16, 24 and 32 bits-per-pixel. LaserBoy runs in the console in any of these color depths. LaserBoy does not change the color depth. It uses it as it was set with fbset.

./LaserBoy 1280 1024

Will start LaserBoy in the whole screen of the console at native monitor resolution. You can also specify resolution that are smaller areas and the Pi video system will do its best to fill the screen. Don't try values that are larger than your screen. They either don't work at all or they can crash your video causing you to have to reboot your Pi.


If you have reason to believe that LB screen colors are all wrong, the RGB screen byte order might be off, depending on the version of Raspbian. Look for this block of code at the bottom of LaserBoy_macros.hpp.

#if defined __arm__ // Raspberry Pi 32 bit frame buffer
#undef     ALPHA_BIT_SHIFT
#undef     RED_BIT_SHIFT
#undef     GREEN_BIT_SHIFT
#undef     BLUE_BIT_SHIFT
#define    ALPHA_BIT_SHIFT                         24
#define    RED_BIT_SHIFT                            0
#define    GREEN_BIT_SHIFT                          8
#define    BLUE_BIT_SHIFT                          16
#endif

When I first wrote this HOWTO, this block was needed to get the bytes in the right order. As of RASPBIAN Debian Wheezy Version:February 2015 Release date:2015-02-16, this block of code is not needed and should be commented out, afterwhich you will need to recompile.


LaserBoy also runs in a window in the X GUI system. Go into the graphical desktop environment by issuing the command

startx

Open a terminal window and navigate to /home/pi/code/LaserBoy and issue the command

./LaserBoy 1200 800

In this command, the numbers 1200 800 are the width and height of the window that will open and be populated by the LaserBoy application. Feel free to adjust these values to suit your own particular needs. To exit the LaserBoy application, hit the [Esc] key and then answer y and y to the exit prompts.




By default The Pi is setup for 16 bit packed pixel video mode. If you want to see everything in 32 bit true color, you need to edit one of the files that get read before the Pi fully boots up. This is not necessary, as LaserBoy will run correctly in 16 bit packed pixel video. But, if you are adventurous and curious, this is how you do it.

# --- edit this file ---
joe /boot/config.txt


# --- add these lines to the file:
#--------------------------
framebuffer_depth=32
framebuffer_ignore_alpha=1
#--------------------------

reboot










If you have any questions, comments, suggestions or corrections, please feel free to contact me via email at james@akrobiz.com or join The LaserBoy Forum and send me a message.

http://laserboy.org/forum





4/14/2013
edit: 02/23/2015
James Lehman.