Welcome! Log In Create A New Profile

Advanced

Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs

Posted by bodhi 
Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
January 19, 2017 03:33AM
Linux Kernel 4.10.9 MVEBU package and Debian rootfs for Zyxel NAS326, WD MyCloud EX4100 (under testing) and all other MVEBU Armada NAS in Linux mainline (armada-xp, armada-39x, armada-38x, armada-37x). If you try this kernel and rootfs with MVEBU Armada NAS please report your finding so it can be added to list of support boxes.


Latest released rootfs: Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2 (04 Feb 2017)
Latest released kernel: linux-4.10.9-mvebu-tld-1 (09 April 2017)

Zyxel NAS326 Installation: 3rd Update 25 Mar 2017 (added Section C), 2nd Update 18 Feb 2017 (added section B), 1st Update 05 Feb 2017.


Summary decription:

The released tarball linux-x.xx.x-mvebu-tld-x-bodhi.tar.bz2 includes everything you need to build your own kernel from mainline kernel source tree (patches and config file are all that needed). The kernel image is included in it for users who just want to install kernel.

The released tarball Debian-x.xx.x-mvebu-tld-xx-rootfs-bodhi.tar.bz2 is a basic armhf rootfs (a completed Debian system with kernel already installed) for Marvell EBU (MVEBU) boxes ready to be used. It is a basic system where you can build upon by installing packages. This rootfs was created by Debian debootstrap and then a few packages were installed for user’s convenience. This rootfs is dedicated for the purpose of upgrading and release distribution.


Credit: Thanks to rr4m, hean01, musv, Kirsch, and others who developed and tested in Zyxel NAS326 - Debian / Boot from USB thread. In this thread, a lot of good works have been done to build a basic kernel for Ubuntu server, Arch, and Gentoo.

========================================================================

Updated 09 April 2017:

Kernel linux-4.10.9-mvebu-tld-1 package has been uploaded.

New in this release:

- Incorporated kernel 4.10.9 mainline to fix security bugs.
- Added patches to help power down the NAS326 box without kernel spitting out an unecessary warning.
- Added patches for WOL capability (we are testing this feature).

Latest Linux kernel 4.x general release information can be found at:
LinuxChanges log

Download at Dropbox

linux-4.10.9-mvebu-tld-1-bodhi.tar.bz2
md5sum:
7751756508e3616d5ed6e16371ecc310
sha256sum:
6a0f9e4033a1f9000cd645be241de791e3ca46148afb6ea81986fcc0defd86fd

There are 6 files in this tarball:

linux-image-4.10.9-mvebu-tld-1_1.0_armhf.deb
linux-headers-4.10.9-mvebu-tld-1_1.0_armhf.deb
zImage-4.10.9-mvebu-tld-1
config-4.10.9-mvebu-tld-1
linux-dtb-4.10.9-mvebu-tld-1.tar
linux-4.10.9-mvebu-tld-1.patch

Installation

1. Backup your current zImage and uInitrd. In the /boot directory, these are files for your current kernel (xx.xx.xx is the version number):
uInitrd 
zImage-xx.xx.xx-mvebu-xxx
initrd.img-xx.xx.xx-mvebu-xxx
System.map-xx.xx.xx-mvebu-xxx
vmlinuz-xx.xx.xx-mvebu-xxx
config-xx.xx.xx-mvebu-xxx
dts/


2. Extract the kernel and the DTB files in the archive:

cd /boot
tar -xjf linux-4.10.9-mvebu-tld-1-bodhi.tar.bz2
tar -xf  linux-dtb-4.10.9-mvebu-tld-1.tar


3. And install it with dpkg. Remove flash-kernel first to avoid potential problem:

cd /boot
apt-get remove flash-kernel 
dpkg -i linux-image-4.10.9-mvebu-tld-1_1.0_armhf.deb


4. Create zImage and uInitrd.

cd /boot
cp -a zImage-4.10.9-mvebu-tld-1 zImage
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-4.10.9-mvebu-tld-1 -d initrd.img-4.10.9-mvebu-tld-1 uInitrd

5. The new zImage and uInitrd files should be created in /boot directory now. You're ready to reboot the system:
sync 
sync
sync
shutdown -r now


========================================================================

Zyxel NAS326 Installation

Updated 25 Mar 2017 (added Section C - Installation for SATA rootfs, no serial console)
Updated 18 Feb 2017 (added Section B - Installation for USB rootfs, no serial console)
Updated 05 Feb 2017 (Section A - Installation for USB rootfs, with serial console)


Installation for NAS326 box can be done with serial console connected (section A), or inside stock OS and without serial console (section B for USB rootfs, section C for SATA rootfs).

A. Instruction for the booting the NAS326 with a USB rootfs (serial console setup)

A1. Requirements

1. Serial console connected during set up (which should be removed later during normal operation).

