tisdag 1 oktober 2019

option OSS requires SDL_AUDIO

Trying to compile SDL20 I got the following message. It took a while before I realized that this wasn't a library that I needed to install, I needed to reconfigure SDL20 to add the SDL_AUDIO option.
To do that I simply ran "make config" in the SDL20 port directory and added SDL_AUDIO.

FreeBSD: X needs Python 3.5 at least, but 2.7 was specified.

When trying to compile using the ports system, the error message that something needs Python 3.x, but 2.7 was specified is quite common.
This is due to the ports system "remembering" the python version that was specified by a top level package, while a dependency may require something else.

The solution is to manually compile the dependency first.

In my case I was trying to build sdl_sound, but it failed due to meson-0.51.2 needs Python 3.5 at least, but 2.7 was specified.
To fix this I compile meson first, then I go back and compile sdl_sound.

söndag 22 september 2019

Avoid configuration prompts when installing freebsd ports

When installing ports with many dependencies, repeatedly stopping the compilation to show a configuration prompt is annoying, especially if you want the default values. This can be avoided in a couple of ways.

When installing a port, adding either of these batch flag uses default.
make install BATCH=YES
make install -DBATCH

The batch flag can also be set as an environment variable.
export BATCH=yes

What if you want to configure everything first and then compile?
make config-recursive
Remember that this command needs to be run many times until all configuration has been performed.

Sources:
1 unix.stackexchange.com
2 unix.stackexchange.com

Get octal permissions for files.

Sometimes it would be nice to read the permissions in octal, not only set it in octal.
This can be done using the stat tool.

This command will list all files/folders and their octal permission.
stat -c "%a %n" *

-c is for specifying the display format.
%a is the octal permission and %n is the file name.

Source: AskUbuntu.com

söndag 11 december 2016

error while loading shared libraries: libtorrent.so.19

After compiling rtorrent on Ubuntu 16.04 I got the following error message:
rtorrent: error while loading shared libraries: libtorrent.so.19: cannot open shared object file: No such file or directory

The solution was to add the following to /etc/ld.so.conf
include /usr/local/lib

Then after doing that run
ldconfig

Source: Ubuntu Forums

fredag 18 november 2016

Raspbian upgrade from wheezy to Jessie hangs on Started Permit User Sessions.

After I upgraded from wheezy to jessie my Raspberry refused to boot. It was stuck on Started Permit User Sessions.
The solution is in editing the cmdline.txt at /boot

I changed mine from this:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait fbcon=map:10 fbcon=font:VGA8x8 plymouth.enable=0

to this:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootdelay=10 rootwait usbhid.mousepoll=0 init=/lib/sysvinit/init

After reading at the Raspberry forums and it booted fine again.

måndag 14 november 2016

Hårdvaruarkitektur i Raspberry Pi 1

På många hemsidor kan man läsa om att Raspberry Pi har en teoretisk busshastighet på 60MB/s. Detta är en väldigt grov förenkling som är baserad på att Raspberry Pi har en USB 2.0-kanal, denna är på 480mbit = 60MB/s.

Tittar man i dokumentationen står det så här;
The bus interface provides high bandwidth connections between the processor, second level caches, on-chip RAM, peripherals, and interfaces to external memory.
There are separate bus interfaces for:
*instruction fetch, 64-bit data
*data read/write, 64-bit data
*peripheral access, 32-bit data
*DMA, 64-bit data.

Bus clock speeds
The bus interface ports operate synchronously to the CPU clock if IEM is not implemented.

Huruvida IEM är implementerat på Raspberry Pi vågar jag inte svara på, men jag gissar på att det inte är det. Man har velat hålla priset så lågt som möjligt och det finns många rapporter på att de som överklockat sin Pi fått datakorruption.

Utgår man från att IEM är av, kan man dra följande slutsats;

Bussen mot ram är
5600MB/s = 700MHz * 64 bitar / 8 bitar

Bussen mot peripheral är
2800MB/s = 700MHz * 64 bitar / 8 bitar

De peripherals som Raspberryn har är GPIO-portar, SD-kortsläsare, USB och nätverk.

pi@raspberrypi ~ $ lsusb -t
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
|__ Port 1: Dev 2, If 0, Class=hub, Driver=hub/3p, 480M
|__ Port 1: Dev 3, If 0, Class=vend., Driver=smsc95xx, 480M

Här kan vi se att det finns en intern USB-port i Raspberryn, denna delas sedan med ett kombinerat USB-hubb och nätverkschipp. Nätverkschippet sitter alltså anslutet på en USB-hubb som i sin tur sitter ansluten i den enda USB-porten. Detta förklarar varför den billiga Raspberry-modellen utan nätverk bara har en USB-port.

