Hack-A-N900/First Steps: Unterschied zwischen den Versionen

aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Zur Navigation springenZur Suche springen
 
(6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
<b>WARNING:</b> That's where the pleasure and pain of N900 starts. How much pleasure and/or pain depends highly on how familiar you are with linux. So make sure you know how to accomplish simple administrative tasks via a root shell without bricking your system and do regular [http://metalab.at/wiki/Hack-A-N900/Backup backups].
+
<b>WARNING:</b> That's where the pleasure and pain of N900 starts. How much pleasure and/or pain depends highly on how familiar you are with linux. So make sure you know how to accomplish simple administrative tasks via a root shell without bricking your system and do regular [[Hack-A-N900/Backup | backups]].
  
 
=== Root Access ===
 
=== Root Access ===
Start "Application Manager" and install package "rootsh"
+
Start "Application Manager", install package "rootsh" and "OpenSSH Client and Server"
  
 
Open "X-Terminal" on your N900.
 
Open "X-Terminal" on your N900.
Zeile 11: Zeile 11:
 
</pre>
 
</pre>
  
=== Add extras to /etc/apt/sources.list ===
+
=== Add extras-testing to /etc/apt/sources.list ===
 
<pre>
 
<pre>
#Extras
+
deb http://repository.maemo.org/extras-testing/ fremantle free non-free
deb http://repository.maemo.org/extras/ fremantle free non-free
+
deb-src http://repository.maemo.org/extras-testing/ fremantle free
deb-src http://repository.maemo.org/extras/ fremantle free
 
 
</pre>
 
</pre>
  
Zeile 41: Zeile 40:
  
 
=== OpenSSH ===
 
=== OpenSSH ===
 
Install OpenSSH client and server:
 
<pre>
 
apt-get install openssh
 
</pre>
 
  
 
Generate ssh key:
 
Generate ssh key:
Zeile 78: Zeile 72:
  
 
<pre>
 
<pre>
apt-get install bash coreutils-gnu grep-gnu tar-gnu wget vim
+
apt-get install bash coreutils-gnu grep-gnu findutils-gnu tar-gnu wget vim netcat
 
</pre>
 
</pre>
  
Zeile 119: Zeile 113:
 
alias fgrep='gfgrep'
 
alias fgrep='gfgrep'
 
</pre>
 
</pre>
 
 
 
=== Update Kernel ===
 
 
Add tesing repositories to /etc/apt/sources.list:
 
  deb http://repository.maemo.org/extras/ fremantle free
 
  deb-src http://repository.maemo.org/extras/ fremantle free
 
 
 
  deb http://repository.maemo.org/extras-testing/ fremantle free 
 
  deb-src http://repository.maemo.org/extras-testing/ fremantle free
 
 
apt-get update
 
 
apt-get install kernel-flasher-maemo kernel-modules-maemo
 
 
cross your thumbs now.. (you backed up before right?)
 
 
reboot
 
 
WELCOME TO YOUR UPDATED SYSTEM THAT SUPPORTS UNIONFS \o/!
 
 
=== Create unionfs / chroot overlay filesystem for development ===
 
 
Create a 2 GB file on /home/user/MyDocs/sandbox/fs.img
 
  mkdir /home/user/MyDocs/sandbox/
 
  cd /home/user/MyDocs/sandbox/
 
  dd if=/dev/zero of=fs.img bs=1M count=1 seek=2048
 
  mkfs.ext2 fs.img
 
 
Get the shiny overlay/chroot shellscript
 
  wget http://metalab.at/wiki/images/d/d8/Chroot-unionfs.sh  '''WARNING the link might be different now look here: [[Bild:Chroot-unionfs.sh]]'''
 
  mv chroot-unionfs.sh /sbin/chroot-unionfs
 
  chmod +x /sbin/chroot-unionfs
 
 
This script doeas some magic including
 
* loading the dm-loop kernel module (for /dev/loop? devices)
 
* overlaying the unionfs filesystem
 
* mounting all needed filesystem folders inside the unionfs
 
* chroot()'ing inside
 
 
It is started like this:
 
 
bash /sbin/chroot-unionfs -v -t /home/user/MyDocs/sandbox/fs.img
 
 
Read the source to find out about command line parameters like -t for testing and others..
 
 
If this script is successful you should find yourself in a chrooted environment inside the unionfs
 
touch /CHROOTED
 
ls /CHROOTED    # it should be here!
 
exit
 
  ls /CHROOTED  # it should be gone!
 
 
 
  
 
[[Kategorie:N900]]
 
[[Kategorie:N900]]

Aktuelle Version vom 26. April 2010, 00:47 Uhr

WARNING: That's where the pleasure and pain of N900 starts. How much pleasure and/or pain depends highly on how familiar you are with linux. So make sure you know how to accomplish simple administrative tasks via a root shell without bricking your system and do regular backups.

Root Access

Start "Application Manager", install package "rootsh" and "OpenSSH Client and Server"

Open "X-Terminal" on your N900.

Gain root access:

sudo gainroot

Add extras-testing to /etc/apt/sources.list

deb http://repository.maemo.org/extras-testing/ fremantle free non-free
deb-src http://repository.maemo.org/extras-testing/ fremantle free

Update apt cache:

apt-get update

USBIP

Connect the n900 via usb to your pc and select "PC Suite Mode".

On your N900:

ifup usb0
ifconfig usb0 192.168.99.2

On your PC:

ifup usb0
ifconfig usb0 192.168.99.1

Please refer to http://wiki.maemo.org/N900_USB_networking for a complete guide.

OpenSSH

Generate ssh key:

ssh-keygen

From this point it's more convenient to work remotely via ssh.

Copy the generated private key to your PC.

scp root@192.168.99.2:/root/.ssh/id_rsa ~/.ssh/id_rsa_n900

Put the public key to the right place:

ssh root@192.168.99.2 "mv /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys"

Log on to your N900:

ssh -i ~/.ssh/id_rsa_n900 root@192.168.99.2

change /etc/sshd_config to denied password authentication:

# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no

Install essential tools

apt-get install bash coreutils-gnu grep-gnu findutils-gnu tar-gnu wget vim netcat

Change shell in /etc/passwd to bash:

root:x:0:0:root:/root:/bin/bash
user:!:29999:29999::/home/user:/bin/bash

NOTE: Maemo ignores shebangs for shells and always executes shell scripts in busybox. You need to pass the script explicitly to any other shell:

bash ./test.sh

WARNING: Don't try to relink /bin/sh to /bin/bash. You system won't boot and you will have to reflash the device.

NOTE: Gnu coreutils and gnu grep are prefixed with the letter 'g'. Therefore you need to call

/usr/bin/gls

to use gnu ls. For some third party scripts/builds to work properly you might need to create symlinks for the gnu tools to be used.

Example:

ln -s /usr/bin/ggrep /usr/bin/grep

You might also create bash aliases for gnu utils.

$HOME/.bashrc aliases example:

# alias to gnu ls instead of busybux
alias ls='gls --color=auto'

alias ll='ls -l'
alias la='ls -la'
alias md='mkdir'
alias rd='rmdir'

# aliases to gnu grep instead of busybux
alias grep='ggrep'
alias egrep='gegrep'
alias fgrep='gfgrep'