2. Download either the latest ARM32 version or the x86-64 version of kwboot. Use it depending on the architecture of serial console converter host. Please see this post for ARM32 kwboot, and this post for x86-64 kwboot.

3. Prepare the rootfs Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2 as described in the Debian rootfs release section (right below):

Quote

Updated 04 Feb 2017:

This Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2 has been uploaded.

A2. Installation

Warning: Step 4 in the instruction in this section uses a "env/code injection" to replace the Zyxel NAS326 stock u-boot bootcmd with a different command during boot. It's a simple trick that change u-boot env bootcmd (it does not touch u-boot binary in NAND). However, this hack should not be used on a different MVEBU box (any box other than the NAS326). Doing this without examining your box's stock u-boot source code could likely messing up your u-boot envs and prevent booting, or in the worse case bricking it. Please post questions regarding installation for other MVEBU boxes, it might be possible to do this.

1. Start kwboot on the serial console host

For ARM32 kwboot:
./kwboot -t -B 115200 /dev/ttyUSB0 -d

For x86-64 kwboot:
./kwboot -t -B 115200 /dev/ttyUSB0


2. Power up the NAS326, and wait at serial console, observe kwboot spinning / while waiting for handshake.

3. After a period of time, the NAS326 will time out and start booting its stock u-boot. Interrupt u-boot at countdown. Get a listing of your current u-boot envs, and save it to a notepad in case you want to restore it later.

printenv


4. Enter the following commands (copy/paste each line to the u-boot prompt).

setenv curr_bootfrom 1
setenv next_bootfrom 1
setenv load_dtb_addr 0x1000000
setenv load_initrd_addr 0x2900000
setenv load_image_addr 0x02000000
setenv usb_init 'mw.l f1018100 20420000; mw.l f1018140 003E8800; sleep 3; usb start'
setenv set_bootargs_stock 'setenv bootargs "console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2"'
setenv bootcmd_stock_1 'run set_bootargs_stock; echo Booting from NAND kernel 1 ...; nand read 0x2000000 0x00E00000 0xF00000 && bootz 0x2000000'
setenv bootcmd_stock_2 'run set_bootargs_stock; echo Booting from NAND kernel 2 ...; nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000'
setenv usb_set_bootargs 'setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial"'
setenv usb_bootcmd 'echo Booting from USB ...; setenv fdt_skip_update yes; run usb_init; ext2load usb 0:1 $load_image_addr /boot/zImage; ext2load usb 0:1 $load_dtb_addr /boot/dts/armada-380-zyxel-nas326.dtb; ext2load usb 0:1 $load_initrd_addr /boot/uInitrd; run usb_set_bootargs; bootz $load_image_addr $load_initrd_addr $load_dtb_addr'
setenv bootcmd_custom 'if run usb_bootcmd; then; else if run bootcmd_stock_1; then; else run bootcmd_stock_2; reset; fi; fi'
setenv kernel_addr_1 '0x00000000; run bootcmd_custom; '
saveenv


5. Reset the NAS326, exit kwboot.

reset
And then press "Control \ c" to exit kwboot

6. Start kwboot again on the serial console host (use the same command as in step 1)

7. After a period of time, the NAS326 will time out and start booting its stock u-boot. Observe kernel loading and booting until seeing the Debian prompt. At this point we can either login directly with serial console, or by SHH. If login is through SSH, find the NAS:

ping debian.local

When the ping returns successful response, then login (root password is root);
ssh root@debian.local


If for whatever reason (e.g. firewall), the NAS326 cannot be found as debian.local, then find its IP in the router webpage. Or use a scanning app such as Linux nmap or IOS Fing to find the IP.

8. DONE.


A3. Normal Operation

The USB rootfs should be plugged in permanently, and the serial console module should be removed.

1. Whenever the NAS326 is rebooted or cold started, to boot without manual intervention, the serial console module must be unplugged from the NAS326. If the serial console module is plugged in, then step 1 in the installation instruction A2 must be executed (so that the NAS326 will continue booting when it detected the serial console present).

2. If you want to boot back to stock OS in NAND, just shutdown the box, unplug the USB and power up the box. It will boot the kernel 1 in NAND and then if not successful, it will try kernel 2.

This also serves as a rescue system. Whenever the rootfs on USB has problem and cannot boot (the effect is just like the USB drive is not plugged in), the NAS326 will fall back to booting the kernel 1 or 2 in NAND. When this occurs, the u-boot envs in step 4 must be reentered at serial console again to allow booting back to USB rootfs.


A4. Reverse to stock OS permanently

To reverse the setup, and boot back to stock NAND kernel permanently, execute the following instructions at serial console:

setenv kernel_addr_1 0x00E00000
setenv bootargs 'console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2'
saveenv
boot


B. Instruction for booting the NAS326 with a USB rootfs (setup without serial console)

B1. Requirements

1. Prepare the rootfs Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2 as described in the Debian rootfs release section (right below):

Quote