Den totala USB-bandbredden är 480mbit, vilket ger 60MB i teorin. I praktiken är teoretisk USB-throughput runt 53MB/s, men implementationerna är oftast så mycket sämre att man inte ska förvänta sig mer än runt ~30MB/s. Läs mer om detta här: http://electronics.stackexchange.com/questions/24700/why-are-usb-devices-slower-than-480-mbit-s


Raspberryn har ett minneschip anslutet. Detta är LPDDR2 från antingen Hynix eller Samsung och kör som standard 400MHz.
Båda modellerna av minnen är specade till 400MHz och 32bitar

3200MB/s = 800MHz * 32 bitar / 8 bitar

Detta resultat kan även verifieras mot följande benchmark:
https://panthema.net/2013/pmbw/RaspberryPi-ModelB/
Här är den sekventiella topprestandan som går att få ut ~1.17GB/s.
Tittar man på memset i tinymembench får man liknande siffror.

Dessa siffror tyder på en väldigt låg effektivitet på runt 35%.



Hynix: H9TKNNN4GDMP LRNDM 800MHz (400MHz)
http://www.hynix.com/inc/pdfDownload.jsp?path=/datasheet/Databook/Databook_MobileMemory.pdf

Samsung: K4P4G324EB-AGC1
http://www.samsung.com/global/business/semiconductor/html/common/file/support/part_number_decoder/Mobile_SDR_DDR_code.pdf

https://panthema.net/2013/pmbw/RaspberryPi-ModelB/
http://www.memetic.org/raspberry-pi-overclocking/
http://elinux.org/RPiconfig#Overclocking_options
http://www.petervis.com/Raspberry_PI/Raspberry_Pi_Model_B_512MB_RAM_Revision_2/K4P4G324EB.html


http://www.irongeek.com/i.php?page=security/svartkast-pogoplug-dropbox


Jag jämför tre system, ett Core 2 Duo med dualchannel, ett Atomsystem med single channel, samt en överklockad Raspberry.

Tittar vi på tiny membench sedan ser vi att skillnaden är långt mycket större än så.
Oftast har Raspberry Pi runt en tiondel av C2D-maskinen kan få ut.

För memset kan man se att Raspberryn når upp en effektivitet på ~18% medan C2D-systemet når runt ~40% och Atomsystemet drygt 55%.

C2D - DDR2 667MHz, 128bit - 10.6GB/s
C copy backwards : 1420.2 MB/s (1.3%)
C copy : 1413.9 MB/s (0.9%)
C copy prefetched (32 bytes step) : 1425.8 MB/s (1.0%)
C copy prefetched (64 bytes step) : 1432.0 MB/s (1.5%)
C 2-pass copy : 1309.2 MB/s (3.4%)
C 2-pass copy prefetched (32 bytes step) : 1359.3 MB/s
C 2-pass copy prefetched (64 bytes step) : 1365.6 MB/s (1.9%)
C fill : 1932.5 MB/s (2.2%)
---
standard memcpy : 2067.2 MB/s (1.0%)
standard memset : 4125.7 MB/s (0.5%)

RPi DDR2 1000MHz, 32bit, - 4GB/s
C copy backwards : 92.4 MB/s (7.1%)
C copy : 131.7 MB/s (6.4%)
C copy prefetched (32 bytes step) : 187.3 MB/s (10.2%)
C copy prefetched (64 bytes step) : 188.4 MB/s (1.4%)
C 2-pass copy : 115.0 MB/s (13.6%)
C 2-pass copy prefetched (32 bytes step) : 133.7 MB/s (8.8%)
C 2-pass copy prefetched (64 bytes step) : 146.3 MB/s (8.6%)
C fill : 450.3 MB/s (1.5%)
---
standard memcpy : 205.0 MB/s (3.0%)
standard memset : 721.3 MB/s (1.8%)

Atom N450 DDR2 667MHz, 64bit - 5.3GB/s
C copy backwards : 1186.6 MB/s
C copy : 1183.7 MB/s
C copy prefetched (32 bytes step) : 1015.0 MB/s
C copy prefetched (64 bytes step) : 1014.8 MB/s
C 2-pass copy : 1203.6 MB/s
C 2-pass copy prefetched (32 bytes step) : 898.5 MB/s
C 2-pass copy prefetched (64 bytes step) : 898.4 MB/s
C fill : 1520.9 MB/s (0.2%)
---
standard memcpy : 1670.0 MB/s (0.3%)
standard memset : 3028.3 MB/s



http://code.google.com/p/flashfire/