Strict Standards: Declaration of action_plugin_indexmenu::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/mipselfw/wiki/lib/plugins/indexmenu/action.php on line 13

Strict Standards: Declaration of action_plugin_popularity::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/mipselfw/wiki/lib/plugins/popularity/action.php on line 57

Strict Standards: Declaration of action_plugin_safefnrecode::register() should be compatible with DokuWiki_Action_Plugin::register($controller) in /membri/mipselfw/wiki/lib/plugins/safefnrecode/action.php on line 66
hd900:firmware:debian [Mipsel Firmware]
 

Debian Squeeze on HD900B with debootstrap

Create debian wheezy mipsel binary image

On PC Side - Create Root File System

Tested on Ubuntu 13.04 AMD64

su
mkdir -p /home/asdf/opt
cd /home/asdf/opt
mkdir debian_mipsel
cd debian_mipsel
apt-get install debootstrap debian-archive-keyring qemu-user-static
dd if=/dev/zero of=./wheezy_mipsel.bin bs=1024k count=1024
mkfs.ext2 ./wheezy_mipsel.bin -F
mkdir -p /tmp/wheezy
mkdir -p /tmp/wheezy/proc
mount -t proc none /tmp/wheezy/proc
mount -o loop ./wheezy_mipsel.bin /tmp/wheezy
debootstrap --verbose --arch=mipsel --foreign wheezy /tmp/wheezy
cp /usr/bin/qemu-mipsel-static /tmp/wheezy/usr/bin
chroot /tmp/wheezy
/debootstrap/debootstrap --second-stage
echo "deb http://ftp.us.debian.org/debian wheezy main" >/etc/apt/sources.list
apt-get update
apt-get upgrade
apt-get clean
dpkg-reconfigure tzdata
apt-get install locales
dpkg-reconfigure locales
[*] en_US.UTF-8 UTF-8
passwd

echo "Debian" > /etc/hostname
echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >>/etc/bash.bashrc
echo "PS1='${USER}@${HOSTNAME}# '" >>/etc/bash.bashrc

cat <<EOF > /etc/resolv.conf
nameserver 192.168.2.1
nameserver 8.8.8.8
EOF

ln -s /dev/null /etc/blkid.tab
ln -s /proc/mounts /etc/mtab
mkdir /data

cat <<EOF > /etc/hosts
127.0.0.1       localhost
127.0.0.1       venus
EOF

cat <<EOF > /etc/apt/sources.list
deb http://ftp.uk.debian.org/debian/ wheezy main contrib non-free
#deb-src http://ftp.uk.debian.org/debian/ wheezy main contrib non-free

deb http://security.debian.org/ wheezy/updates main contrib non-free
#deb-src http://security.debian.org/ wheezy/updates main contrib non-free

deb http://ftp.uk.debian.org/debian wheezy-updates main
#deb-src http://ftp.uk.debian.org/debian wheezy-updates main
EOF

echo "export LC_ALL=C" >>/root/.bashrc

apt-get update
apt-get upgrade

exit
sync
umount /tmp/wheezy/proc
umount /tmp/wheezy
#Copy to usb stick
cp ./wheezy_mipsel.bin /media/asdf/FAT 
sync
umount /media/asdf/FAT

On HD900 Side - Configuring Dropbear

cd /tmp/usbmounts/sdb1
mkdir -p /tmp/wheezy
mount -o loop ./wheezy_mipsel.bin /tmp/wheezy
mkdir -p /tmp/wheezy/proc
mount -t proc none /tmp/wheezy/proc
mkdir -p /tmp/wheezy/dev
BINDS="/dev/pts /mnt/asec /sys /data /system /cache /tmp/usbmounts/sdb1 /tmp"
for i in $BINDS
do
echo "mount -o bind ${i} /tmp/wheezy${i}"
mkdir -p /tmp/wheezy${i}
mount -o bind ${i} /tmp/wheezy${i}
done
chroot /tmp/wheezy /bin/bash
apt-get install dropbear
exit

On HD900 Side - Starting Dropbear Next Time

cd /tmp/usbmounts/sdb1
mkdir -p /tmp/wheezy
mount -o loop ./wheezy_mipsel.bin /tmp/wheezy
mkdir -p /tmp/wheezy/proc
mount -t proc none /tmp/wheezy/proc
mkdir -p /tmp/wheezy/dev
BINDS="/dev/pts /mnt/asec /sys /data /system /cache /tmp/usbmounts/sdb1 /tmp"
for i in $BINDS
do
echo "mount -o bind ${i} /tmp/wheezy${i}"
mkdir -p /tmp/wheezy${i}
mount -o bind ${i} /tmp/wheezy${i}
done
chroot /tmp/wheezy /bin/bash
service dropbear start
exit

Create debian squeeze mipsel binary image

On PC Linux ( Tested Ubuntu 11.04 AMD64 ):

su -
cd /root
dd if=/dev/zero of=squeeze.bin bs=1024k count=2048
mkfs.ext2 ./squeeze.bin -F
mkdir -p /tmp/squeeze
mount -o loop ./squeeze.bin /tmp/squeeze
apt-get install debootstrap
debootstrap --arch=mipsel --foreign squeeze /tmp/squeeze 
sync
umount /tmp/squeeze
cp squeeze.bin /media/D9CC-687E
sync
umount /media/D9CC-687E

On HD900B:

mkdir -p /tmp/squeeze
mount -o loop /tmp/usbmounts/sdb1/squeeze.bin /tmp/squeeze
mount -t proc none /tmp/squeeze/proc
chroot /tmp/squeeze
/debootstrap/debootstrap --second-stage
echo "deb http://ftp.us.debian.org/debian squeeze main" >/etc/apt/sources.list
apt-get update
apt-get upgrade
apt-get clean
echo "export TERM=vt100" >>/etc/profile
echo "export TERM=vt100" >>/etc/bash.bashrc
exit
umount /tmp/squeeze

You can download the following file and skip the steps above:

http://downloads.sourceforge.net/project/mipselfw/squeeze.bin.zip

On HD900B After Reboot:

mkdir -p /tmp/squeeze
mount -o loop /tmp/usbmounts/sdb1/squeeze.bin /tmp/squeeze
mkdir -p /tmp/squeeze/proc
mount -t proc none /tmp/squeeze/proc
mkdir -p /tmp/squeeze/dev
mount -o bind /dev /tmp/squeeze/dev
mkdir -p /tmp/squeeze/mnt/asec
mount -o bind /mnt/asec /tmp/squeeze/mnt/asec
mkdir -p /tmp/squeeze/system
mount -o bind /system /tmp/squeeze/system
mkdir -p /tmp/squeeze/cache
mount -o bind /cache /tmp/squeeze/cache
cp /etc/resolv.conf /tmp/squeeze/etc
mkdir -p /tmp/squeeze/sys
mount -o bind /sys /tmp/squeeze/sys
mkdir -p /tmp/squeeze/tmp
mount -o bind /tmp /tmp/squeeze/tmp
mkdir -p /tmp/squeeze/data
mount -o bind /data /tmp/squeeze/data
chroot /tmp/squeeze /bin/bash

Umount:

umount /tmp/squeeze
umount /tmp/squeeze/proc
umount /tmp/squeeze/dev
umount /tmp/squeeze/mnt/asec
umount /tmp/squeeze/system
umount /tmp/squeeze/cache
umount /tmp/squeeze/sys
umount /tmp/squeeze/tmp
umount /tmp/squeeze/data

Install Debian Apps

Internet

Install NTPDATE - Time Synchronization

http://www.cs.berkeley.edu/CT/ag4.0/appendid.htm

apt-get install ntpdate
date
export TZ=MET-1METDST
ntpdate -vs pool.ntp.org
date

Install SYSKLOGD - Kernel/System log daemon

apt-get install sysklogd

Install Debian Base Tools

apt-get install strace psmisc lsof file zip sudo

Build Binary

Install Tools for Native Compilation

apt-get install build-essential

Compile Debian Lighttpd enabling root user

echo "deb-src http://ftp.us.debian.org/debian squeeze main" >>/etc/apt/sources.list
apt-get update
apt-get upgrade

apt-get build-dep lighttpd
apt-get source lighttpd

cd lighttpd-1.4.28
cd src
grep 'I will not' *
vi server.c
/I will not
delete if statement:

                        if (pwd->pw_uid == 0) {
                                log_error_write(srv, __FILE__, __LINE__, "s",
                                                "I will not set uid to 0\n");
                                return -1;
                        }
                        
                        if (grp->gr_gid == 0) {
                                log_error_write(srv, __FILE__, __LINE__, "s",
                                                "I will not set gid to 0\n");
                                return -1;
                        }

cd ..
dpkg-buildpackage

cd /lighttpd-1.4.28/debian/tmp/usr/sbin/
zip lighttpd-1.4.28debian_squeeze_mipsel_root.zip *

Install Debian Lighttpd enabling root user

killall lighttpd
apt-get install lighttpd php5 php5-cgi php5-cli
cd /var/www
echo "<?php phpinfo(); ?>" >phpinfo.php
php phpinfo.php
php-cgi phpinfo.php

cd /etc/lighttpd/
cp lighttpd.conf lighttpd.conf.ori
wget http://downloads.sourceforge.net/project/mipselfw/lighttpd-php.conf
sed -e 's/\/opt\/bin\/php-fcgi/\/usr\/bin\/php-cgi/g' -e 's/"root"/"www-data"/g' lighttpd-php.conf >lighttpd.conf
killall lighttpd
service lighttpd start
wget -qO- -c "http://localhost/phpinfo.php" 

cd /var/www
echo "<?php echo file_get_contents('http://www.wikipedia.org/'); ?>" >fgc.php
php fgc.php
wget -qO- -c "http://localhost/fgc.php"  (Dont works...)


killall lighttpd
cp /usr/sbin/lighttpd /usr/sbin/lighttpd-www-data
cp /usr/sbin/lighttpd-angel /usr/sbin/lighttpd-angel-www-data
rm /usr/sbin/lighttpd /usr/sbin/lighttpd-angel
cd /usr/sbin/
wget http://downloads.sourceforge.net/project/mipselfw/lighttpd-1.4.28debian_squeeze_mipsel_root.zip
unzip lighttpd-1.4.28debian_squeeze_mipsel_root.zip
sed -e 's/\/opt\/bin\/php-fcgi/\/usr\/bin\/php-cgi/g' lighttpd-php.conf >lighttpd.conf
service lighttpd start
wget -qO- -c "http://localhost/fgc.php"  (Works...)

Compile Apache enabling root user

cd /
wget http://it.apache.contactlab.it//httpd/httpd-2.2.22.tar.gz
tar xvfz httpd-2.2.22.tar.gz
cd httpd-2.2.22
env CFLAGS="-DBIG_SECURITY_HOLE" ./configure --enable-so
env CFLAGS="-DBIG_SECURITY_HOLE" make
make install

Compile Debian Apache enabling root user

echo "deb-src http://ftp.us.debian.org/debian squeeze main" >>/etc/apt/sources.list
apt-get update
apt-get upgrade
apt-get build-dep apache2
apt-get source apache2
cd apache2-2.2.16/
echo "SET CFLAGS -g -O2 -DBIG_SECURITY_HOLE" >/etc/dpkg/buildflags.conf
dpkg-buildpackage
cd /apache2-2.2.16/debian/apache2.2-bin/
zip -r apache2-2.2.16_debian_squeeze_mipsel_root.zip *

Install Debian Apache enabling root user

killall lighttpd
apt-get install apache2 php5 php5-cgi php5-cli libapache2-mod-fcgid
cd /var/www
echo "<?php phpinfo(); ?>" >phpinfo.php
php phpinfo.php
php-cgi phpinfo.php
a2enmod fcgid suexec rewrite
apt-get install libapache2-mod-php5
a2enmod php5
service apache2 restart
wget -qO- -c "http://localhost/phpinfo.php" 

cd /var/www
echo "<?php echo file_get_contents('http://www.wikipedia.org/'); ?>" >fgc.php
php fgc.php
wget -qO- -c "http://localhost/fgc.php"  (Dont works...)

cp /usr/lib/apache2/mpm-prefork/apache2 /usr/lib/apache2/mpm-prefork/apache2-www-data
rm /usr/lib/apache2/mpm-prefork/apache2
mkdir /temp
cd /temp
wget http://downloads.sourceforge.net/project/mipselfw/apache2-2.2.16_debian_squeeze_mipsel_root.zip
unzip apache2-2.2.16_debian_squeeze_mipsel_root.zip
cp /temp/usr/lib/apache2/mpm-prefork/apache2 /usr/lib/apache2/mpm-prefork/apache2
cp /etc/apache2/envvars /etc/apache2/envvars.ori
sed 's/www-data/root/g' /etc/apache2/envvars.ori >/etc/apache2/envvars
service apache2 restart
wget -qO- -c "http://localhost/fgc.php"  (Works...)
 
hd900/firmware/debian.txt · Last modified: 2013/05/26 08:12 by mipselfw
 
Except where otherwise noted, content on this wiki is licensed under the following license: GNU Free Documentation License 1.3
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki

Mail