Updated 04 Feb 2017:

This Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2 has been uploaded.

B2. Installation

Warning: Step 4 in the instruction in this section uses a "env/code injection" to replace the Zyxel NAS326 stock u-boot bootcmd with a different command during boot. It's a simple trick that change u-boot env bootcmd (it does not touch u-boot binary in NAND). However, this hack should not be used on a different MVEBU box (any box other than the NAS326). Doing this without examining your box's stock u-boot source code could likely messing up your u-boot envs and prevent booting, or in the worse case bricking it. Please post questions regarding installation for other MVEBU boxes, it might be possible to do this.

1. Gain SSH to the NAS326 box.

Use the Zyxel NAS326 instruction (came with the box) for logging as admin user through the web page of the box, set password, and Enable SSH.

2. Open a termimal and connect to the NAS326 with SSH, and login to the box as root user.

3. After logging in, get a listing of your current u-boot envs, and save it to a notepad in case you want to restore it later.

fw_printenv


4. Enter the following commands (copy/paste each line to the stock OS command line).

fw_setenv curr_bootfrom 1
fw_setenv next_bootfrom 1
fw_setenv load_dtb_addr 0x1000000
fw_setenv load_initrd_addr 0x2900000
fw_setenv load_image_addr 0x02000000
fw_setenv usb_init 'mw.l f1018100 20420000; mw.l f1018140 003E8800; sleep 3; usb start'
fw_setenv set_bootargs_stock 'setenv bootargs "console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2"'
fw_setenv bootcmd_stock_1 'run set_bootargs_stock; echo Booting from NAND kernel 1 ...; nand read 0x2000000 0x00E00000 0xF00000 && bootz 0x2000000'
fw_setenv bootcmd_stock_2 'run set_bootargs_stock; echo Booting from NAND kernel 2 ...; nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000'
fw_setenv usb_set_bootargs 'setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial"'
fw_setenv usb_bootcmd 'echo Booting from USB ...; setenv fdt_skip_update yes; run usb_init; ext2load usb 0:1 $load_image_addr /boot/zImage; ext2load usb 0:1 $load_dtb_addr /boot/dts/armada-380-zyxel-nas326.dtb; ext2load usb 0:1 $load_initrd_addr /boot/uInitrd; run usb_set_bootargs; bootz $load_image_addr $load_initrd_addr $load_dtb_addr'
fw_setenv bootcmd_custom 'if run usb_bootcmd; then; else if run bootcmd_stock_1; then; else run bootcmd_stock_2; reset; fi; fi'
fw_setenv kernel_addr_1 '0x00000000; run bootcmd_custom; '
fw_setenv change_boot_part 1

And then list the u-boot envs again, and save it to a notepad in case there is problem with booting and it needs to be referenced.
fw_printenv


5. Plug in the USB rootfs Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2, and reboot

sync
sync
/sbin/reboot

7. After a period of time, the NAS326 will start rebooting. Wait for about 30 seconds and login through SSH.

To find the NAS:
ping debian.local

When the ping returns successful response, then login (root password is root);
ssh root@debian.local

If for whatever reason (e.g. firewall), the NAS326 cannot be found as debian.local, then find its IP in the router webpage. Or use a scanning app such as Linux nmap or IOS Fing to find the IP.

8. DONE.


B3. Normal Operation

The USB rootfs should be plugged in permanently, and if there is serial console module attached before then it should be removed during booting.

1. Whenever the NAS326 is rebooted or cold started, to boot without manual intervention, the serial console module must be unplugged from the NAS326. If the serial console module is plugged in, then step 1 in the Section A2 installation instruction must be executed (so that the NAS326 will continue booting when it detected the serial console present).

2. If you want to boot back to stock OS in NAND, just shutdown the box, unplug the USB and power up the box. It will boot the kernel 1 in NAND and then if not successful, it will try kernel 2.

This also serves as a rescue system. Whenever the rootfs on USB has problem and cannot boot (the effect is just like the USB drive is not plugged in), the NAS326 will fall back to booting the kernel 1 or 2 in NAND. When this occurs, the u-boot envs in step 4 must be reentered at Debian command line again to allow booting back to USB rootfs.

B4. Reverse to stock OS permanently

To reverse the setup, and boot back to stock NAND kernel permanently, execute the following instructions at the Debian command line:

fw_setenv kernel_addr_1 0x00E00000
fw_setenv bootargs 'console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2'
and then reboot
sync
shutdown -r now

C. Instruction for booting the NAS326 with rootfs on internal HDD (setup without serial console)

C1. Requirements

1. Prepare the rootfs Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2, using one of the internal HDD, as described in the Debian rootfs release section (right below):

Quote

Updated 04 Feb 2017:

This Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2 has been uploaded.

C2. Installation

