General NAS-Central Forums

Welcome to the NAS community
It is currently Mon May 01, 2017 12:37 am

All times are UTC




Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu May 08, 2014 7:41 pm 
Offline

Joined: Thu May 08, 2014 7:25 pm
Posts: 13
Hello all,

I have a question regarding the proper settings of the uboot (uImage) creation. I downloaded the EMC Lifeline SDK and using their feroeceon_5_1_3_KW kernel source i modified the kernel config using menu config. After adding support for bridging and netfilter/iptables I simply rebuilt the kernel using 'make uImage'. This was all done cross-compiling from my desktop pc.

The final output being:

Code:
  LD      vmlinux
  SYSMAP  System.map
  SYSMAP  .tmp_System.map
  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
  AS      arch/arm/boot/compressed/head.o
  GZIP    arch/arm/boot/compressed/piggy.gz
  AS      arch/arm/boot/compressed/piggy.o
  CC      arch/arm/boot/compressed/misc.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-2.6.31.8
Created:      Thu May  8 21:08:49 2014
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    2953948 Bytes = 2884.71 kB = 2.82 MB
Load Address: 00008000
Entry Point:  00008000
  Image arch/arm/boot/uImage is ready


However, i was wondering if the Load address shouldn't be something like 0x10000, or isn't this the byte offset for the HDD? ... In other words, has anyone attempted this and if so how did they proceed? ;) I did backup the first 8 MB from /dev/sda to save the partition table and official uImage/initrd just in case i mess up...


Top
 Profile  
 
PostPosted: Thu May 08, 2014 7:52 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 5981
wbdsgnr wrote:
i was wondering if the Load address shouldn't be something like 0x10000, or isn't this the byte offset for the HDD?
No, it's unrelated. U-boot has the address of the uImage on disk somewhere in it's environment. It uses this address to read uImage, and put it somewhere in (ram) memory (somewhere also defined in u-boot env). Then it decodes the uImage header, which contains this Load Address and Entry Point. The payload of the uImage is copied to Load Address, and execution is passed to Entry Point.


Top
 Profile  
 
PostPosted: Fri May 09, 2014 9:45 am 
Offline

Joined: Thu May 08, 2014 7:25 pm
Posts: 13
Vriendelijk bedankt :) For future reference, I dd'd the same uImage file to the bs=512 seek=2048 sector and it's booting with the new kernel now. All that's left is getting bridging to work properly.. Which was my initial goal!

So steps to take:
- Download EMC lifeline SDK
- under /arm_codesourcery/usr/src/linux the kernel can be found (which currently is 2.6.31.8)
- I had to edit the makefile to use to proper arm gcc version for cross compiling
- make menuconfig and modfiy the kernel
- make uImage and make modules
- dd uImage to right sector and replace the system.map under /boot with the new one

[edit]
Since /lib is mounted read-only I mounted the /boot/images/apps image to a new directory, make modules_install into that directory, umount the image, reboot and voila, all the modules are installed and ready to use.

That's all :)


Top
 Profile  
 
PostPosted: Fri May 09, 2014 12:01 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 5981
Out of curiosity: what is the purpose of bridging on a single NIC device?


Top
 Profile  
 
PostPosted: Fri May 09, 2014 12:32 pm 
Offline

Joined: Thu May 08, 2014 7:25 pm
Posts: 13
I am setting up an openVPN server and wanted to route/NAT all traffic from the logical tun device to the physical eth0 device. I needed iptables to work for this and in case of the openvpn bridging mode i'd need to have bridging set-up as well. Hence adding netfilter and bridging support to the kernel. I now am able to setup the openvpn server and route all traffic from the clients through the server and thus i can use my phone and laptop safely anywhere.


Top
 Profile  
 
PostPosted: Tue May 27, 2014 1:51 am 
Offline

