Universe in Computer
2015년 3월 7일 토요일
2015년 2월 14일 토요일
Amazon Fire TV Introduction
Last week, I bought the amazon fire TV.
My cubietruck is located in my living room, but TV is in the bed room.
So, I needed to additional device to play video stored in my cubietruck.
I searched many small embedded system which can play entertainment,
and I have decided to buy amazon fire TV.
Its price is more expensive than google chrome cast, and roku.
However, its processor is Snapdragon 600, and it supports 10/100 Mbps ethernet connection.
This is amazon fire TV's spec.
Its spec is quite high, but its price is not expensive.
One thing I want more is to change OS.
Its OS is Fire OS which is android modified version from amazon.
I can install some of android application,
but their controls are not easy.
However, I have installed XBMC, and I use it with much of fun.
I will introudce how I use amazon TV in later posts.
See you.


My cubietruck is located in my living room, but TV is in the bed room.
So, I needed to additional device to play video stored in my cubietruck.
I searched many small embedded system which can play entertainment,
and I have decided to buy amazon fire TV.
Its price is more expensive than google chrome cast, and roku.
However, its processor is Snapdragon 600, and it supports 10/100 Mbps ethernet connection.
This is amazon fire TV's spec.
| Operating system | Fire OS 3.0 "Mojito"[2] |
|---|---|
| System-on-chip used | Qualcomm Snapdragon 600APQ8064T[3] |
| CPU | Qualcomm Krait 300, quad-core to 1.7 Ghz[3] |
| Memory | 2 GB LPDDR2 RAM[3] |
| Storage | 8 GB internal[3] |
| Display | 1080p[3] |
| Graphics | Qualcomm Adreno 320[3] |
| Sound | Dolby Digital Plus 5.1 surround sound[3] |
| Connectivity | HDMI, Bluetooth 4.0, USB 2.0, Wi-Fi(802.11a/b/g/n), 10/100 Ethernet,Optical audio, Fire game controller[3] |
| Power | 5.5 mm DC[3] (6.25 V 2.5 A power adapter[4]) |
| Dimensions | 115 × 115 × 17.5 mm (4.53 × 4.53 × 0.69 in)[3] |
| Weight | 281 g (9.9 oz)[3] |
Its spec is quite high, but its price is not expensive.
One thing I want more is to change OS.
Its OS is Fire OS which is android modified version from amazon.
I can install some of android application,
but their controls are not easy.
However, I have installed XBMC, and I use it with much of fun.
I will introudce how I use amazon TV in later posts.
See you.