Warning: Step 4 in the instruction in this section uses a "env/code injection" to replace the Zyxel NAS326 stock u-boot bootcmd with a different command during boot. It's a simple trick that change u-boot env bootcmd (it does not touch u-boot binary in NAND). However, this hack should not be used on a different MVEBU box (any box other than the NAS326). Doing this without examining your box's stock u-boot source code could likely messing up your u-boot envs and prevent booting, or in the worse case bricking it. Please post questions regarding installation for other MVEBU boxes, it might be possible to do this.

1. Gain SSH to the NAS326 box.

Use the Zyxel NAS326 instruction (came with the box) for logging as admin user through the web page of the box, set password, and Enable SSH.

2. Open a termimal and connect to the NAS326 with SSH, and login to the box as root user.

3. After logging in, get a listing of your current u-boot envs, and save it to a notepad in case you want to restore it later.

fw_printenv


4. Enter the following commands (copy/paste each line to the stock OS command line).

setenv curr_bootfrom 1
setenv next_bootfrom 1
setenv load_dtb_addr 0x1000000
setenv load_initrd_addr 0x2900000
setenv load_image_addr 0x02000000
setenv set_bootargs_stock 'setenv bootargs "console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2"'
setenv bootcmd_stock_1 'run set_bootargs_stock; echo Booting from NAND kernel 1 ...; nand read 0x2000000 0x00E00000 0xF00000 && bootz 0x2000000'
setenv bootcmd_stock_2 'run set_bootargs_stock; echo Booting from NAND kernel 2 ...; nand read 0x2000000 0x08700000 0xF00000 && bootz 0x2000000'

setenv sata_init 'mw.l f1018100 20420000; mw.l f1018140 003ca800; sleep 3; scsi init'
setenv sata_bootcmd 'echo Booting from SATA ...; setenv fdt_skip_update yes; run sata_init; ext2load scsi 0:1 $load_image_addr /boot/zImage; ext2load scsi 0:1 $load_dtb_addr /boot/dts/armada-380-zyxel-nas326.dtb; ext2load scsi 0:1 $load_initrd_addr /boot/uInitrd; run sata_set_bootargs; bootz $load_image_addr $load_initrd_addr $load_dtb_addr'
setenv sata_set_bootargs 'setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial"'
setenv bootcmd_custom_sata 'if run sata_bootcmd; then; else if run bootcmd_stock_1; then; else run bootcmd_stock_2; reset; fi; fi'
setenv bootcmd_custom 'run bootcmd_custom_sata'
setenv kernel_addr_1 '0x00000000; run bootcmd_custom; '
saveenv

And then list the u-boot envs again, and save it to a notepad in case there is problem with booting and it needs to be referenced.
fw_printenv


5. Insert the HDD with rootfs Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2, if not already inside the box, and reboot

sync
sync
/sbin/reboot

7. After a period of time, the NAS326 will start rebooting. Wait for about 30 seconds and login through SSH.

To find the NAS:
ping debian.local

When the ping returns successful response, then login (root password is root);
ssh root@debian.local

If for whatever reason (e.g. firewall), the NAS326 cannot be found as debian.local, then find its IP in the router webpage. Or use a scanning app such as Linux nmap or IOS Fing to find the IP.

8. DONE.


C3. Normal Operation

The HDD rootfs should be plugged in permanently, and if there is serial console module attached before then it should be removed during booting.

1. Whenever the NAS326 is rebooted or cold started, to boot without manual intervention, the serial console module must be unplugged from the NAS326. If the serial console module is plugged in, then step 1 in the Section A2 installation instruction must be executed (so that the NAS326 will continue booting when it detected the serial console present).

2. If you want to boot back to stock OS in NAND, just shutdown the box, remove the HDD rootfs and power up the box. It will boot the kernel 1 in NAND and then if not successful, it will try kernel 2.

This also serves as a rescue system. Whenever the rootfs on HDD has problem and cannot boot (the effect is just like the HDD drive is not plugged in), the NAS326 will fall back to booting the kernel 1 or 2 in NAND. When this occurs, the u-boot envs in step 4 must be reentered at Debian command line again to allow booting back to HDD rootfs.

C4. Reverse to stock OS permanently

To reverse the setup, and boot back to stock NAND kernel permanently, execute the following instructions at the Debian command line:

fw_setenv kernel_addr_1 0x00E00000
fw_setenv bootargs 'console=ttyS0,115200 ubi.mtd=4,2048 rootfstype=ubifs root=ubi0:rootfs1 rw rootdelay=2'
and then reboot
sync
shutdown -r now


=====================================================================================

Updated 04 Feb 2017:

This Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2 has been uploaded.


Basic minimal Debian armhf rootfs for most MVEBU Armada NAS:

- tarball size: 160M
- install size: 554M
- a basic jessie armhf rootfs.
- The init system used in this rootfs is sysvinit . To boot with systemd, see note 2 below.
- Installed packages: openssh-server, nano, avahi, libnss-mdns, ntp, busybox-syslogd (log to RAM), htop, isc-dhcp-client, locales, dialog, bzip2, nfs-kernel-server, nfs-common, iperf, ethtool, sysvinit-core, sysvinit, and sysvinit-utils, mtd-utils, u-boot-tools, rsync, pmount, i2c-tools, qemu-arm-static.