Joined: Tue May 27, 2014 1:47 am
Posts: 10
wbdsgnr wrote:
I am setting up an openVPN server and wanted to route/NAT all traffic from the logical tun device to the physical eth0 device. I needed iptables to work for this and in case of the openvpn bridging mode i'd need to have bridging set-up as well. Hence adding netfilter and bridging support to the kernel. I now am able to setup the openvpn server and route all traffic from the clients through the server and thus i can use my phone and laptop safely anywhere.


Can you share results?


Top
 Profile  
 
PostPosted: Wed Jun 18, 2014 7:05 am 
Offline

Joined: Thu May 08, 2014 7:25 pm
Posts: 13
Sorry for the late reply. What kind of results are you looking for? Like mentioned, everything works :) Let me know!


Top
 Profile  
 
PostPosted: Thu Jul 10, 2014 6:21 am 
Offline

Joined: Tue May 27, 2014 1:47 am
Posts: 10
It's okay. Thank you for answer anyway.

Can you please share patched kernel sources, it's default configuration and information how to modify makefile for:
1. Compile the source at NAS itself.
2. Compile the source at x86/x86_64 machine.


Top
 Profile  
 
PostPosted: Mon Jul 28, 2014 11:49 am 
Offline

Joined: Thu May 08, 2014 7:25 pm
Posts: 13
Ah like that. I simply used the development package from EMC. You can download it on their developers website (first register a free account). I used the LifeLine-SDK-4.0.2.9960 version. It contains the kernel sources, configs, compiler and everything. I don't think the kernel itself is updated when installing a new update for the device so this should still be valid.


Top
 Profile  
 
PostPosted: Mon Jul 28, 2014 1:58 pm 
Offline

Joined: Tue May 27, 2014 1:47 am
Posts: 10
wbdsgnr wrote:
Ah like that. I simply used the development package from EMC. You can download it on their developers website (first register a free account). I used the LifeLine-SDK-4.0.2.9960 version. It contains the kernel sources, configs, compiler and everything. I don't think the kernel itself is updated when installing a new update for the device so this should still be valid.


Thank you, now I've found this. Can u please gimme info about modifying make file(s)?


Top
 Profile  
 
PostPosted: Tue Jul 29, 2014 7:54 am 
Offline

Joined: Thu May 08, 2014 7:25 pm
Posts: 13
Make sure the codesourcery toolchain is in your PATH variable (i did all of this on linux btw... ) and note the name of the toolchain (with me arm-none-linux-gnueabi) then modify the the last line of

Quote:
# CROSS_COMPILE specify the prefix used for all executables used
# during compilation. Only gcc and related bin-utils executables
# are prefixed with $(CROSS_COMPILE).
# CROSS_COMPILE can be set on the command line
# make CROSS_COMPILE=ia64-linux-
# Alternatively CROSS_COMPILE can be set in the environment.
# Default value for CROSS_COMPILE is not to prefix executables
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
export KBUILD_BUILDHOST := $(SUBARCH)
ARCH ?= arm
CROSS_COMPILE ?= arm-mv5sft-linux-gnueabi-


to the name of the toolchain.. so basically replace mv5sft with none


Top
 Profile  
 
PostPosted: Wed Jul 30, 2014 6:20 pm 
Offline

Joined: Thu May 08, 2014 7:25 pm
Posts: 13
As a word of caution: before you dd anything to the first sectors of the hard-drive, i recommend making a backup of the first 8 or more megabytes. This way if a mistake is made you can always put back the partition table and original kernel via your computer.

I was mistaken in saying they don't update the kernel cause they do. Today i've been trying to repeat the process as described above with updated SDK kernel/toolchain but somehow the system won't boot with the custom kernel.. uboot seems able in finding the kernel (no red light) but otherwise it isn't booting, not even leaving any log files for me to read. I'm not sure where i'm going wrong yet and i'm leaving for holidays in two days so you might have to wait a while before i get back with a solution :) Unless you've already succeeded of course :)


Top
 Profile  
 
PostPosted: Thu Jul 31, 2014 8:09 am 
Offline