2014년 11월 16일 일요일
Setting Karlinux for ARM Build Environment
Introduction
I want to be a excellent linux kernel developer, so I have a plan to make my own linux kernel, karlinux. To simplify the work, the target of karlinux is only ARMv7 multicore. (If I have a time, I will extend it to ARMv8 multicore.)
My karlinux will be excuted on QEMU. QEMU is an emulator for a specific hardware, such as versatile, etc. By using QEMU, I can test my bootloader, linux kernel, and framework.
Today, I will explain how to set up environment for karlinux. I will set QEMU and print "Hello! World!" in karlinux.
Step 1: Install QEMU from source
At first, necessary package should be installed
sudo apt-get install libpixman-1-dev libglib2.0 zlib1g-dev libsdl-console-dev libncurses5-dev
I prefer to use Linaro's release, so I downloaded source code from Linaro.
wget https://launchpad.net/qemu-linaro/trunk/2014.01/+download/qemu-linaro-1.7.0-2014.01.tar.gzUnzip the tarball, and compile it.
tar xvf qemu-linaro-1.7.0-2014.01.tar.gz
Configure and build QEMU.
cd qemu-linaro-1.7.0-2014.01
mdkir build && cd build
sudo apt-get install flex bison
../configure --prefix=$PWD/../install --target-list=arm-softmmu --enable-debug
At this point, I got a problem of DTC. So, I downloaded DTC from its git, and manually installed. Download DTC
Extract the file and move it to qemu/dtc/, and compile dtc form source using make. For new DTC, restart configuring QEMU using previous command.
../configure --prefix=$PWD/../install --target-list=arm-softmmu --enable-debug
Install the generated QEMU binaries.
make install
For the last, add the path of qemu binaries to your environment variables.
vi /home/YOUR_ACCOUNT/.bashrc
export PATH=/home/YOUR_ACCOUNT/qemue-linao/qemu-linaro-1.7.0-2014.01/install/bin:$PATHYou may need to modify the path.
Step 2: Try ARM Linux prebuilt image on QEMU
Now, I will use QEMU to emulate Versatile Exporess, ARM's reference board for its Cortex-A processor.
First grab a system image for vexpress form Linaro's release site:
wget https://releases.linaro.org/images/12.02/oneiric/nano/vexpress-a9-nano.img.gz
gzip -d vexpress-a9-nano.img.gz
Note that -nano is one of Linaro's root filesystem. See here for details.
Since QEMU requires us to specify Linux kernel and init ramdisk in launching an emulated board, extract the two files from the downloaded image.
mkdir -p ~/tmp/boot/
sudo mount -o loop,offset=$((63*512)) vexpress-a9-nano.img ~/tmp/boot
Strip u-boot's header from uInitrd.
dd if=~/tmp/boot/uInitrd of=~/tmp/initrd skip=64 bs=1At this point, I'm ready to the emulated vexpress.
Use the following commands to start the ARM Linux inside the QEMU emulator.
qemu-system-arm -kernel ~/tmp/boot/uImage -M vexpress-a9 -cpu cortex-a9 -smp 4 -serial stdio -m 1024 -initrd ~/tmp/initrd -append 'root=/dev/mmcblk0p2 rw mem=1024M raid=noautodetect console=ttyAMA0,38400n8 rootwait vmalloc=256MB devtmpfs.mount=0' -sd vexpress-a9-nano.img
By using the command, linux window is shown up.
For test QEMU, I used vexpress a9, but my real target is vexpress a15. From the next post, I will modify the command for vexpress a15.
Enjoy your QEMU.
2014년 11월 8일 토요일
Use SSD as Rootfs of CT
Introduction
I had a redundant SSD, and I was worried about system size and speed of CT. So, I tried to use the SSD as rootfs. However, I don't use the SSD as rootfs any more, because their speeds are not quite different, and using SSD as extenal drive provides much more size. But, if you have small sd card, you can try it.
Step 1: Mount Current Rootfs on CT
At fisrt, mount the current rootfs. In my case, curenty rootfs is /dev/nand. It should be mounted at accessable directory, such as /tmp/src.
sudo su - root
mkdir /tmp/src
mount /dev/nandb /tmp/src
Also, we need to know where the SSD is. You can find the SSD by below commend
fdisk -lStep 2: Format and Mount SSD
We need to format the SSD and set the SSD as ext4 to use in linux system. My SSD is /dev/sda1 found from fdisk command.
mkfs ext4 /dev/sda1
We need to mount the SSD to some accessable directory, such as /tmp/dst.
mkdir /tmp/dst
mount /dev/sda1 /tmp/dst
Step 3: Copy Rootfs From Nand to SSD
By using belowd command, you can copy all data from nand to SSD. It will take more than 10 minutes. In my case, almost 30 minutes are taken.
(cd /tmp/src; tar --backup -c *) | tar -C /tmp/dst -xv
Step 4: Set Boot Partition
When you finish the copy, you have last job. Without this, your CT will boot from nand always. You need to change boot partition by changing uEnv.txt.
mkdir /tmp/boot
mount /dev/nanda /tmp/boot
cd /tmp/boot
vi uEnv.txt
There is one line /dev/nandb. It should be changed to /dev/sda1.
We have done. Just do sync and reboot
sync
reboot
Your CT will boot by SSD. Enjoy your CT with SSD.
[contact-form-7 id="24" title="Karl"]
2014년 11월 6일 목요일
Fork & Execv
Below code is simple fork & execv code for system programming
The sender generate a thread to print "I run".
After sender generate the thread,
it just prints out the PID of the thread.
Receiver is the thread.
[contact-form-7 id="24" title="Karl"]
The sender generate a thread to print "I run".
After sender generate the thread,
it just prints out the PID of the thread.
Receiver is the thread.
//Receiver
#include <stdio.h>
#define DIE(x) perror(x), exit(1)
int main(int argc, char **argv)
{
printf("I run %s\n", argv[1]);
return 0;
}
//Sender
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
int main()
{
int status;
pid_t pid;
char *argv[3];
argv[0] = "test1";
argv[1] = "boot";
argv[2] = NULL;
switch(pid=fork())
{
case -1: // Error
perror("fork");
exit(1);
break;
case 0: // child
printf("%d\n", (int)getpid());
execv("test1", argv);
exit(0);
break;
default:
while(wait(&status) != pid)
continue;
printf("%d\n", (int)getpid());
break;
}
return 0;
}
[contact-form-7 id="24" title="Karl"]
Enable Wi-Fi on Lubuntu 13.08
CT can connect internet via wifi or lan cable.
Lan cable is definitely easy to connect, just plug in.
However, wifi needs some works to connect.
Below step is how to connect wifi.
My step is started form installing vim editor.
If you have already installed vim,
start installation of linux-firmware.
These are necessary packages.
For wifi, "bcmdhd" module is needed.
modprobe bcmdhd
To eanble automatically wifi at the bot time, modify /etc/modules
add this module at the end of file
Then reboot.
now make configuration for wifi
By iwlist command, I can find the wifis which are near by me.
wpa_passphrase commnad make configuration fot which SSID will be used.
[SSID} and [PASSWAORD] are my wifi's.
Then, set parameter of wifi.
type below 3 lines at the end of file.
Last is set nameserver.
add this line.
Done.
After reboot, enjoy wifi.
[contact-form-7 id="24" title="Karl"]
Lan cable is definitely easy to connect, just plug in.
However, wifi needs some works to connect.
Below step is how to connect wifi.
My step is started form installing vim editor.
If you have already installed vim,
start installation of linux-firmware.
sudo apt-get install vim
sudo apt-get install linux-firmware
sudo apt-get install wifi-rader
These are necessary packages.
For wifi, "bcmdhd" module is needed.
modprobe bcmdhd
To eanble automatically wifi at the bot time, modify /etc/modules
vi /etc/modules
add this module at the end of file
bcmdhd
Then reboot.
sudo reboot
now make configuration for wifi
ifconfig wlan0 up
iwlist wlan0 scan
By iwlist command, I can find the wifis which are near by me.
wpa_passphrase commnad make configuration fot which SSID will be used.
wpa_passphrase [SSID] [PASSWORD] >> /etc/wpa_supplicant.conf
[SSID} and [PASSWAORD] are my wifi's.
Then, set parameter of wifi.
vi /etc/network/interfaces
type below 3 lines at the end of file.
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant.conf
Last is set nameserver.
vi /etc/resolv.conf
add this line.
nameserver 8.8.8.8
Done.
After reboot, enjoy wifi.
[contact-form-7 id="24" title="Karl"]
Porting Lubuntu 13.08 to CT (NAND flash)
When I first used CT, I installed Lubuntu 13.08.
This installation was so tough for me.
At the beginning of flashing, I used Linux Mint 12.10.
It has some problems to install CT's USB driver.
Ubuntu 12.04 LTS is easiest OS, I think.
You can check your linux OS.
Linux kernel version can be shown by this command.
For CT, I will use lubuntu which is a light ubuntu with HDMI display output.
Now, I have the lubuntu image.
Next, Download and Install LiveSuit 3.05.
I could not find the install file address, so I just download from
http://docs.cubieboard.org/tutorials/common/livesuit_installation_guide
However, Do not trust the installation guide for linux in DOC web page.
Ths guide is for old LiveSuit version.
Follow below command.
That's all.
If you are using ubuntu 12.04 LTS, you don't need to use dpkg or RPM.
However, there was another problem to make connection between CT and my ubuntu which is running on VMware.
The connection between CT and VMware is unstable.
So, I needed to register usb port manually.
To fix this problem, I needed to add some parameters into vmx file.
At first, check your usb id in VMware.

This file is placed in your VM directory.
In that file, there will be two ids.
write them in somewhere.
Then, open vmx file for the virtual machine with gVim and add those ids like this.

0x1f3a and 0xefe8 are my usb ids
Finally, we have finished all setting for flashing.
Now turn CT off, and unplug CT's power.
run the Livesuit with sudo

While pushing FEL button, connect the cable into CT.
IF you get the error message like "Get Device Stage Failed!",
use sudo.
To turn it off, push the power button more than 10 seconds.
Then do it again.
You can see a popup asking format or not.
Press yes.
Now your CT will have and run the image which you want.
[contact-form-7 id="24" title="Karl"]
This installation was so tough for me.
At the beginning of flashing, I used Linux Mint 12.10.
It has some problems to install CT's USB driver.
Ubuntu 12.04 LTS is easiest OS, I think.
You can check your linux OS.
cat /etc/os-release
Linux kernel version can be shown by this command.
uname -a
For CT, I will use lubuntu which is a light ubuntu with HDMI display output.
wget http://dl.cubieboard.org/software/a20-cubietruck/lubuntu/ct-lubuntu-nand-v1.02/lubuntu-desktop-nand-hdmi.img.gz .
gzip -d lubuntu-desktop-nand-hdmi.img.gz .
Now, I have the lubuntu image.
Next, Download and Install LiveSuit 3.05.
I could not find the install file address, so I just download from
http://docs.cubieboard.org/tutorials/common/livesuit_installation_guide
However, Do not trust the installation guide for linux in DOC web page.
Ths guide is for old LiveSuit version.
Follow below command.
mkdir cubie
mv LiveSuitV305_For_Linux64.zip cubie
cd cubie
unzip LiveSuitV305_For_Linux64.zip
cd LiveSuitV305_For_Linux64
chmod +x LiveSuit.run
sudo apt-get install dkms
sudo ./LiveSuit.run
That's all.
If you are using ubuntu 12.04 LTS, you don't need to use dpkg or RPM.
However, there was another problem to make connection between CT and my ubuntu which is running on VMware.
The connection between CT and VMware is unstable.
So, I needed to register usb port manually.
To fix this problem, I needed to add some parameters into vmx file.
At first, check your usb id in VMware.

This file is placed in your VM directory.
In that file, there will be two ids.
write them in somewhere.
Then, open vmx file for the virtual machine with gVim and add those ids like this.
usb.quirks.device0 = "0x1f3a:0xefe8 skip-reset"

0x1f3a and 0xefe8 are my usb ids
Finally, we have finished all setting for flashing.
Now turn CT off, and unplug CT's power.
run the Livesuit with sudo
sudo /Bin/LiveSuit/LiveSuit

While pushing FEL button, connect the cable into CT.
IF you get the error message like "Get Device Stage Failed!",
use sudo.
To turn it off, push the power button more than 10 seconds.
Then do it again.
You can see a popup asking format or not.
Press yes.
Now your CT will have and run the image which you want.
[contact-form-7 id="24" title="Karl"]
피드 구독하기:
덧글 (Atom)