- see LED controls in /etc/rc.local
- see some useful aliases in /root/.profile
- root password: root

Download at Dropbox:

Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2
md5:
dac69fb0c46d056ff96500f730e9d3d1
sha256:
0b9086dbb641c583eb1e10b7fd8d157abd4f1a1c5f7e772a6dffb75947620b20

And remember to check the hash of what you download, as always.


Installation:

Installation can be done on any Linux box, with a fresh USB drive (SD card or HDD would work fine too).

Important: all steps below must be done while logging in as root user (not sudo). If you are not the root user then don't continue, because the rootfs will not work.

1. Format a new USB drive with a single Ext3 partition, and label it rootfs.

2. Mount the drive on a Linux box. cd to top level directory and extract the rootfs. Assuming the USB drive is mounted at /media/sdb1
cd /media/sdb1 
tar -xjf Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2
cd /media/sdb1/boot
cp -a zImage-4.9.0-mvebu-tld-12 zImage

3. Adjust fstab.

Edit /media/sdb1/etc/fstab entry for /dev/root.
/dev/root      /               ext3    noatime,errors=remount-ro 0 1

4. Sync, umount, and Done.

sync
sync
umount /media/sdb1


Take this USB rootfs to your NAS and cold start. Depending on the flavor of MVEBU boxes you have, further u-boot envs setup is needed to boot this rootfs. Instruction will be provided here for each MVEBU box, or a group of boxes that use the same u-boot.

After booted into Debian, see Note1 and Note2 below. It is very important that you do Note1 steps to secure your box.


Note1:

After logging in this rootf the first time, remember to generate new SSH key to make it your own unique rootfs. And also update your rootfs to get the latest Debian package security updates:
rm /etc/ssh/ssh_host*
ssh-keygen -A

apt-get update
apt-get upgrade

Note2:

To boot with systemd, add this parameter to your u-boot env bootargs:
init=/bin/systemd
For example,
fw_setenv usb_set_bootargs 'setenv bootargs "console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts earlyprintk=serial init=/bin/systemd"'

If that's still not possible to run systemd, you might want to install it again:
apt-get install systemd

=====================================================================================

Updated 03 Feb 2017:

Kernel linux-4.9.0-mvebu-tld-12 package has been uploaded. This kernel has been fully developed with all the capabilities similar to the Kirkwook kernel.

Notables:

- This kernel is configured as SMP PREEMPT (supports up to 4 cores and run with preemptive scheduler).
- Power Off works fine, but will print out a warning in console (which can be safely ignored).
- For fan speed and CPU temperature reading see this post.
- SPI is temporarily removed until we can find out more info.


Latest Linux kernel 4.x general release information can be found at:
LinuxChanges log

Download at Dropbox

linux-4.9.0-mvebu-tld-12-bodhi.tar.bz2

md5:
3e4eba2fa0382304adca9f23c0a21000
sha256:
734f4149407a999120f48f2d11d72b0b0a6ab48d26f568001c19e386dd2e191b


There are 6 files in this tarball:
linux-image-4.9.0-mvebu-tld-12_12.0_armhf.deb
linux-headers-4.9.0-mvebu-tld-12_12.0_armhf.deb
zImage-4.9.0-mvebu-tld-12
config-4.9.0-mvebu-tld-12
linux-dtb-4.9.0-mvebu-tld-12.tar
linux-4.9.0-mvebu-tld-12.patch


Installation


1. Backup your current kernel files. In the /boot directory, these are files for your current kernel (xx.xx.xx is the version number):
uInitrd 
uImage
zImage-xx.xx-mvebu-xxx
initrd.img-xx.xx.xx-mvebu-xxx
System.map-xx.xx.xx-mvebu-xxx
vmlinuz-xx.xx.xx-mvebu-xxx
config-xx.xx.xx-mvebu-xxx
dts/


2. Extract the kernel and the DTB files in the archive:

cd /boot
tar -xjf linux-4.9.0-mvebu-tld-12-bodhi.tar.bz2
tar -xf  linux-dtb-4.9.0-mvebu-tld-12.tar


3. And install it with dpkg. Remove flash-kernel first to avoid potential problem.

cd /boot
apt-get remove flash-kernel 
dpkg -i linux-image-4.9.0-mvebu-tld-12_12.0_armhf.deb


4. Create uInitrd and zImage

cd /boot
cp -a zImage-4.9.0-mvebu-tld-12 zImage
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-4.9.0-mvebu-tld-12 -d initrd.img-4.9.0-mvebu-tld-12 uInitrd


5. You're ready to reboot the system:
sync 
sync
sync
shutdown -r now



============== Below are old posts, kept for posterity ================================

Updated 23 Jan 2017:

This Debian-4.9.0-mvebu-tld-9-rootfs-bodhi.tar.bz2 is my first release for the Marvell MVEBU boxes.

Basic minimal Debian armhf rootfs for most MVEBU NAS:

- tarball size: 133M
- install size: 481M
- a basic jessie armhf rootfs.
- The init system used in this rootfs is sysvinit . To boot with systemd, see note 2 below.
- Installed packages: openssh-server, nano, avahi, libnss-mdns, ntp, busybox-syslogd (log to RAM), htop, isc-dhcp-client, locales, dialog, bzip2, nfs-kernel-server, nfs-common, iperf, ethtool, sysvinit-core, sysvinit, and sysvinit-utils, mtd-utils, u-boot-tools, rsync, pmount, i2c-tools, qemu-arm-static.

- see LED controls in /etc/rc.local
- see some useful aliases in /root/.profile
- root password: root

Download at Dropbox:

Debian-4.9.0-mvebu-tld-9-rootfs-bodhi.tar.bz2
md5:
ecd4e7d384eea920d2def9aed95c9d48
sha256:
7f2ce42ca7fa1807fb0db2bc5946c91a19876739520ce8e2bd33bdb09cdbdf26

And remember to check the hash of what you download, as always.

Installation:

Installation can be done on any Linux box, with a fresh USB drive (SD card or HDD would work fine too).

Important: all steps below must be done while logging in as root user (not sudo). If you are not the root user then don't continue, because the rootfs will not work.

1. Format a new USB drive with a single Ext3 partition, and label it rootfs.

2. Mount the drive on a Linux box. cd to top level directory and extract the rootfs. It is assuming the USB drive is mounted at /media/sdb1
cd /media/sdb1 
tar -xjf Debian-4.9.0-mvebu-tld-9-rootfs-bodhi.tar.bz2
cd ./boot
cp -a zImage-4.9.0-mvebu-tld-9 zImage

3. Adjust fstab.

Edit /media/sdb1/etc/fstab entry for /dev/root.
/dev/root      /               ext3    noatime,errors=remount-ro 0 1

4. Sync, umount, and Done.

sync
sync
umount /media/sdb1


Take this USB rootfs to your NAS and cold start. Depending on the flavor of MVEBU boxes you have, further u-boot envs setup is needed to boot this rootfs. Instruction will be provided here for each box, or a group of boxes that use the same u-boot.

After booted into Debian, see Note1 and Note2 below. It is very important that you do Note1 steps to secure your box.


Note1:

After logging in this rootf the first time, remember to generate new SSH key to make it your own unique rootfs. And also update your rootfs to get the latest Debian package security updates:
rm /etc/ssh/ssh_host*
ssh-keygen -A

apt-get update
apt-get upgrade

Note2:

To boot with systemd, add this parameter to your u-boot env bootargs:
init=/bin/systemd
For example,
fw_setenv usb_set_bootargs 'setenv bootargs console=$console root=LABEL=rootfs rootdelay=10 $mtdparts init=/bin/systemd'

If that's still not possible to run systemd, you might want to install it again:
apt-get install systemd


=====================================================================================
Updated 22 Jan 2017:

Please use the latest Zyxel NAS326 DTB in this post:

http://forum.doozan.com/read.php?2,27108,32224#msg-32224

=====================================================================================
Updated 21 Jan 2017:

Kernel linux-4.9.0-mvebu-tld-8 package has been uploaded.

- This kernel is configured as SMP PREEMPT (supports up to 4 cores and run with preemptive scheduler).
- All LEDS triggers should be working correctly in this version (see /sys/class/leds).
- Kernel ring buffer (dmesg) size increased enough to capture all boot activities.
- Power Off works fine, but will print out a warning in console (which can be safely ignored).
- For fan speed and CPU temperature reading see this post.
- SPI is temporarily removed until we can find out more info.

Latest Linux kernel 4.x general release information can be found at:
LinuxChanges log

Download at Dropbox

linux-4.9.0-mvebu-tld-8-bodhi.tar.bz2

md5:
1778c7902abcd1c6a91bcde3ea85c14b
sha256
e957e08c878e7e6254c643cec9fe9488d2b5995aaab437addece92de67a92f07

There are 6 files in this tarball:
linux-image-4.9.0-mvebu-tld-8_8.0_armhf.deb
linux-headers-4.9.0-mvebu-tld-8_8.0_armhf.deb
zImage-4.9.0-mvebu-tld-8
config-4.9.0-mvebu-tld-8
linux-dtb-4.9.0-mvebu-tld-8.tar
linux-4.9.0-mvebu-tld-8.patch

Installation

TBD...


=====================================================================================
Updated 18 Jan 2017:

Kernel linux-4.9.0-mvebu-tld-7 package has been uploaded.

Latest Linux kernel 4.x general release information can be found at:
LinuxChanges log

Download at Dropbox
linux-4.9.0-mvebu-tld-7-bodhi.tar.bz2

md5:
6ce453788634af51d5fd684334b9fe2e
sha256:
f9d29ab8bfe5933cdebc22a136b828968cf64c51c68ab278a920858c9db63be9

There are 5 files in this tarball:

linux-image-4.9.0-mvebu-tld-7_7.0_armhf.deb
linux-headers-4.9.0-mvebu-tld-7_7.0_armhf.deb
config-4.9.0-mvebu-tld-7
zImage-4.9.0-mvebu-tld-7
linux-dtb-4.9.0-mvebu-tld-7.tar

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 56 time(s). Last edit at 06/25/2017 02:36AM by bodhi.
Re: Linux Kernel 4.9.0 MVEBU package and Debian rootfs
January 19, 2017 03:34AM
Re: Linux Kernel 4.9.0 MVEBU package and Debian rootfs
January 19, 2017 03:45AM
Re: Linux Kernel 4.9.0 MVEBU package and Debian rootfs
February 05, 2017 05:37PM
The new rootfs and kernel package have been uploaded. Please see 1st post for download link and installation procedure.

Quote

Zyxel NAS326 Installation
Updated 05 Feb 2017


Quote

Updated 04 Feb 2017:

This Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2 has been uploaded.

Quote

Updated 03 Feb 2017:

Kernel linux-4.9.0-mvebu-tld-12 package has been uploaded.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 1 time(s). Last edit at 02/06/2017 03:47AM by bodhi.
Re: Linux Kernel 4.9.0 MVEBU package and Debian rootfs
February 18, 2017 06:05AM
Instruction for Zyxel NAS326 Installation has been updated: added section B (setup without serial console).

Quote

Zyxel NAS326 Installation

Updated 18 Feb 2017 (added Section B)
Updated 05 Feb 2017

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Linux Kernel 4.9.0 MVEBU package and Debian rootfs
April 09, 2017 04:52PM
Re: Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
May 11, 2017 03:27AM
Hi bodhi,

am i right that this kernel and rootfs could fit my WD MyCloud EX 4100 as it has an Marvell Armada 380/381/382/385/388 (Device Tree).

cat /proc/version gives me the folliwing information

Linux version 3.10.39 (kman@kmachine) (gcc version 4.6.4 (Linaro GCC branch-4.6.4. Marvell GCC Dev 201310-2126.3d181f66 64K MAXPAGESIZE ALIGN) ) #2 SMP Fri Aug 12 15:59:39 CST 2016 2014T30p5 Build-git9e099f3

and cat /proc/cpuinfo gives me the following information

processor       : 0
model name      : ARMv7 Processor rev 1 (v7l)
BogoMIPS        : 3188.32
Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x4
CPU part        : 0xc09
CPU revision    : 1

processor       : 1
model name      : ARMv7 Processor rev 1 (v7l)
BogoMIPS        : 3188.32
Features        : swp half thumb fastmult vfp edsp neon vfpv3 tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x4
CPU part        : 0xc09
CPU revision    : 1

Hardware        : Marvell Armada 380/381/382/385/388 (Device Tree)
Revision        : 0000
Serial          : 0000000000000000

There is already someone who attempted to create a debian port for this device on this thread https://community.wd.com/t/clean-os-debian-openmediavault-and-other-firmwares/93714/1290

From this guy there are already files available there https://drive.google.com/drive/folders/0B_6OlQ_H0PxVVGdTRGl0RmRabVU

but unfortunately there are instructions missing and i am not able to figure out how to use those files securely without problems.

I would like to have this device booting the rootfs from an usb pen drive without touching the original firmware if possible but i am not fit enough to figure out what information is needed and how to get them.
Maybe you could point me in the right direction or let me know what information you need to verify that this device would work with your kernel and rootfs.
Unfortunately the original firmware has only a limited busybox available via ssh but i can sftp to the box for further investigation if needed.

-
happy hacking,

saschadd
Re: Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
May 11, 2017 04:59AM
saschadd,