Joined: Tue May 27, 2014 1:47 am
Posts: 10
wbdsgnr wrote:
As a word of caution: before you dd anything to the first sectors of the hard-drive, i recommend making a backup of the first 8 or more megabytes. This way if a mistake is made you can always put back the partition table and original kernel via your computer.

I was mistaken in saying they don't update the kernel cause they do. Today i've been trying to repeat the process as described above with updated SDK kernel/toolchain but somehow the system won't boot with the custom kernel.. uboot seems able in finding the kernel (no red light) but otherwise it isn't booting, not even leaving any log files for me to read. I'm not sure where i'm going wrong yet and i'm leaving for holidays in two days so you might have to wait a while before i get back with a solution :) Unless you've already succeeded of course :)


This kind of uboot booting is only workaround for:
- no GPT support in uboot, which means no disk larger than 2TB, first thing I've done is to point to ext2 partition instead of pointing first kernel sector. :)
I don't use GPT it's useless @ linux. :)

root@debian:~# fdisk -l

Disk /dev/sda: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000bb21

Device Boot Start End Blocks Id System
/dev/sda1 2048 20973567 10485760 83 Linux

root@debian:~# mount -l
/dev/root on / type ext2 (rw,noatime,errors=remount-ro)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=11708k,mode=755)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=23400k)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
tmpfs on /mnt/vtmpfs type tmpfs (rw,relatime,size=1048576k)
nfsd on /proc/fs/nfsd type nfsd (rw,relatime)
/dev/loop0 on /storage type ext4 (rw,noatime,nodiratime,errors=remount-ro,commit=99999,barrier=0,nobh,data=writeback)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
tmpfs on /run/samba type tmpfs (rw,relatime)
tmpfs on /var/cache/samba type tmpfs (rw,relatime)
tmpfs on /run/samba type tmpfs (rw,relatime)
tmpfs on /var/cache/samba type tmpfs (rw,relatime)
root@debian:~#

root@debian:~# cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

#turn on LED
echo 1 > /sys/class/nasled/hdd1_link
echo 0 > /sys/class/nasled/hdd1_red_led
echo 0 > /sys/class/nasled/system_red_led
echo 0 > /sys/class/nasled/pwr_white_led
echo 1 > /sys/class/nasled/system_red_led

# mount storage
losetup --offset 10738466817 /dev/loop0 /dev/sda
fsck.ext4 /dev/loop0 -y
mount /dev/loop0 /storage -o noatime,nodiratime,data=writeback,barrier=0,nobh,errors=remount-ro,commit=99999



# NFS
service nfs-common restart
service rpcbind restart
service nfs-kernel-server restart

hdparm -S60 /dev/sda # 5 min
#hdparm -S180 /dev/sda # 15 min
# apply system teaks
sysctl -p


#remove oldroot
#umount /oldroot
#rmdir /oldroot

#rdate time.bora.net

exit 0


Top
 Profile  
 
PostPosted: Thu Jul 31, 2014 9:57 am 
Offline

Joined: Thu May 08, 2014 7:25 pm
Posts: 13
Am I to understand you're not running the lifeline system on top of Debian? But you're a bit ahead of me, correct me if i'm wrong please:
- You repartitioned the disk and instead of writing the kernel to 2048 you have the linux partition start there
-> It's still uboot that starts the whole boot process, isn't it? So what's this about uboot not supporting GPT... it's already a GPT partitioned disk with me? (i've got the 1 GB version)
-> doesn't uboot load the kernel and boot it, which in turn runs the initrd system, which in turn boots the rest of the system?

you point loop0 to some image with
losetup --offset 10738466817 /dev/loop0 /dev/sda
After which you mount it to /storage ... so this is the logical RAID volume holding the data partitions?

Please point me to whatever you did to make this a bare system :) I'm thinking of adding the second sata port on the mobo since it's only missing a few components but the SoC does seem to support two ports. Having a bare system might make this ordeal easier.

[edit]
I've read the installing raw debian on sine forum topic but i've also read that the samba performance went down drastically; any experience with this? Did you perform the steps from https://github.com/olderzeus/Iomega-HMNHDCE unaltered?


Top
 Profile  
 
PostPosted: Thu Jul 31, 2014 11:41 am 
Offline

Joined: Tue May 27, 2014 1:47 am
Posts: 10
wbdsgnr wrote:
Am I to understand you're not running the lifeline system on top of Debian? But you're a bit ahead of me, correct me if i'm wrong please:
- You repartitioned the disk and instead of writing the kernel to 2048 you have the linux partition start there


Correct. I created small ext2 system partition for OS and kernel. There's standard Debian7 with iomega's kernel. That's why I wanna recompile it with gcc version from standard Debian 7 repo.

Code:
root@debian:~# fdisk -l

Disk /dev/sda: 3000.6 GB, 3000592982016 bytes
255 heads, 63 sectors/track, 364801 cylinders, total 5860533168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000bb21

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1            2048    20973567    10485760   83  Linux


Quote:
-> It's still uboot that starts the whole boot process, isn't it? So what's this about uboot not supporting GPT... it's already a GPT partitioned disk with me? (i've got the 1 GB version)


AFAIR, iomega's u-boot doesn't support GPT that's why they put kernel to beginning of the disk. It's possible that you also have GPT type of partition table. Then they start kernel directly from disk which supports GPT. Then they do some trick with LVM and RAID to connect free space on disk to one consistent place.

U-boot config for starting from usb and then fomr HDD
Code:
fw_setenv setenv usb_scan 'setenv usb_device 0:1; setenv usb_root sda1'
fw_setenv setenv make_usb_bootargs 'setenv bootargs $(console) $(bootargs_mtd) $(bootargs_end) root=/dev/$(usb_root) rootdelay=2 rootfstype=ext2'
fw_setenv setenv bootcmd_usb 'usb reset; run usb_scan; run make_usb_bootargs; ext2load ide $(usb_device) 0x40000 /boot/zImage; bootm 0x40000'
fw_setenv setenv bootcmd1 'ide read 0x40000 0x800 0x1800; ide read 0x900000 0x2000 0x1800; setenv bootargs $(console) $(bootargs_root) $(bootargs_mtd) $(bootargs_end); bootm 0x40000 0x900000;run bootcmd2'
fw_setenv setenv setenv bootcmd 'ide reset; run bootcmd_usb; usb stop; run bootcmd1' 
fw_setenv setenv bootargs_console console=ttyS0,115200


In big shorthut, u-boot can access small ext2 partition and boot kernel from it. Lenovo used some weired ticks with LVM and RAID, I've made it much simpler.

Quote:
-> doesn't uboot load the kernel and boot it, which in turn runs the initrd system, which in turn boots the rest of the system?

U-boot does load kernel which then start systemd and rest of the system.

Quote:
you point loop0 to some image with
losetup --offset 10738466817 /dev/loop0 /dev/sda
After which you mount it to /storage ... so this is the logical RAID volume holding the data partitions?


It means make loop device starting from offset 10738466817 to end of the device and create /dev/loop0. :D
10738466817 byte starts just after /dev/sda1

Quote:
Please point me to whatever you did to make this a bare system :) I'm thinking of adding the second sata port on the mobo since it's only missing a few components but the SoC does seem to support two ports. Having a bare system might make this ordeal easier.


I need some time for this. :)

Quote:
I've read the installing raw debian on sine forum topic but i've also read that the samba performance went down drastically; any experience with this? Did you perform the steps from https://github.com/olderzeus/Iomega-HMNHDCE unaltered?


Samba and NFS performance looks quite good. 100-200 mbps/write 300-400 mpbs read speed. Sorry I don't remember exactly. NFS seems to be faster.
I was able to configure disk spin out. Box is cold when idle.

No, I've found some weird Korean site which I translated to Engilsh and it gave me some clues how to start.
I'll upload the data and give detailed explanation how to setup real Debian on this box.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group