Disclaimer:
THE FOLLOWING PROCEDURE WILL CAUSE ALL OF YOUR DATA TO BE LOST. YOU HAVE BEEN WARNED! Installing Debian on LinkStation LS421DE to replace the Buffalo stock firmware aimed to create a full customized operating system without unnecessary software as in stock firmware. The configuration for the following scenario described as below: - Using LinkStation LS421DE with armhf (arm hard float) architecture.
- Not using raid, but adding raid partition for data partition is fully supported.
- Currently, no vanilla kernel available. So, we are using Buffalo kernel at the moment. Vanilla kernel can be cross compiled.
The main process of Debian installation summarized as follow: - Creating rootfs by debootstrapping Debian on running LS421DE system.
- Using a Linux box (Ubuntu) to prepare suitable image for LinkStation.
- Modifying partition and installing Debian.
- Enable lsmonitor script and customize Debian system.
Creating rootfs on running LS421DE systemYou must have already a root access to the LinkStation box, if not, follow the the procedure on https://tohenk.wordpress.com/2014/11/11/opening-stock-firmware-of-linkstation-ls421de/. Install debootstrap: $ cd ~$ wget http://ftp.us.debian.org/debian/pool/main/d/debootstrap/debootstrap_1.0.64~bpo70+1_all.deb$ dpkg -i --force-all debootstrap_1.0.64~bpo70+1_all.debPrepare the tools by issuing commands: $ mkdir ~/lsmod$ cd ~/lsmod$ wget https://github.com/tohenk/linkstation-mod/archive/master.zip$ unzip master.zip$ cd linkstation-mod-masterEdit scripts/debootstrap-rootfs.cfg and adjust as you need, choose closest mirror from your location. Extra packages can be specified using PACKAGES variable. $ cat scripts/debootstrap-rootfs.cfgARCH=armhfVERSION=wheezyMIRROR=http://kartolo.sby.datautama.net.id/debianPACKAGES=$ vi scripts/debootstrap-rootfs.cfgRun debootstrap: $ ./scripts/debootstrap-rootfs.sh --cleanYou can ommit –clean option if you don’t want to debootstrap-ing again. After debootstrap process, the rootfs archive can be found on rootfs folder:
rootfs_wheezy_armhf_yymmdd.tar.gz => hddrootfs
initrd_wheezy_armhf_yymmdd.tar.gz => initrd
Preparing Debian image for LinkStationOn Linux (Ubuntu) box, prepare the tools: $ mkdir ~/lsmod$ cd ~/lsmod$ wget https://github.com/tohenk/linkstation-mod/archive/master.zip$ unzip master.zip$ cd linkstation-mod-masterTransfer rootfs from LinkStation (replace lsbox with your real LinkStation hostname or IP address): $ mkdir rootfs$ scp root@lsbox:/root/lsmod/linkstation-mod-master/rootfs/* rootfs/Prepare LinkStation stock firmware and place it in firmware folder: $ mkdir firmware$ cp path-to-buffalo-firmware/ls400-133en.zip firmware/$ unzip firmware/ls400-133en.zipCustomize scripts/debootstrap-combine.cfg (adjust HOSTNAME, NETWORK_PROTO, etc), then create hddrootfs and initrd: $ cat scripts/debootstrap-combine.cfgHOSTNAME=LS421DE88BNETWORK_INTERFACE=eth1NETWORK_PROTO=staticNETWORK_IP=172.16.1.4NETWORK_NETMASK=255.255.255.0NETWORK_GATEWAY=172.16.1.1NETWORK_DNS=172.16.1.1NETWORK_DOMAIN=ntlab.net#INITRD_TEMP_ROOT="0x811"#INITRD_ROOT="0x901"INITRD_ROOT="0x802"$ vi scripts/debootstrap-combine.cfg$ sudo ./scripts/debootstrap-combine.sh rootfs/rootfs_wheezy_armhf_141112.tar.gz rootfs/initrd_wheezy_armhf_141112.tar.gz firmware/ls400-133enUnpack Buffalo kernel image: $ sudo ./scripts/unpack-image.sh firmware/ls400-133en/uImage.img out/Debian image for LinkStation now ready in the folder out with files hddrootfs.buffalo.updated, initrd.buffalo, anduImage.buffalo. Modifying partition and installing DebianNow, detach the hard disk from LinkStation and attach it to Linux box. Ensure the disk is detected and acquire the correct device node: $ ls /dev/sd*I’m assumed the disk detected as /dev/sda. Next install mdadm if it’s not already installed: $ sudo apt-get install --no-install-recommends mdadmAssemble raid partition: $ sudo mdadm --assemble --scanStop all raid partition: $ sudo mdadm --stop /dev/md0$ sudo mdadm --stop /dev/md1$ sudo mdadm --stop /dev/md2$ sudo mdadm --stop /dev/md101Remove all raid partition: $ sudo mdadm --remove /dev/md0$ sudo mdadm --remove /dev/md1$ sudo mdadm --remove /dev/md2$ sudo mdadm --remove /dev/md101Zero super block: $ sudo mdadm --zero-superblock /dev/sda1$ sudo mdadm --zero-superblock /dev/sda2$ sudo mdadm --zero-superblock /dev/sda5$ sudo mdadm --zero-superblock /dev/sda6Create filesystems: $ sudo mkfs.ext3 /dev/sda1$ sudo mkfs.ext4 /dev/sda2$ sudo mkswap /dev/sda5$ sudo mkfs.ext4 /dev/sda6Install Debian: $ mkdir /tmp/sda1$ sudo mount /dev/sda1 /tmp/sda1$ sudo cp out/initrd.buffalo /tmp/sda1$ sudo cp out/uImage.buffalo /tmp/sda1$ mkdir /tmp/sda2$ sudo mount /dev/sda2 /tmp/sda2$ sudo ./scripts/unpack-rootfs.sh out/hddrootfs.updated.buffalo /tmp/sda2Attach back the disk to LinkStation, try pinging to test if installation was successfull. You then can SSH-ing as usual. Enable lsmonitor script and customize Debian systemNow, the final step to customize Debian system by enabling lsmonitor init script: $ cd ~$ wget https://github.com/tohenk/linkstation-mod/raw/master/lsmonitor/lsmonitor.tar.gz$ cd / && tar -xvf ~/lsmonitor.tar.gzInstall dependencies: $ apt-get install smartmontools hdparmEnable init script: $ update-rc.d lsmonitor defaultsStart lsmonitor service: $ service lsmonitor startNow, Debian system is complete. Next you can customize your Debian as you need.
原文:
|