> Hi bodhi,
>
> am i right that this kernel and rootfs could fit m
> y WD MyCloud EX 4100 as it has an Marvell Armada 3
> 80/381/382/385/388 (Device Tree).
>
> cat /proc/version gives me the folliwing informati
> on
>
>
> Linux version 3.10.39 (kman@kmachine) (gcc version
> 4.6.4 (Linaro GCC branch-4.6.4. Marvell GCC Dev 20
> 1310-2126.3d181f66 64K MAXPAGESIZE ALIGN) ) #2 SMP
> Fri Aug 12 15:59:39 CST 2016 2014T30p5 Build-git9e
> 099f3
>
>
> and cat /proc/cpuinfo gives me the following infor
> mation
>
>
> processor       : 0
> model name      : ARMv7 Processor rev 1 (v7l)
> BogoMIPS        : 3188.32
> Features        : swp half thumb fastmult vfp edsp
> neon vfpv3 tls
> CPU implementer : 0x41
> CPU architecture: 7
> CPU variant     : 0x4
> CPU part        : 0xc09
> CPU revision    : 1
> 
> processor       : 1
> model name      : ARMv7 Processor rev 1 (v7l)
> BogoMIPS        : 3188.32
> Features        : swp half thumb fastmult vfp edsp
> neon vfpv3 tls
> CPU implementer : 0x41
> CPU architecture: 7
> CPU variant     : 0x4
> CPU part        : 0xc09
> CPU revision    : 1
> 
> Hardware        : Marvell Armada 380/381/382/385/3
> 88 (Device Tree)
> Revision        : 0000
> Serial          : 0000000000000000
>
>
> There is already someone who attempted to create a
> debian port for this device on this thread https:/
> /community.wd.com/t/clean-os-debian-openmediavault
> -and-other-firmwares/93714/1290
>
> From this guy there are already files available th
> ere https://drive.google.com/drive/folders/0B_6OlQ
> _H0PxVVGdTRGl0RmRabVU
>
> but unfortunately there are instructions missing a
> nd i am not able to figure out how to use those fi
> les securely without problems.
>
> I would like to have this device booting the rootf
> s from an usb pen drive without touching the origi
> nal firmware if possible but i am not fit enough t
> o figure out what information is needed and how to
> get them.
> Maybe you could point me in the right direction or
> let me know what information you need to verify th
> at this device would work with your kernel and roo
> tfs.
> Unfortunately the original firmware has only a lim
> ited busybox available via ssh but i can sftp to t
> he box for further investigation if needed.

Yes, most definitely will boot with my released basic rootfs (I looked at this box specs before). You just need to choose the correct DTB in /boot/dts/. And then adjust the env for dtb in serial console. Test boot that adjustment without saving envs. Once you have booted into Debian and verified everything works, then save the env with fw_setenv.

If you cant find the exact DTB for EX4100 in /boot/dts, please list more info about this WD such as : USBs, HDDs, ethenet LAN chip model, I2C, SPI, RAM size, boot log, ... we can figure this out together.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
May 11, 2017 07:43AM
Re: Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
May 11, 2017 08:33AM
bodhi,

sounds good so far.

Could you "read" from the DTS if this box can be bootet from usb?
At the moment i have no serial console access to this box and havent yet figured out if and where there is a serial connector.
To switch the boot mode serial console access is needed, right?
Or could i change env data without serial console access?
I know about there was a way for the nsa325v2 where you have to put some files on a pen drive and boot from that to switch env settings.

-
happy hacking,

saschadd
Re: Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
May 11, 2017 11:33AM
saschadd,

This is a new box so you need serial console, to be safe. We dont know what commands this stock uboot supports. So it is unwise to change any of the envs in Linux to boot usb. Serial console is a must have.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 1 time(s). Last edit at 05/11/2017 11:51AM by bodhi.
Re: Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
May 14, 2017 01:31AM
Re: Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
May 15, 2017 08:39AM
saschadd,

Please start a new tthread:

Debian on WD MyCloud EX 4100

And repost the starting content such as in your post:
http://forum.doozan.com/read.php?2,32146,34046#msg-34046

(I never have much luck with this forum thread split function so I might mess it up again :).

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 1 time(s). Last edit at 05/15/2017 08:42AM by bodhi.
Re: Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
May 15, 2017 09:37AM
Done!
See here http://forum.doozan.com/read.php?2,34103

bodhi Wrote:
-------------------------------------------------------
> saschadd,
>
> Please start a new tthread:
>
> Debian on WD MyCloud EX 4100
>
> And repost the starting content such as in your po
> st:
> http://forum.doozan.com/read.php?2,32146,34046#msg
> -34046
>
> (I never have much luck with this forum thread spl
> it function so I might mess it up again :).
Hello.

I try to install the debian to usb. And after the reboot my NAS not boot. USB sometimes blinking but i can't access to my NAS. When I remove the usb and reboot it starts with orginal OS. I don't have TTL interface to look at the bootlog. I created the ext3 partition labeled "rootfs" on the usb and extracted the image Debian-4.9.0-mvebu-tld-12-rootfs-bodhi.tar.bz2. So i have question. I connect USB to the front panel port it is good?
OK. It's working. But why interface only working on 1 Gbit? When i connect the device to the 100 Mbps port it not connected. And another question what i need to compile new kernel?
Re: Linux Kernel 4.10.9 MVEBU package and Debian armhf rootfs
June 03, 2017 03:29PM
Dzanar,

> OK. It's working

Cool!

> But why interface only working o
> n 1 Gbit? When i connect the device to the 100 Mbp
> s port it not connected. And another question what
> i need to compile new kernel?

Please post a new Debian topic for problem like this.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: