What is happening in Ubuntu?

Just look at the following spawned processes:


     \_ init --user
         \_ dbus-daemon --fork --session --address=unix:abstract=/tmp/dbus-QUZeqof8X5
         \_ upstart-event-bridge
         \_ /usr/lib/x86_64-linux-gnu/hud/window-stack-bridge
         \_ /usr/lib/x86_64-linux-gnu/bamf/bamfdaemon
         \_ upstart-dbus-bridge --daemon --session --user --bus-name session
         \_ upstart-file-bridge --daemon --user
         \_ upstart-dbus-bridge --daemon --system --user --bus-name system
         \_ /usr/lib/at-spi2-core/at-spi-bus-launcher
         |   \_ /bin/dbus-daemon --config-file=/etc/at-spi2/accessibility.conf --nofork --print-address 3
         \_ /usr/lib/at-spi2-core/at-spi2-registryd --use-gnome-session
         \_ /usr/lib/gvfs/gvfsd
         \_ /usr/lib/gvfs/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
         \_ /usr/bin/ibus-daemon --daemonize --xim
         |   \_ /usr/lib/ibus/ibus-dconf
         |   \_ /usr/lib/ibus/ibus-ui-gtk3
         |   \_ /usr/lib/ibus/ibus-engine-simple
         \_ /usr/lib/unity-settings-daemon/unity-settings-daemon
         \_ /usr/lib/ibus/ibus-x11 --kill-daemon
         \_ /usr/lib/x86_64-linux-gnu/hud/hud-service
         \_ gnome-session --session=ubuntu
         |   \_ compiz
         |   \_ /usr/lib/unity-settings-daemon/unity-fallback-mount-helper
         |   \_ nautilus -n
         |   \_ /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1
         |   \_ nm-applet
         |   \_ /opt/google/chrome/chrome --type=service
         |   \_ telepathy-indicator
         |   \_ zeitgeist-datahub
         |   \_ update-notifier
         \_ /usr/lib/unity/unity-panel-service
         \_ /usr/lib/x86_64-linux-gnu/indicator-keyboard-service --use-gtk
         \_ /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service
         \_ /usr/lib/x86_64-linux-gnu/indicator-bluetooth/indicator-bluetooth-service
         \_ /usr/lib/x86_64-linux-gnu/indicator-power/indicator-power-service
         \_ /usr/lib/x86_64-linux-gnu/indicator-datetime/indicator-datetime-service
         \_ /usr/lib/x86_64-linux-gnu/indicator-sound/indicator-sound-service
         \_ /usr/lib/x86_64-linux-gnu/indicator-printers/indicator-printers-service
         \_ /usr/lib/x86_64-linux-gnu/indicator-session/indicator-session-service
         \_ /usr/lib/x86_64-linux-gnu/indicator-application/indicator-application-service
         \_ /usr/lib/evolution/evolution-source-registry
         \_ /usr/lib/x86_64-linux-gnu/notify-osd
         \_ /usr/lib/evolution/evolution-calendar-factory
         \_ /usr/lib/dconf/dconf-service
         \_ /usr/lib/gvfs/gvfs-udisks2-volume-monitor
         \_ /usr/lib/x86_64-linux-gnu/gconf/gconfd-2
         \_ /usr/lib/gvfs/gvfs-mtp-volume-monitor
         \_ /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
         \_ /usr/lib/gvfs/gvfs-afc-volume-monitor
         \_ /usr/lib/gvfs/gvfsd-trash --spawner :1.9 /org/gtk/gvfs/exec_spaw/0
         \_ /usr/lib/gvfs/gvfsd-burn --spawner :1.9 /org/gtk/gvfs/exec_spaw/1
         \_ /usr/lib/gvfs/gvfsd-metadata
         \_ /usr/lib/telepathy/mission-control-5
         \_ /usr/bin/zeitgeist-daemon
         \_ /usr/lib/x86_64-linux-gnu/zeitgeist-fts
         |   \_ /bin/cat
         \_ gnome-terminal
             \_ gnome-pty-helper
             \_ bash
                 \_ ps auxwf

These processes are created simply just by logging in passed the Gnome session authentication prompt. No applications other than the gnome-terminal is started yet.

Yet, applications like Chrome can already start by itself.

Frankly this is getting really bloated, and sounds more like trojans than ever.

A study in modern computer cache

http://en.wikipedia.org/wiki/Cache_coherence

http://en.wikipedia.org/wiki/Memory_coherence

http://www.cs.iastate.edu/~prabhu/Tutorial/CACHE/mem_title.html

http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Memory/introCache.html

Simulator / Statistical generator:

http://www.ecs.umass.edu/ece/koren/architecture/Cache/frame2.htm

http://www.ece.northwestern.edu/~kcoloma/ece361/lectures/Lec14-cache.pdf

http://www.ece.ncsu.edu/arpers/Papers/HPCA07-TUTORIAL.pdf

https://s3-ap-southeast-1.amazonaws.com/erbuc/files/ed43d1e5-fb66-4ab4-b0ba-6444cd4071b0.pdf

https://3cs1204.files.wordpress.com/2014/01/shared-memory.pdf

and from above many other hardware theories:

https://goo.gl/imXKIz

Cache coherent protocol:

http://almakdi.com/uploads/3/4/1/4/3414215/1-3.pdf

and many other cache coherent stuff:

https://goo.gl/TKkhRy

http://rolfed.com/nehalem/nehalemPaper.pdf

http://anotacoes-ufpr.googlecode.com/svn/trunk/arquitetura/material_apoio/utexas-eua/11-Caches.pdf

http://research.microsoft.com:8082/pubs/173966/hashcache.pdf

This is an entire book on Computer Science:

https://github.com/ianw/bottomupcs

(or this: www.bottomupcs.com/csbu.pdf)

http://web.cs.swarthmore.edu/~kwebb/cs31/s15/bucs/memory.html

MIT cache related course notes:

https://goo.gl/wnXira

eg:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-172-performance-engineering-of-software-systems-fall-2010/video-lectures/lecture-4-computer-architecture-and-performance-engineering/

http://groups.csail.mit.edu/cag/ (MIT Computer Architecture Group)

Berkeley University related cache resources:

https://goo.gl/sgPyeX

These are cache related resources from CMU:

https://goo.gl/fJztpb

These are from Princeton:

https://goo.gl/aX2urj

And this one contains lots of advanced stuff:

http://www.csl.cornell.edu/courses/ece4750/handouts/

http://www.csl.cornell.edu/courses/ece4750/2013f/schedule.html

http://www.csl.cornell.edu/courses/ece4750/2013f/readings.html

http://rolfed.com/nehalem/nehalemPaper.pdf

https://www.youtube.com/watch?v=8dTMUigqBHM#t=353

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-823-computer-system-architecture-fall-2005/readings/

http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-823-computer-system-architecture-fall-2005/lecture-notes/

How to install STM32CubeMX in Ubuntu 14.04 LTS (64-bit)

First ensure wine is installed.

http://askubuntu.com/questions/459280/cant-install-wine-on-ubuntu-14-04

sudo add-apt-repository ppa:ubuntu-wine/ppa 
sudo apt-get update 
sudo apt-get install wine1.7

Next download Java JDK 7 version 45:

http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html#sjre-7u45-oth-JPR

(binary name is jdk-7u45-windows-x64.exe, 64-bit windows).

Install it inside Ubuntun host using wine “wine jdk-7u45-windows-x64.exe”.

Next download STM32CubeMX at st.com website (Details described here: http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/PF259242?icmp=stm32cubemx_pron_pr-stm32cubef2_apr2014&sc=stm32cube-pr2#):

stm32cubemx.zip

Unzip it, and install it using wine: “wine SetupSTM32CubeMX-4.7.0.exe”.

After that go to the wine directory and start up the STM32CubeMX executable directly:

cd home/tthtlc/.wine/drive_c/Program Files/STMicroelectronics/STM32Cube/STM32CubeMX

wine ./STM32CubeMX.exe

Click on “New Project”:

Ok, the rest is yours.

There is another way of getting STM32CubeMX is to install it as a Eclipse plugin:

Download it at: stsw-stm32095.zip

and then install the plugin into an existing machine whcih have Eclipse installed (Eclipse 64-bit Kepler SR-1, as the link below said):

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=https%3a%2f%2fmy.st.com%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fSTM32Java%2fSTM32CubeMX%20as%20Eclipse%20plugin%20on%20Linux%2064%20machine&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&currentviews=2430

Read here for all the important links for STM32 software for MCU programming:

https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/AllItems.aspx

http://regalis.com.pl/en/arm-cortex-stm32-gnulinux/

Another post on how to install STM32CubeMX (for windows) on Linux:

http://fivevolt.blogspot.sg/2014/07/installing-stm32cubemx-on-linux.html

For my STM32F4-Discovery (STM32F407VGT6):

Reference manual:

http://www.st.com/stonline/stappl/resourceSelector/app?page=fullResourceSelector&doctype=reference_manual&SubClassID=1169

Learning about nftables

Classic article: https://lwn.net/Articles/564095/

Main differences with iptables – nftables HOWTO

http://wiki.nftables.org/wiki-nftables/index.php/Main_differences_with_iptables

http://wiki.openwrt.org/doc/howto/netfilter

https://home.regit.org/2014/01/why-you-will-love-nftables/

http://www.slideshare.net/albertspijkers/red-hat-enterprise-linux-new-networking-features-and-tools
red-hat-enterprise-linux-new-networking-features-and-tools-59-638.jpg?cb=1424679621

Minnowmax Bootup using Buildroot

DSC_0140

First, download buildroot, and then make the buildroot image for Minnowmax:

make minnowboard_max_defconfig

After that, under buildroot’s “output” directory there is a images subdirectory. You can find bzImage and rootfs.tar there.

These are your kernel file, and rootfs tar file. Copy the kernel file, and you have to use root (“sudo”) to untar the rootfs.tar to your SDCard, so as to retain the uid/gid information as it originally it.

These instructions can be found further explained below (host machine is running Ubuntu 14.04 64-bit LTS):

http://git.buildroot.net/buildroot/commit/?id=8bc1b60a23a10ce197a33f6ed107c2d0a60f68b0

Prepare the SD card for the Minnow Board MAX

+ 1. Partition the SD card with a GPT partition table+
+ sudo cgdisk /dev/mmcblk0
+
+ Create two partitions:
+
+ a) First partition of a few dozens of megabytes, which will be
+ used to store the bootloader and the kernel image. Type must
+ be EF00 (EFI partition).
+
+ b) Second partition of any size, which will be used to store the
+ root filesystem. Type must be 8300 (Linux filesystem)
+
+ 2. Prepare the boot partition
+
+ We will format it, mount it, copy the EFI data generated by
+ Buildroot, and the kernel image.
+
+ sudo mkfs.vfat -F 32 -n boot /dev/mmcblk0p1
+ sudo mount /dev/mmcblk0p1 /mnt
+ sudo cp -a output/images/efi-part/* /mnt/
+ sudo cp output/images/bzImage /mnt/
+ sudo umount /mnt
+
+ 3. Prepare the root partition
+
+ We will format it, mount it, and extract the root filesystem.
+
+ sudo mkfs.ext4 -L root /dev/mmcblk0p2
+ sudo mount /dev/mmcblk0p2 /mnt
+ sudo tar -C /mnt -xf output/images/rootfs.tar
+ sudo umount /mnt
+

Connect the serial wire as shown below:

Serial Pinout for MINNOWMAX

Full dump of booting up:

http://pastebin.com/Ee8m5wRr

References:

http://buildroot.org/downloads/manual/manual.html

TIVA C Series TM4C1294 Connected LaunchPad Eval Kit programming via Energia

output

Procedure:

1. Host environment: Ubuntu 14.04 LTS 64-bit. Connect the debug port of Launchpad to the host machine via USB cable. Check “dmesg” and identify /dev/ttyACM0 as being automatically configured.

2. Download Energia (and untar it into a directory):

http://energia.nu/download/

3. Go to the Energia download directory, and enter “sudo ./energia”. Then File->Example->Basic->Blink to load the Blinker source code (as the example code). Then goto “Tool->Board” to select TM4C129 as the board. And next “Tool->Serial Port” to select /dev/ttyACM0 as the port, which is discovered through “dmesg”.

4. Compile and upload the example code, which will go to the TM4C1294 board automatically.

5. Looking into the console output you can see Energia executing under the hood:

[/home/tthtlc/Downloads/energia-0101E0014/hardware/tools/lm4f/bin/arm-none-eabi-g++, -Os, -nostartfiles, -nostdlib, -Wl,–gc-sections, -T, /home/tthtlc/Downloads/energia-0101E0014/hardware/lm4f/cores/lm4f/lm4fcpp_snowflake.ld, -Wl,–entry=ResetISR, -mthumb, -mcpu=cortex-m4, -mfloat-abi=hard, -mfpu=fpv4-sp-d16, -fsingle-precision-constant, -o, /tmp/build6614371312095748777.tmp/Blink.cpp.elf, /tmp/build6614371312095748777.tmp/Blink.cpp.o, /tmp/build6614371312095748777.tmp/core.a, -L/tmp/build6614371312095748777.tmp, /home/tthtlc/Downloads/energia-0101E0014/hardware/lm4f/cores/lm4f/driverlib/libdriverlib.a, -lm, -lc, -lgcc, -L/tmp/build6614371312095748777.tmp, -lm]

[/home/tthtlc/Downloads/energia-0101E0014/hardware/tools/lm4f/bin/arm-none-eabi-objcopy, -O, binary, /tmp/build6614371312095748777.tmp/Blink.cpp.elf, /tmp/build6614371312095748777.tmp/Blink.cpp.bin]

Binary sketch size: 2,380 bytes (of a 1,048,576 byte maximum)
Found ICDI device with serial: 0F000CFF
ICDI version: 12245

6. Now disassemble the binary (based on the console output above) using the following command:

/home/tthtlc/Downloads/energia-0101E0014/hardware/tools/lm4f/bin>./arm-none-eabi-objdump -d /tmp/build6614371312095748777.tmp/Blink.cpp.elf

The output is here: http://pastebin.com/VSP9GdEW

7. The disassembled codes can be read off as for example:

00000208 :
208: b508 push {r3, lr}
20a: 2101 movs r1, #1
20c: 2051 movs r0, #81 ; 0x51
20e: f000 f867 bl 2e0
212: f44f 707a mov.w r0, #1000 ; 0x3e8
216: f000 f8a9 bl 36c
21a: 2051 movs r0, #81 ; 0x51
21c: 2100 movs r1, #0
21e: f000 f85f bl 2e0
222: f44f 707a mov.w r0, #1000 ; 0x3e8
226: e8bd 4008 ldmia.w sp!, {r3, lr}
22a: f000 b89f b.w 36c
...

00000230 :
230: 4b26 ldr r3, [pc, #152] ; (2cc <pinMode+0x9c>)
232: 4a27 ldr r2, [pc, #156] ; (2d0 <pinMode+0xa0>)
234: b570 push {r4, r5, r6, lr}
236: 5c1d ldrb r5, [r3, r0]
238: 4b26 ldr r3, [pc, #152] ; (2d4 <pinMode+0xa4>)
23a: 5c1b ldrb r3, [r3, r0]
23c: f852 4023 ldr.w r4, [r2, r3, lsl #2]
240: 2b00 cmp r3, #0
242: d042 beq.n 2ca <pinMode+0x9a> 244: 4e24 ldr r6, [pc, #144] ; (2d8 <pinMode+0xa8>)
246: b911 cbnz r1, 24e <pinMode+0x1e> 248: 6833 ldr r3, [r6, #0]
24a: 6b9b ldr r3, [r3, #56] ; 0x38
24c: e03a b.n 2c4 <pinMode+0x94> 24e: 2902 cmp r1, #2
250: d116 bne.n 280 <pinMode+0x50> 252: 4b22 ldr r3, [pc, #136] ; (2dc <pinMode+0xac>)
254: f8c4 3520 str.w r3, [r4, #1312] ; 0x520

References:

http://embeddedcomputing.weebly.com/connected-launchpad-tiva-c-series-tm4c129.html

http://dduino.blogspot.sg/2013/10/using-tiva-c-launchpad-with-energia.html

http://humboldtmcu.blogspot.sg/2014/08/energia-using-eeprom-on-ti-stellaris_4.html

http://tronixstuff.com/tag/tiva-c/

http://www.ti.com/ww/en/launchpad/launchpads-connected-ek-tm4c1294xl.html

https://support.exosite.com/hc/en-us/articles/200778084-EK-TM4C1294XL-Connected-LaunchPad

http://processors.wiki.ti.com/index.php/Tiva_C_Series_TM4C1294_LaunchPad

http://www.ti.com/tool/sw-ek-tm4c1294xl

Getting Genode with TrustZone on the i.MX53 Quick Start Board

DSC_0124

First download the toolchain for ARM compilation, and then the Genode OS itself, all listed here:

http://sourceforge.net/projects/genode/files/

Details description of Genode and its installation are found here:

http://genode.org/documentation/developer-resources/getting_started

http://genode.org/documentation/release-notes/14.11

https://github.com/genodelabs/genode/blob/master/doc/getting_started.txt

Install all the necessary packages for Ubuntu 14.04 (present host):

apt-get install libSDL-dev
apt-get install libsdl1.2-dev -> shows it is already newest version
apt-get install tk8.5 tcl8.5
apt-get install expect
apt-get install byacc
apt-get install qemu
apt-get install genisoimage
sudo apt-get install expect
sudo apt-get install udisks

After untarring the genode toolchain /usr/local/genode-gcc directory, next is to untar the Genode OS download to “genode-14.11″.

With some assistance as documented here:

http://sourceforge.net/p/genode/mailman/message/33465225/

cd genode-14.11/
cd tool/

Listing all the hardware:

./create_builddir

‘linux_x86′
‘linux_arm’
‘fiasco_x86′
‘pistachio_x86′
‘okl4_x86′
‘nova_x86_32′
‘nova_x86_64′
‘codezero_vpb926′
‘hw_panda’
‘hw_vea9x4′
‘hw_vea9x4_tz’
‘hw_pbxa9′
‘hw_imx31′
‘hw_imx53′
‘hw_imx53_tz’
‘hw_arndale’
‘hw_odroid_xu’
‘hw_rpi’
‘foc_x86_32′
‘foc_x86_64′
‘foc_pbxa9′
‘foc_imx53′
‘foc_vea9x4′
‘foc_panda’
‘foc_arndale’
‘lx_hybrid_x86′

Now we set the hardware to be imx53:

./create_builddir hw_imx53_tz BUILD_DIR=build_imx53
cd build_imx53/

Setting up it for uboot as the bootloader:

echo "SPECS += trustzone" >> etc/specs.conf
echo "RUN_OPT = --target uboot" >> etc/build.conf
make run/tz_vmm

After this “uImage” is generated in the build_imx53/var/run.

Now, to download u-boot bootloader (and its ARM gcc compiler):

git clone https://github.com/m-stein/uboot uboot_stein

cd uboot_stein/

wget http://releases.linaro.org/14.09/components/toolchain/binaries/gcc-linaro-arm-none-eabi-4.9-2014.09_linux.tar.xz

Extract out the config file:

make ARCH=arm CROSS_COMPILE=/opt/gcc-linaro-arm-none-eabi-4.9-2014.09_linux/bin/arm-none-eabi- usbarmory_config

Now start the make process:

make ARCH=arm CROSS_COMPILE=/opt/gcc-linaro-arm-none-eabi-4.9-2014.09_linux/bin/arm-none-eabi- V=1

Notice a “u-boot.imx” is created. But first we need to format the sdcard.

(from hence onwards my sdcard is detected as /dev/sdg???):

Aim: make a sdcard from uImage, which will require uboot bootloader:

sudo parted /dev/sdg –script mklabel msdos

sudo parted /dev/sdg –script mkpart primary ext4 5M 100%

Upon completion, “dd” the u-boot.imx (which is meant for imx53 as the target) to the sdcard’s 3rd 512-block:

sudo dd if=./u-boot.imx of=/dev/sdg seek=2 bs=512 conv=fsync

Take a look at the partition:

sudo fdisk -l /dev/sdg

sudo mkfs.ext4 /dev/sdg1

Now /dev/sdg1 is ext4-formatted, mount it:

udisks –mount /dev/sdg1

Copy the uImage there to the rootfs:

cp uImage /media/371a8dd7-58c1-4beb-aed3-cb18fb40f7eb/

And umount it:

sudo udisks –umount /dev/sdg1

Now insert the sdcard into i.MX53QSB and connect via serial port, bootup message as follows:

U-Boot 2014.07-g0ca0b0f (Feb 20 2015 – 09:14:08)

Board: USB armory
I2C: ready
DRAM: 256 MiB
MMC: FSL_SDHC: 0, FSL_SDHC: 1
*** Warning – bad CRC, using default environment

In: serial
Out: serial
Err: serial
Net: CPU Net Initialization Failed
No ethernet found.
Hit any key to stop autoboot: 0

=> ext2ls
ext2ls – list files in a directory (default /)

Usage:
ext2ls <interface> <dev[:part]> [directory]
– list files from ‘dev’ on ‘interface’ in a ‘directory’

=> ext2ls mmc 0:1
<DIR> 4096 .
<DIR> 4096 ..
<DIR> 16384 lost+found
7860111 uImage

=> ext2load mmc 0:1 0x70200000 uImage
7860111 bytes read in 583 ms (12.9 MiB/s)

=> bootm 0x70200000
## Booting kernel from Legacy Image at 70200000 …
Image Name:
Image Type: ARM Linux Kernel Image (gzip compressed)
Data Size: 7860047 Bytes = 7.5 MiB
Load Address: 70010000
Entry Point: 70010000
Verifying Checksum … OK
Uncompressing Kernel Image … OK

Starting kernel …

kernel initialized
Genode 14.11
int main(): — create local services —
int main(): — start init —
int main(): transferred 246 MB to init
int main(): — init created, waiting for exit condition —
[init] Could not open file “ld.lib.so
[init] parent provides
[init] service “ROM”
[init] service “RAM”
[init] service “IRQ”
[init] service “IO_MEM”
[init] service “CAP”
[init] service “PD”
[init] service “RM”
[init] service “CPU”
[init] service “LOG”
[init] service “SIGNAL”
[init] service “VM”
[init] child “tz_vmm”
[init] RAM quota: 3932160
[init] ELF binary: tz_vmm
[init] priority: 0
[init -> tz_vmm] Start virtual machine …
undefined instruction

More debugging needed……

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: