Monday, January 13, 2014
Installing DHCP (uDHCPd) on TTYLinux
Stuff needed :
1. BusyBox binary package – [LINK]
2. TTYLinux – [LINK]
1. Boot into TTYLinux
2. Download the BusyBox into the TTYLinux - link
# wget http://busybox.net/downloads/binaries/latest/busybox-x86_64
3. Make it executable
# chmod +x busybox-x86_64
4. Install BusyBox
# ./busybox-x86_64 --install
5. Verify
# ls -l /usr/sbin --> notice udhcpd date/time ?
6. Copy service script under the /etc/rc.d/init.d folder (thttpd)
# cp /etc/rc.d/init.d/thttpd /etc/rc.d/init.d/udhcpd
# sed -i 's/thttpd/udhcpd/g' udhcpd
# sed -i 's/httpd/dhcpd/g' udhcpd
# sed -i 's/thttp/dhcpd/g' udhcpd
# nano /etc/rc.d/init.d/udhcpd
* comment out the portion for
* addgroup
* under start() -> comment out doGroupCheck
! load_proc ${UDHCPD} -fS /etc/udhcpd.conf $
# service udhcpd [start/stop/restart/status]
make sure interface facing the LAN has the an IP interface from the subnet.
# ifconfig --> verify
# ifconfig eth0 10.0.0.1 netmask 255.255.255.0
# ifconfig eth0 up
make it permanent at /etc/sysconfig/network-scripts/ifcfg-eth0
ENABLE=yes
IPADDRESS=10.0.0.1
CIDRLEN=24
NETWORK=10.0.0.0
NETMASK=255.255.255.0
BROADCAST=10.0.0.255
DHCP=no
! Restart the networking service to refresh the settings.# service network restart
7. Create the UDHCPD configuration file
# touch /etc/udhcpd.conf
Content of the /etc/udhcpd.conf
========================================
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 10.0.0.20
end 10.0.0.254
# The interface that udhcpd will use
interface eth0 #default: eth0
option subnet 255.255.255.0
option router 10.0.0.1
option dns 10.0.0.2
========================================
8. Create the UDHCPD lease file
Add the leases file
# touch /var/lib/misc/udhcpd.leases
9. Allow the UDP port 67 and 68
# nano /etc/firewall.conf
add under [UDP] 67 and 68
10. Restart the firewall services
# service firewall restart
Voila!
Sending OFFER of 10.0.0.20
Sending ACK to 10.0.0.20
uDHCPd configuration sample [link]
Installing TTYLinux
Basic steps use for installing TTYLinux to hard drive.
Boot from ISO
boot from TTYLinux iso
login using : root/password
Preparing the partition
# fdisk /dev/sda
# n
# p
# 1
# 1
# 15
# w
Create the file system
# mke2fs /dev/sda1
Installing the TTYLinux to drive
# ttylinux-install -m /dev/hdc /dev/sda1
# yes
* eject/remove ISO from cdrom
Reboot the system
# shutdown –r
Login into the new install system
root/password
Sunday, January 12, 2014
Remastering TTYLinux
Ingredients :
1. Ubuntu 12.04 netinstall disc or any working Debian machine
Initial setup commands:
# apt-get update
# apt-get upgrade
Dependancy package required for the rebuilding of the TTYLinux image
# apt-get install x (x being the package listed below)
build-essential
autoconf
automake
bzip2
mkisofs
bin86
gawk
flex
bison
ncurses-dev
docbook-utils
pkg-config
gettext
libglib2.0-dev
libfuse-dev
libpam-dev
!! Warning "docbook-utils" will use about 500mb files, go make some coffee
!! mkisofs is depreciated and replace by genisoimage
!! overcome this by # sudo ln -s /usr/bin/genisoimage /usr/bin/mkisofs
Grab a copy of the TTYLinux for remastering
# cd /tmp
# wget https://github.com/djerome/ttylinux/tarball/master -O ttylinux.tar.gz --no-check-certificate
Untar the compress file
# tar zxf ttylinux.tar.gz
Go to the directory
# cd /tmp/djerome-ttylinux-xxxxxxx# (press tab to autocomplete as the xxxxxxx are different between version)
Edit the UDHCPD configuration settings
cd /tmp/djerome-ttylinux-5ece876/ttylinux-build/pkg-cfg/busybox-1.21.0
# nano _bbox-stnd.cfg
^w (CTRL + W)
type in UDHCPD
Before:
# CONFIG_UDHCPD is not set
# CONFIG_DHCPRELAY is not set
# CONFIG_DUMPLEASES is not set
# CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY is not set
# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
CONFIG_DHCPD_LEASES_FILE=""
After:
CONFIG_UDHCPD=y
CONFIG_DHCPRELAY=y
CONFIG_DUMPLEASES=y
CONFIG_FEATURE_UDHCPD_WRITE_LEASES_EARLY=y
# CONFIG_FEATURE_UDHCPD_BASE_IP_ON_MAC is not set
CONFIG_DHCPD_LEASES_FILE="/var/lib/mis/udhcpd.leases"
^O (CTRL + O)
^X (CTRL + X)
Cross-tool chain process
# cd /tmp/djerome-ttylinux-5ece876/xbuildtool
# make setup
# make x86_64-2.14-gnu
!! Took 37 minutes 58 seconds
Compile and build TTYLinux
cd /tmp/djerome-ttylinux-5ece876/ttylinux-build
make getcfg
option 6 for pc_x86_64_defconfig
depend you preference you can now edit the newly created ttylinux-config.sh to comment out/exclude the package which you don't wished to compile with the package.
Download TTYLinux source packages
# make dload
Make the TTYLinux ISO
# make dist
Took 12 minutes 52 seconds (2days actually of painful back and forth troubleshooting !)
!! The BusyBox script even with answer "Y for the DHCPRELAY the configuration file, it was stopping and waiting for a Y/n.
!! I pressed Y and press ENTER ... it continue. So life goes on
* I went back and comment out NTFS-3g because it keep erroring out and I didnt really require it. Even download the so call missing libntfs* file, it didn't help.
* I eventually comments alot of stuff which keep giving me errors :)
After all that is done (cross-building packages), its goes into compiling the TTYLinux kernel
I ftp my ISO from the virtual machine to the host FTP server.
[ref] http://blog.thewulph.com/?p=323