Showing posts with label ODROID-X2. Show all posts
Showing posts with label ODROID-X2. Show all posts

Monday, November 11, 2013

Debian on ODROID-x2

Edit 12/7/2013:
Thanks to mdrjr Mr. Mauro Ribeiro work and help he was able to edit the kernel build and enable the SPI.

So, here are my notes on this work

OFFICIAL Debian Wheezy for X2

www.mdrjr.net/odroid/debian-wheezy

root/odroid
odroid/odroid

network is configured in
/etc/network/interfaces
####################################################
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
#your static IP
address 192.168.1.50
#your gateway IP
gateway 192.168.1.1
dns-domain example.com
dns-nameservers 192.168.11.1
netmask 255.255.255.0
#your network address "family"
network 192.168.1.0
broadcast 192.168.1.255
####################################################

You might need to add:
sudo apt-get install libncurses5-dev

Update Date on ODROID-X2 board
data -s "Dec 16 00:00:00 EST 2013"


I did the following steps:
  1. I created a folder in my root home
  2. got the web and get:
  3. wget --no-check-certificate https://github.com/hardkernel/linux/archive/odroid-3.8.y.zip
  4. 7z x -y odroid-3.8.y.zip
  5. cd odroid-3.8.y
  6. sync                    This will sync your SD card
  7. make mrproper
  8. make odroidx2_defconfig
  9. make menuconfig  >>>  this one needed to install sudo apt-get install libncurses5-dev  
  10. now which one I used? odroidx2_ubuntu_defconfig  odroidx2_defconfig
  11. had to install bc first, apt-get install bc
  12. make -j8
  13. sync
  14. make -j8 modules
  15. make  modules_install
  16. sync
  17. kernelversion=`cat ./include/config/kernel.release`
  18. sudo mkinitramfs -c gzip -o ./initramfs-$kernelversion $kernelversion
  19. mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d ./initramfs-$kernelversion ./uInitrd
  20. cp /boot/zImage /boot/zImage.prevc
  21. cp /boot/uInitrd /boot/uInitrd.prev
  22. cp uInitrd /boot
  23. cp arch/arm/boot/zImage /boot
  24. cp .config /boot/config-$kernelversion
  25. cp System.map /boot/System.map-$kernelversion
  26. sync
  27. shutdown -h 0

And it worked, I am running now using my built kernel...

Edit 12/15/2013:
After the last edit to the kernel to enable spidev1.0 I was able to build the kernel and booting to see the /dev/spidev1.0
the problem is the bottom 1/3 of the monitor is not showing that area and only showing garbage!



Reference:

If you need to use your Odroid as a WiFi Hotspot...
http://forum.odroid.com/viewtopic.php?f=52&t=6282


Thursday, September 5, 2013

Adding GPIO SPI and I2C options to your Arch Linux Kernel

Edit 12/07/2013:
Thanks to Mr. Mauro Ribeiro, I was able to get the SPI on my ODROID-X2 board and, now I will be working on the actual development of the main project, which is, Controlling the world via SPI bus...
Mr. Mauro Ribeiro modified the kernel on https://github.com/hardkernel/linux/tree/odroid-3.8.y
and now we can build kernels with SPI1 enabled.


First lets put some list of GPIOs I used on this board:
105, 102, 110, 117
GPIO are found @
/sys/class/gpio
and then need to export as root...
#echo "105" > export
# echo "102" > export
# echo "110" > export
# echo "117" > export
# echo "out" >  gpio105/direction
# echo "out" >  gpio102/direction
# echo "out" >  gpio110/direction
# echo "out" >  gpio117/direction


# echo "1" > gpio105/value
# echo "0" > gpio105/value
# echo "1" > gpio102/value
# echo "0" > gpio102/value
# echo "1" > gpio102/value
# echo "1" > gpio105/value
# echo "0" > gpio105/value


To read from GPIO that is set as Input:
# echo "in" >  gpio105/direction
# cat /sys/class/gpio/gpio105/value



So, I had to build my Kernel to be able to enable the SPI "I hope that it is going to work..."
Make sure you have at least large SD drive, I used 8 GB and did not work.  So, 16 GB is recommended...

Edit:
OK, my 8GB SD card was not fully used, I had to use gparted and resize the partition to use the full SD card size.

1. Get the source code from the link below, I had to get linux-odroid-3.8.y.zip as others did not have my odroidx2_ubuntu_defconfig configuration file.
https://github.com/hardkernel/linux

2. Now you will have to unzip the file, so crate a folder in your home directory and save the downloaded zip file to it then use
unzip linux-odroid-3.8.y.zip
I installed 7z by using
pacman -S p7zip
Then
7z x -y zip.file.name
You will also need to get
pacman -S base-devel

Also you will need:
pacman -S gcc  make


3. make sure you work from the new created folder, linux-odroid-3.8.y
cd linux-odroid-3.8.y

zcat /proc/config.gz > .config

for Latest SPI enabled configuration, I used the following
make odroidx2_defconfig

4. Run make oldconfig
4. Now, run make menuconfig,  this will allow you to go and enable other options before you build the new kernel

5. make sure you exit and save changes when you are done,  now you should have a .config file in the current folder

6. To start build Run
make -j8
-j8 will allow the make to run up to 8 simultaneous jobs
This part will take a long time so do not set and wait for it to finish

7. Now, Run,
make -j8 modules
sudo make modules_installmake zImage

8.  Rename the current zImage to zImage.prev and copy the new zImage to /boot

kernelversion=`cat ./include/config/kernel.release`
sudo cp /boot/zImage /boot/zImage.prev
sudo cp /boot/uInitrd /boot/uInitrd.prev
sudo cp arch/arm/boot/zImage /boot
sudo cp .config /boot/config-$kernelversion


I used the steps from this location
http://odroid.us/mediawiki/index.php?title=Kernel_compiling
http://forum.odroid.com/viewtopic.php?f=52&t=81

Make sure your time is set to the correct time:
Time-Date set and check
sudo timedatectl set-time "2013-08-14 14:52:00"
timedatectl status
timedatectl set-timezone America/New_York



Warning: you may need to install module-init-tools

Now, Adding more notes about Device Tree overlay:
Install  sudo pacman -S  dtc-overlay
I need to find out where to find the correct dtc files to compile on the Odroid-x2


New Board found:
http://www.variscite.com/products/system-on-module-som/cortex-a9/dart-4460-cpu-ti-omap-4-omap4460?gclid=CJbkwpP3_roCFdF_Qgod0kMAtw

http://armbedded.eu/node/318


resources:
https://github.com/hardkernel/linux
http://archlinuxarm.org/developers/building-kernels
https://wiki.archlinux.org/index.php/Kernel_Compilation#Compilation
http://odroid.us/mediawiki/index.php?title=Kernel_compiling

This is my link to ODROID Forum question:
http://forum.odroid.com/viewtopic.php?f=17&t=1085

Good Links to building kernel:
http://docs.kali.org/development/custom-odroid-kernel-image
https://wiki.archlinux.org/index.php/Kernels/Compilation/Traditional


http://www.egr.msu.edu/classes/ece480/capstone/fall12/group02/documents/Mark-Birdsall_App-Note.pdf



Friday, July 26, 2013

Run arch linux on ODROID-X2 Step by Step

Get the image from Home

http://archlinuxarm.org/platforms/armv7/samsung/odroid-x2

To write the image to your SD card use the following command line
dd if=ArchLinuxARM-2013.07-odroid-x2.img  of=/dev/sdxxxx  bs=10M
Make sure /dev/sdxxxx is the correct dev for your SD card
Make sure to umount your SD card first...
Once dd is done writing the image to SD card use sync to flush any buffers


login using id and password  root/root
you will have to login first time using serial terminal or SSH.

If you can not find the IP address for the ODROID board, then you might want to setup static IP address;
  1. cd /etc/network.d   then type ls , you should see ethernet-eth0
  2. edit the file ethernet-eth0 using  sudo nano ethernet-eth0
  3. comment the dhcp configuration 
  4. un-comment and enter your correct ip address that you want to set and your dhcp address
  5. save and insert the sd card in your board and ping that address
  6. you should get echo back after 10-15 seconds
  7. for some reason it does not pickup the static by it self, I had to use netcfg-daemon start
Copy of my ethernet-eth0
## Change for static
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='172.16.71.239'
NETMASK='255.255.0.0'
##ROUTES=('192.168.0.0/24 via 192.168.1.2')
GATEWAY='172.16.1.45'
DNS=('172.16.1225' '172.16.1.233')


OK, this time with "Linux alarm 3.8.13.12-2-ARCH #2 SMP PREEMPT Tue Nov 12 20:41:34 CST 2013 armv7l GNU/Linux" I had to go to /etc/netcfg/ and edit eth0  

escription='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('192.168.71.239/24')
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='192.168.1.1'
DNS=('192.168.1.1' '192.168.1.2')



If you need to change root password,
Type: passwd  after you login and you will be prompted to enter new password.



How to update System in archlinux
We use pacman to install/update the system packages
So, type pacman-key --init to create pacman key first
you might need to switch to another console and type
ls -R / && ls -R / && ls -R /
now, when it is done, type pacman -Syu to update the system
It will take some time and will download and update your system
To add/install packages use pacman -S package_name


How to add your username to suders
Install sudo, modify visudo

  1. Install adduser by using pacman -S adduser
  2. Install sudo to be able to use root privilege
  3. Type  adduser username

and follow/answer all questions, set defaults, set password...
Now we need to edit the visudo to allow new user to use the sudo command
Type
EDITOR=nano visudo
Edit/ uncomment the following line
# %sudo ALL=(ALL) ALL  ==>>   %sudo ALL=(ALL) ALL
save and then create sudo group
groupadd sudo
now add sudo group to your user name
usermod -a -G sudo username
reboot and test your sudo access.  you will need to logout and login again...

Getting the WiFi setup
Setting the WiFi I had to install wicd
sudo pacman -Su wicd
then I got to run ip add show  to see list of your network device eth0, lo, wlan0
I have WEP security so, I run
sudo iwconfig wlan0 essid "your essid here" key your_hex_Keysudo dhcpcd wlan0
Now, if you have different settings like WEP, WPA, WPA2,..  refer to the link here

So, I started investigating netcfg
it works with the profiles saved in /etc/network.d
and by default it has one profile for the ethernet-eth0
so, I copied wireless-wep from the examples folder
updated the parameters in wireless-wep to my wireless network and
type: sudo netcfg wireless-wep -u

Two things:
  1. my key is stored in the profile file in text --- not good
  2. it still does not start on boot .....
I found netcfg-menu that needs dialog..
The netcfg-menu will make it simple to start specific profile as long as you created a profile for it as I have above. but still no auto-start on boot!

What is the /etc/conf.d/netcfg ???
I did it..  in the netcfg file there is a line called NETWORKS that is by default is like this...
NETWORKS=(ethernet-eth0)
So, I added my second profile just like this
NETWORKS=(ethernet-eth0 wireless-wep)
and now, both network profiles are up and running on boot....
Now, I needed to install wicd-gtk to work on the GUI



How to get your HDMI Working:
To be able to login from Arch Linux on a monitor instead of serial port of SSH you need
pacman -Su linux-odroid-x2

Trying to install:
sudo pacman -S xorg-server lxde xf86-video-fbdev
you can add xorg-apps but it is not required
sudo pacman -S xorg lxde xorg-twm xorg-xclock xterm xorg-xinit
All this so far did not get me to boot from the HDMI monitor...??????
After installing an image for Ubuntu 13.04 I got the board to run on HDMI interface and I logged in.  so it is not a hardware issue, it is a configuration.

> create file ~/.xinitrc in your home directory and add this line to it
exec startlxde
> there was an error not finding a cache file and I had to create it manually
OK, the file name was cookie and this is what I did
cd .config/pulse
echo > cookie
The echo command created a file cookie then I had to use nano and add the line I mentioned above
Now you should be able to use startx and get your LXDE desktop

Had to install fbset and run sudo fbset -fb /dev/fb1
Edited /etc/X11/xorg.conf

Section "Device"
        Identifier "HDMI"
        Driver  "fbdev"
        Option  "fbdev"           "/dev/fb1"
EndSection
Section "Screen"
        Identifier   "Default Screen"
        Device       "HDMI"
        DefaultDepth 24
EndSection
Section "DRI"
        Mode 0666
EndSection

after I added these settings to xorg.conf file it worked and I logged to LXDE finally....


To be able to forward X11 windows I had to do:
I am not sure yet which one did the trick but I will have to do this again on my other board...

  • Enable the AllowTcpForwarding option in sshd_config on the server.
  • Enable the X11Forwarding option in sshd_config on the server.
  • Set the X11DisplayOffset option in sshd_config on the server to 10.
  • Enable the X11UseLocalhost option in sshd_config on the server.
Also:
  • Enable the ForwardX11 option in ssh_config on the client.
  • Enable the ForwardX11Trusted if gui is drawing badly.
You need to restart the ssh daemon on the server for these changes to take effect, of course.
To use the forwarding, log on to your server through ssh:


Time-Date set and check
sudo timedatectl set-time "2013-08-14 14:52:00"
timedatectl status
timedatectl set-timezone America/New_York



Scratch Pad:
Do not use this method use adduser better
If you need to add new user so you do not login with the root
Type:     useradd user_name
Then change password:  passwd user_name
where user_name is the new user name you want to create

You will need to install sudo to be able to use root privilege with your new user id





Commands you might need:
Check CPU usage    top
Check SD usage       df  -h
systemctl start sshd
systemctl enable sshd.service
systemctl restart sshd.service



List to Do:
sudo root access
WiFi
HDMI
GPIO
SPI
Bluetooth
ssh -X ip-address




References:
https://wiki.archlinux.org/index.php/Wireless_Setup
https://wiki.archlinux.org/index.php/Bluetooth
https://wiki.archlinux.org/index.php/Ssh#X11_Forwarding
https://wiki.archlinux.org/index.php/Running_X_apps_as_root  Running X apps as root



list of stuff I did on new ArchLinuxARM-2013.11:

  1. login as root/root
  2. pacman -Syu
  3. pacman -S sudo adduser
  4. adduser username
  5. EDITOR=nano visudo
  6. Created new sudo group and added to new username
  7. Log in with new username
  8. Tested new username sudo
  9. If you do too much sudo, you can use sudo -s
  10. I kept the IP to DHCP, and on my second board, I changed it to Static
  11. change IP to static follow steps above...
  12. trying to install lxde
  13. sudo pacman -S xorg lxde xorg-twm xorg-xclock xterm xorg-xinit
  14. created .xinitrc and added exec startlxde
  15. Added pulse folder in .config and then created empty cookie file
  16. Install fbset then run sudo fbset -fb /dev/fb1
  17. created file /etc/X11/xorg.conf then copied the data above to it