NDAS Treiber für FritzBox

@Giffi
Bitte bleib in den einen Thread, es bringt nichts, das auch noch hier auszubreiten.
Und nicht so viele Beiträge hintereinander in kürzester Zeit, sondern den vorhandenen Beitrag ergänzen
 
IOCELL Networks released source code NDAS

Hi All,

I found that IOCELL Networks released the ndas source code beginning this year.

I tried to compiled the souce code for a 7270v3 (little endian) for the 2.6.28.10 kernel, and hope it will give the possibility to use it on a 7390 (big endian)...later.

But I currently run into some compile issues while compiling it for the 7270v3. (solved)
I tried this on the latest trunk:

Code:
svn co http://svn.freetz.org/trunk/ freetz-trunk
mv freetz-trunk/ freetz-trunk-11058
cd freetz-trunk-11058
make menuconfig
        Level of user competence (Expert)  --->
        Hardware type (7270 v3)  --->
        Firmware language (en - international)  --->
        Toolchain options  --->
                      no changes
make toolchain

Commands used for compiling NDAS:
Code:
export revision=-11058
echo Revision checkout ID is $revision If revision ID is empty the default freetz-trunk directory used.

cd ~/freetz-trunk-11058/
mkdir ndas
cd ndas
git clone git://github.com/iocellnetworks/ndas4linux.git ndas4linux
cd ~/freetz-trunk-11058/ndas/ndas4linux/
cp -r 2.6.42 2.6.28
cd 2.6.28
cp /mnt/usb/ndas/2.6.42to2.6.28-no_scsi_freetz_2.patch /home/freetz/freetz-trunk-11058/ndas/ndas4linux
cp /mnt/usb/ndas/fix_REVERSE_BYTES_32_function.patch /home/freetz/freetz-trunk-11058/ndas/ndas4linux
cd ~/freetz-trunk-11058/ndas/ndas4linux/2.6.28
vi version.mk
      change NDAS_VER_BUILD=32  to NDAS_VER_BUILD=28
cd ~/freetz-trunk-11058/ndas/ndas4linux/
patch -p0 < fix_REVERSE_BYTES_32_function.patch (actually fix an issue for big endian, but doesn't hurt to fix it anyway.)
cp -r 2.6.28 2.6.28-orig
cd ~/freetz-trunk-11058/ndas/ndas4linux/2.6.28
vi /home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/ndaslinux.mk (don't see this part is used during compile, will attach this file)
vi /home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/arch/vendor/freetz.mk (this file is actually used during compile, will attach this file)
vi /home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/arch/targets/freetz.mk (this file is actually used during compile, will attach this file)
chmod +x /home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/arch/targets/freetz.mk
cd ~/freetz-trunk-11058/ndas/ndas4linux/2.6.28
make freetz_little
cd /home/freetz/freetz-trunk-11058/ndas/ndas4linux/
patch -p0 < 2.6.42to2.6.28-no_scsi_freetz_2.patch
cd /home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/
CC=/home/freetz/freetz-trunk-11058/toolchain/target/bin/mipsel-linux-uclibc-gcc
export NDAS_KERNEL_VERSION=2.6.28
export NDAS_CROSS_COMPILE=/home/freetz/freetz-trunk-11058/toolchain/target/bin/mipsel-linux-uclibc-
export CROSS_COMPILE=/home/freetz/freetz-trunk-11058/toolchain/target/bin/mipsel-linux-uclibc-
export NDAS_KERNEL_PATH=/home/freetz/freetz-trunk-11058/source/kernel/ref-ur8-7270_05.51/linux
make


The 'make freetz_little' step looks promising, e.g. no errors, but a number of warrnings, does use the correct compiler.
I created/verified the 2.6.42to2.6.28-no_scsi_freetz.patch using a linux pc with a 2.6.28.10 kernel, and only adapted the paths for Freetz.
The files ndaslinux.mk, arch/targets/freetz.mk, arch/targets/freetz.mk where created looking at changes made for openwrt>kamikaze.
I had to add 'export CROSS_COMPILE=' to get it to use the correct compiler during the final make.

Currently fails compiling 'block/block26.c':

Code:
/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/inc/sal/linux/debug.h:54:17: warning: 'regparm' attribute directive ignored [-Wattributes]
/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/inc/sal/linux/debug.h:59:1: warning: 'regparm' attribute directive ignored [-Wattributes]
In file included from /home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block26.c:45:0:
/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block.h:331:53: warning: 'regparm' attribute directive ignored [-Wattributes]
/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block26.c:354:1: warning: 'regparm' attribute directive ignored [-Wattributes]
/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block26.c: In function 'nblk_request_proc':
/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block26.c:486:5: error: implicit declaration of function 'elv_next_request' [-Werror=implicit-function-declaration]
/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block26.c:486:16: warning: assignment makes pointer from integer without a cast [enabled by default]
cc1: some warnings being treated as errors
make[2]: *** [/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block26.o] Error 1
make[1]: *** [_module_/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86] Error 2
make[1]: Leaving directory `/home/freetz/freetz-trunk-11058/source/kernel/ref-ur8-7270_05.51/linux-2.6.32'
make: *** [/home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/ndas_sal.ko] Error 2
freetz@freetz-linux:~/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86$




Edit2 (6-10-2013: 23:28)
Managed to finish compiling with the following changes:

Code:
cd /home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/	
vi block26.c	
	while((req = elv_next_request(q)) != NULL)
	to
	while((req = NBLK_NEXT_REQUEST(q)) != NULL)
See Edit3, included in the new uploaded patch file.

Also had to make an image to get the kernel (/home/freetz/freetz-trunk-11058/source/kernel/ref-ur8-7270_05.51/linux) compliled.

I currently don't have the opertunity to install the moduls and executables on the FB-7270 to test the results.
Edit4 (15-10-2013 23:52) The modules and executables work fine on my 7270v3.

Code:
file ndasadmin	
	ndasadmin: ELF 32-bit LSB executable, MIPS, MIPS32 version 1, dynamically linked (uses shared libs), with unknown capability 0xf41 = 0x756e6700, not stripped
file ndas_block.ko	
	ndas_core.ko: ELF 32-bit LSB relocatable, MIPS, MIPS32 rel2 version 1 (SYSV), with unknown capability 0xf41 = 0x756e6700, not stripped
file ndas_sal.ko	
	ndas_sal.ko: ELF 32-bit LSB relocatable, MIPS, MIPS32 rel2 version 1 (SYSV), with unknown capability 0xf41 = 0x756e6700, not stripped

Edit3 (11-10-2013: 19:01):
Uploaded a new patch file which include the changes needed in Edit2.
Also changed the .mk files to use a variable for the Revision checkout ID, if the variable isn't set the default freetz-trunk is used.

Edit4 (15-10-2013 23:52):
Attached a patch file for an issue found during make freetz_big (big endian) (see update #186 to #192)
 

Anhänge

  • 2.6.42to2.6.28-no_scsi_freetz_2.patch.txt
    6.6 KB · Aufrufe: 3
  • ndaslinux.mk.txt
    4.4 KB · Aufrufe: 5
  • freetz.mk.targets.3.txt
    3 KB · Aufrufe: 7
  • freetz.mk.vendor.3.txt
    940 Bytes · Aufrufe: 1
  • fix_REVERSE_BYTES_32_function.patch.txt
    430 Bytes · Aufrufe: 3
Zuletzt bearbeitet:
Compliling source for Big Endian failes

I tried to compile the source

Code:
svn co http://svn.freetz.org/trunk/ freetz-trunk
mv freetz-trunk/ freetz-trunk-11072
cd freetz-trunk-11072
make menuconfig
        Level of user competence (Expert)  --->
        Hardware type (7390)  --->
        Firmware language (en - international)  --->
        Toolchain options  --->
                      no changes
make toolchain

Commands used for compiling NDAS:
Code:
export revision=-11072
echo Revision checkout ID is $revision If revision ID is empty the default freetz-trunk directory used.

cd ~/freetz-trunk$revision/
mkdir ndas
cd ndas
git clone git://github.com/iocellnetworks/ndas4linux.git ndas4linux
cd ~/freetz-trunk$revision/ndas/ndas4linux/
cp -r 2.6.42 2.6.28
cd 2.6.28
cp /mnt/usb/ndas/2.6.42to2.6.28-no_scsi_freetz_2.patch /home/freetz/freetz-trunk$revision/ndas/ndas4linux/
cd ~/freetz-trunk$revision/ndas/ndas4linux/2.6.28
vi version.mk
      change NDAS_VER_BUILD=32  to NDAS_VER_BUILD=28
cd ~/freetz-trunk$revision/ndas/ndas4linux/
cp -r 2.6.28 2.6.28-orig
cd ~/freetz-trunk$revision/ndas/ndas4linux/2.6.28
vi /home/freetz/freetz-trunk$revision/ndas/ndas4linux/2.6.28/ndaslinux.mk (don't see this part is used during compile, will attach this file)
vi /home/freetz/freetz-trunk$revision/ndas/ndas4linux/2.6.28/arch/vendor/freetz.mk (this file is actually used during compile, will attach this file)
vi /home/freetz/freetz-trunk$revision/ndas/ndas4linux/2.6.28/arch/targets/freetz.mk (this file is actually used during compile, will attach this file)
chmod +x /home/freetz/freetz-trunk$revision/ndas/ndas4linux/2.6.28/arch/targets/freetz.mk
cd ~/freetz-trunk$revision/ndas/ndas4linux/2.6.28
make freetz_big

<<fails here>> while compiling netdisk/udev.c


Code:
netdisk/udev.o netdisk/udev.c
netdisk/udev.c: In function 'v_udev_connecting_func':
netdisk/udev.c:1257:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'udev_write_dib':
netdisk/udev.c:1478:21: warning: variable 'ioreq' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'ndas_io_atapi_process':
netdisk/udev.c:1862:13: warning: variable 'lunsize' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:2149:12: warning: variable 'bufferoffset' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'ndas_io_ata_check_passthrough':
netdisk/udev.c:3017:11: warning: variable 'sector_offset' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:3251:12: warning: variable 'log_address' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:3275:12: warning: variable 'log_address' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'ndas_io_ata_process':
netdisk/udev.c:4164:12: warning: unused variable 'blockSize' [-Wunused-variable]
netdisk/udev.c:4181:5: error: 'else' without a previous 'if'
netdisk/udev.c:4182:5: error: 'readCapacityData' undeclared (first use in this function)
netdisk/udev.c:4182:5: note: each undeclared identifier is reported only once for each function it appears in
netdisk/udev.c:4185:4: error: 'blockSize' undeclared (first use in this function)
netdisk/udev.c: At top level:
netdisk/udev.c:4198:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4199:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4222:4: error: expected identifier or '(' before 'do'
netdisk/udev.c:4222:4: error: expected identifier or '(' before 'while'
netdisk/udev.c:4223:4: error: expected identifier or '(' before 'do'
netdisk/udev.c:4223:4: error: expected identifier or '(' before 'while'
netdisk/udev.c:4225:4: warning: data definition has no type or storage class [enabled by default]
netdisk/udev.c:4225:4: warning: type defaults to 'int' in declaration of 'transfer_size' [-Wimplicit-int]
netdisk/udev.c:4225:57: error: 'readCapacityDataEx' undeclared here (not in a function)
netdisk/udev.c:4225:77: error: 'req' undeclared here (not in a function)
netdisk/udev.c:4226:4: error: expected identifier or '(' before 'if'
netdisk/udev.c:4227:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
netdisk/udev.c:4228:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before '->' token
netdisk/udev.c:4229:4: error: expected identifier or '(' before 'return'
netdisk/udev.c:4231:3: error: expected identifier or '(' before '}' token
netdisk/udev.c:4232:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4233:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4238:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4239:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4247:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4248:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4253:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4254:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4262:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4263:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4271:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4272:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4279:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4280:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4489:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4490:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4650:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4651:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4744:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4745:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4854:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4855:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4933:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4934:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4993:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:4994:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:4999:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:5000:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:5025:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:5026:3: error: expected identifier or '(' before 'case'
netdisk/udev.c:5037:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:5038:3: error: expected identifier or '(' before 'default'
netdisk/udev.c:5046:3: error: expected identifier or '(' before 'break'
netdisk/udev.c:5047:2: error: expected identifier or '(' before '}' token
netdisk/udev.c:5049:2: error: expected identifier or '(' before 'return'
netdisk/udev.c:5050:1: error: expected identifier or '(' before '}' token
netdisk/udev.c:1655:9: warning: 'ndas_pc_io_read_from_sal_bio' defined but not used [-Wunused-function]
netdisk/udev.c:5318:1: warning: 'ndas_io_internal_block_op' defined but not used [-Wunused-function]
netdisk/udev.c:2794:14: warning: 'ndas_io_ata_check_passthrough' defined but not used [-Wunused-function]
make[1]: *** [build_freetz/netdisk/udev.o] Error 1
make: *** [freetz_big] Error 2
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$

repeating the following commands gives the same errors:
Code:
  /home/freetz/freetz-trunk-11072/toolchain/target/bin/mips-linux-uclibc-gcc -Wp,-MD,build_freetz/netdisk/udev.o.d -D_MIPS -DBUG_ALIGNMENT  -mno-abicalls -fno-pic -msoft-float -DLINUX -pipe -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mabi=32 -march=24kc -Wa,-march=24kc -Wa,--trap -fno-common -Wall -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc/lspx -D__BIG_ENDIAN_BYTEORDER -D__BIG_ENDIAN_BITFIELD -D__BIG_ENDIAN__ -DNDAS_VER_MAJOR="2" -DNDAS_VER_MINOR="6" -DNDAS_VER_BUILD="28" -O2 -DXPLAT_SIO -DXPLAT_PNP -DXPLAT_ASYNC_IO -DXPLAT_RESTORE -DXPLAT_BPC -DNAS_IO_UNIT=64 -DLINUX -DNO_DEBUG_ESP -mlong-calls  -O2 -c -o build_freetz/netdisk/udev.o netdisk/udev.c

I also tried with the /home/freetz/freetz-trunk$(revision)/toolchain/build/mips_gcc-4.6.4/mips-unknown-linux-gnu/bin/mips-unknown-linux-gnu-gcc
compiler, but than I got multiple missing include files, much earlier after the 'make freetz_big'.
 
Hi Ralf,

The issue is present before this patch is applied.
For the little-endian this make step completes without errors. What I don't get is that the MIPS (big-endian) compiler complains about syntax like problems ('else' without a previous 'if') for the same source.
But be aware that I have (little to) no programming knowledge.

I created the two freetz.mk files myself, which contain lot of compiler parameters without knowing what they do (just coppied from openwrt little-endian example, and looked a bit what parameters are used during creating an image for the 7390), and looking here: http://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html
 
Zuletzt bearbeitet:
As I assume this is part of the kernel, you should just keep the same options that are used for the other parts of the kernel.

I'm sure it's not the big-endian compiler itself that complains for the same source, but that the big-endian compiler gets a different result from preprocessing.

Try the following:
You will have a call to the compiler similar to this:
Find the right directory to call the compiler.
Use the command from you post:
Code:
/home/freetz/freetz-trunk-11072/toolchain/target/bin/mips-linux-uclibc-gcc -Wp,-MD,build_freetz/netdisk/udev.o.d -D_MIPS -DBUG_ALIGNMENT  -mno-abicalls -fno-pic -msoft-float -DLINUX -pipe -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mabi=32 -march=24kc -Wa,-march=24kc -Wa,--trap -fno-common -Wall -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc/lspx -D__BIG_ENDIAN_BYTEORDER -D__BIG_ENDIAN_BITFIELD -D__BIG_ENDIAN__ -DNDAS_VER_MAJOR="2" -DNDAS_VER_MINOR="6" -DNDAS_VER_BUILD="28" -O2 -DXPLAT_SIO -DXPLAT_PNP -DXPLAT_ASYNC_IO -DXPLAT_RESTORE -DXPLAT_BPC -DNAS_IO_UNIT=64 -DLINUX -DNO_DEBUG_ESP -mlong-calls  -O2 -c -o build_freetz/netdisk/udev.o netdisk/udev.c
It should produce the same error messages, This verifies that the files are accessible.
Now run a modified version of this command:
Code:
/home/freetz/freetz-trunk-11072/toolchain/target/bin/mips-linux-uclibc-gcc -Wp,-MD,build_freetz/netdisk/udev.o.d -D_MIPS -DBUG_ALIGNMENT  -mno-abicalls -fno-pic -msoft-float -DLINUX -pipe -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mabi=32 -march=24kc -Wa,-march=24kc -Wa,--trap -fno-common -Wall -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc/lspx -D__BIG_ENDIAN_BYTEORDER -D__BIG_ENDIAN_BITFIELD -D__BIG_ENDIAN__ -DNDAS_VER_MAJOR="2" -DNDAS_VER_MINOR="6" -DNDAS_VER_BUILD="28" -O2 -DXPLAT_SIO -DXPLAT_PNP -DXPLAT_ASYNC_IO -DXPLAT_RESTORE -DXPLAT_BPC -DNAS_IO_UNIT=64 -DLINUX -DNO_DEBUG_ESP -mlong-calls  -O2 -E -o build_freetz/netdisk/udev.i-be netdisk/udev.c
The difference is at the end:
Code:
... -c -o build_freetz/netdisk/udev.o netdisk/udev.c
... -E -o build_freetz/netdisk/udev.i-be netdisk/udev.c
This will save the result of the preprocessing stage in the file build_freetz/netdisk/udev.i-be.
Now if you can find the command for the little endian compiler, you can do a similar substitution and save the result in build_freetz/netdisk/udev.i-le
Then you can compare these two files. Otherwise you can look at the file build_freetz/netdisk/udev.i-be to find out why the compiler complains.

It is possibly that the code was never tested for big-endian because all PCs are little-endian.
 
Hi Ralf,

I performed the command for both the LE and BE.
The resulting files indeed show a difference near the lines where it goes wrong.
But not sure what to change to get a bit further.

Little Endian:
First the unchanged command:
Code:
cd /home/freetz/freetz-trunk-11058/ndas/ndas4linux/2.6.28
/home/freetz/freetz-trunk-11058/toolchain/target/bin/mipsel-linux-uclibc-gcc -Wp,-MD,build_freetz/netdisk/udev.o.d -D_MIPSEL -DBUG_ALIGNMENT  -G 0 -mno-abicalls -fno-pic -mlong-calls -Wa,--trap -msoft-float -DLINUX -pipe -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -finline-limit=100000 -fno-common -Wall -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc/lspx -D__LITTLE_ENDIAN_BYTEORDER -D__LITTLE_ENDIAN_BITFIELD -D__LITTLE_ENDIAN__ -DNDAS_VER_MAJOR="2" -DNDAS_VER_MINOR="6" -DNDAS_VER_BUILD="28" -O2 -DXPLAT_SIO -DXPLAT_PNP -DXPLAT_ASYNC_IO -DXPLAT_RESTORE -DXPLAT_BPC -DNAS_IO_UNIT=64 -DLINUX -DNO_DEBUG_ESP -mlong-calls  -O2 -c -o build_freetz/netdisk/udev.o netdisk/udev.c
netdisk/udev.c: In function 'v_udev_connecting_func':
netdisk/udev.c:1257:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'udev_write_dib':
netdisk/udev.c:1478:21: warning: variable 'ioreq' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'ndas_io_atapi_process':
netdisk/udev.c:1862:13: warning: variable 'lunsize' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:2149:12: warning: variable 'bufferoffset' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'ndas_io_ata_check_passthrough':
netdisk/udev.c:3017:11: warning: variable 'sector_offset' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:3251:12: warning: variable 'log_address' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:3275:12: warning: variable 'log_address' set but not used [-Wunused-but-set-variable]
netdisk/udev.c: In function 'ndas_io_ata_process':
netdisk/udev.c:4501:27: warning: variable 'modeH' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:4498:12: warning: variable 'parameterlen' set but not used [-Wunused-but-set-variable]
netdisk/udev.c:4956:76: warning: array subscript is above array bounds [-Warray-bounds]

The changed command (-E)
Code:
/home/freetz/freetz-trunk-11058/toolchain/target/bin/mipsel-linux-uclibc-gcc -Wp,-MD,build_freetz/netdisk/udev.o.d -D_MIPSEL -DBUG_ALIGNMENT  -G 0 -mno-abicalls -fno-pic -mlong-calls -Wa,--trap -msoft-float -DLINUX -pipe -fno-builtin-sprintf -fno-builtin-log2 -fno-builtin-puts -fno-strict-aliasing -fno-common -fomit-frame-pointer -pipe -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -finline-limit=100000 -fno-common -Wall -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/inc/lspx -D__LITTLE_ENDIAN_BYTEORDER -D__LITTLE_ENDIAN_BITFIELD -D__LITTLE_ENDIAN__ -DNDAS_VER_MAJOR="2" -DNDAS_VER_MINOR="6" -DNDAS_VER_BUILD="28" -O2 -DXPLAT_SIO -DXPLAT_PNP -DXPLAT_ASYNC_IO -DXPLAT_RESTORE -DXPLAT_BPC -DNAS_IO_UNIT=64 -DLINUX -DNO_DEBUG_ESP -mlong-calls  -O2 -E -o build_freetz/netdisk/udev.i-le netdisk/udev.c

In the resulting udev.i-le the line where the BE goes wrong is at 12973 (search for readCapacityData.LogicalBlockAddress)


Big Endian:
In the resulting udev.i-be the line where the first error is shown (error: 'else' without a previous 'if') is at 12982


If I open the udev.i-xx files with Notepad++ I see a difference in the pairs of {}

udev.i-be (line 12977 to 12980):
if(logicalBlockAddress < 0xffffffff) {
*&readCapacityData.LogicalBlockAddress = *&logicalBlockAddress; };
do {} while(0);
do {} while(0);

udev.i-le (line 12968 to 12971):
if(logicalBlockAddress < 0xffffffff) {
{ PFOUR_BYTE d = (PFOUR_BYTE)(&readCapacityData.LogicalBlockAddress); PFOUR_BYTE s = (PFOUR_BYTE)(&logicalBlockAddress); d->bytes.Byte3 = s->bytes.Byte0; d->bytes.Byte2 = s->bytes.Byte1; d->bytes.Byte1 = s->bytes.Byte2; d->bytes.Byte0 = s->bytes.Byte3; };
do {} while(0);
do {} while(0);

udev.c (line 4176 to 4179):
if(logicalBlockAddress < 0xffffffff) {
REVERSE_BYTES_32(&readCapacityData.LogicalBlockAddress, &logicalBlockAddress);
debug_udev(1, "SCSIOP_READ_CAPACITY blockaddress ORGINAL 0x%x", logicalBlockAddress);
debug_udev(1, "SCSIOP_READ_CAPACITY blockaddress 0x%x", readCapacityData.LogicalBlockAddress);

Edit1 (13-10-2013: 1:08am):
Looks it goes wrong with the REVERSE_BYTES_32 function. I did a 'grep -i REVERSE_BYTES_32 *, grep -i REVERSE_BYTES_32 */*, grep -i REVERSE_BYTES_32 */*/*' and only found 3 lines in udev.c. Where should this function be defined? (see below)
Same is true for the REVERSE_BYTES_64 function a few lines below (udev.c line 4214, udev.i-le line 13006, udev.i-be line 13015).
 

Anhänge

  • udev.i-le.zip
    48.9 KB · Aufrufe: 0
  • udev.i-be.zip
    48.9 KB · Aufrufe: 0
  • udev.c.zip
    26.8 KB · Aufrufe: 0
Zuletzt bearbeitet:
The lines "do {} while(0);" are the result of the disabled "debug_udev(...)" lines. The extra "}" the the be-case seems wrong, but more likely it should have a "{" at the beginning that is missing.
Find the definition of "REVERSE_BYTES_32". It's probably missing the "{" in the big-endian case.
That would mean that the code was never even compiled for a big-endian machine. So beware, there may be other surprises besides the ones the compiler can find.

By the way, the kernel already has optimized functions for byte-swapping, so using them would be both faster and less likely to contain errors.
 
Hi Ralf,

I just deleted the "rm netdisk/udev.c" file, and than the "make freetz_big" finish normally. So it is really the "REVERSE_BYTES_32" and "REVERSE_BYTES_64" funtions that look to cause problems.
With 'grep -i REVERSE_BYTES_32 */*' and found these fuctions are defined in netdisk/ndas_scsi_cmd_fmt.h

But I'm not sure if this 'netdisk/ndas_scsi_cmd_fmt.h' file or the udev.c should be changed. (edit 14-10 20:46, small correction in ndas_scsi_cmd_fmt.h needed, see update #191 and #192)

These fuctions look only appliable for little-endian (edit, 14-10 20:46, not correct, only first part until else is applicable for littile-endian, see update #191 and #192):

Code:
#ifdef __LITTLE_ENDIAN_BYTEORDER
//
// Byte reversing macro for converting
// between big- and little-endian formats
//

#define REVERSE_BYTES_64(Destination, Source) {           \
    PEIGHT_BYTE d = (PEIGHT_BYTE)(Destination);             \
    PEIGHT_BYTE s = (PEIGHT_BYTE)(Source);                  \
    d->bytes.Byte7 = s->bytes.Byte0;                                    \
    d->bytes.Byte6 = s->bytes.Byte1;                                    \
    d->bytes.Byte5 = s->bytes.Byte2;                                    \
    d->bytes.Byte4 = s->bytes.Byte3;                                    \
    d->bytes.Byte3 = s->bytes.Byte4;                                    \
    d->bytes.Byte2 = s->bytes.Byte5;                                    \
    d->bytes.Byte1 = s->bytes.Byte6;                                    \
    d->bytes.Byte0 = s->bytes.Byte7;                                    \
}

#define REVERSE_BYTES_32(Destination, Source) {                \
    PFOUR_BYTE d = (PFOUR_BYTE)(Destination);               \
    PFOUR_BYTE s = (PFOUR_BYTE)(Source);                    \
    d->bytes.Byte3 = s->bytes.Byte0;                                    \
    d->bytes.Byte2 = s->bytes.Byte1;                                    \
    d->bytes.Byte1 = s->bytes.Byte2;                                    \
    d->bytes.Byte0 = s->bytes.Byte3;                                    \
}

#define REVERSE_BYTES_16(Destination, Source) {          \
    PTWO_BYTE d = (PTWO_BYTE)(Destination);                 \
    PTWO_BYTE s = (PTWO_BYTE)(Source);                      \
    d->bytes.Byte1 = s->bytes.Byte0;                                    \
    d->bytes.Byte0 = s->bytes.Byte1;                                    \
}

//
// Byte reversing macro for converting
// USHORTS from big to little endian in place
//

#define REVERSE_16(Short) {          \
    xuint8 tmp;                          \
    PTWO_BYTE w = (PTWO_BYTE)(Short);   \
    tmp = w->bytes.Byte0;                     \
    w->bytes.Byte0 = w->bytes.Byte1;                \
    w->bytes.Byte1 = tmp;                     \
    }

//
// Byte reversing macro for convering
// ULONGS between big & little endian in place
//

#define REVERSE_32(Long) {            \
    xuint8 tmp;                          \
    PFOUR_BYTE l = (PFOUR_BYTE)(Long);  \
    tmp = l->bytes.Byte3;                     \
    l->bytes.Byte3 = l->bytes.Byte0;                \
    l->bytes.Byte0 = tmp;                     \
    tmp = l->bytes.Byte2;                     \
    l->bytes.Byte2 = l->bytes.Byte1;                \
    l->bytes.Byte1 = tmp;                     \
    }
#else
#define REVERSE_BYTES_64(Destination, Source) { \
        *Destination = *Source; \
        }

#define REVERSE_BYTES_32(Destination, Source) \
        *Destination = *Source; \
        }

#define REVERSE_BYTES_16(Destination, Source) { \
        *Destination = *Source \
        }

#define REVERSE_16(Short) { \
        Short; \
        }
#define REVERSE_32(Long) { \
        Long; \
        }

#endif //#ifdef __LITTLE_ENDIAN_BYTEORDER


I know a long time ago they compiled ndas also for another Big-Endian device. I think it was TiVo (http://en.wikipedia.org/wiki/TiVo#Hardware_anatomy), but it looks they never made changes to the released source for that. but this part, SCSI module related, looks to be added after the TiVo effort.


Edit1 (13-10: 2:37am):
This change makes it work:
Code:
$ diff -dur 2.6.28-orig/ 2.6.28/
diff -dur 2.6.28-orig/netdisk/udev.c 2.6.28/netdisk/udev.c
--- 2.6.28-orig/netdisk/udev.c  2013-10-13 02:26:20.744236031 +0200
+++ 2.6.28/netdisk/udev.c       2013-10-13 02:30:41.437121287 +0200
@@ -4174,16 +4174,20 @@
                        logicalBlockAddress = (xuint32)(sectorCount -1);

                        if(logicalBlockAddress < 0xffffffff) {
+                               #ifdef __LITTLE_ENDIAN_BYTEORDER
                                REVERSE_BYTES_32(&readCapacityData.LogicalBlockAddress,  &logicalBlockAddress);
                                debug_udev(1, "SCSIOP_READ_CAPACITY blockaddress ORGINAL 0x%x", logicalBlockAddress);
                                debug_udev(1, "SCSIOP_READ_CAPACITY blockaddress 0x%x", readCapacityData.LogicalBlockAddress);
+                               #endif //#ifdef __LITTLE_ENDIAN_BYTEORDER

                        }else {
                                readCapacityData.LogicalBlockAddress = 0xffffffff;
                        }

                        blockSize = s_info->sector_size;
+                       #ifdef __LITTLE_ENDIAN_BYTEORDER
                        REVERSE_BYTES_32(&readCapacityData.BytesPerBlock, &blockSize);
+                       #endif //#ifdef __LITTLE_ENDIAN_BYTEORDER

                        debug_udev(1, "SCSIOP_READ_CAPACITY block size ORGINAL 0x%x", blockSize);
                        debug_udev(1, "SCSIOP_READ_CAPACITY blockaddress 0x%x", readCapacityData.BytesPerBlock);
@@ -4218,7 +4222,9 @@


                        blockSize = s_info->sector_size;
+                       #ifdef __LITTLE_ENDIAN_BYTEORDER
                        REVERSE_BYTES_32(&readCapacityDataEx.BytesPerBlock, &blockSize);
+                       #endif //#ifdef __LITTLE_ENDIAN_BYTEORDER
                        debug_udev(1, "SCSIOP_READ_CAPACITY block size ORGINAL 0x%x", blockSize);
                        debug_udev(1, "SCSIOP_READ_CAPACITY blockaddress 0x%x", readCapacityDataEx.BytesPerBlock);
$
(edit 14-10 20:50, lines above not correct, Ralf found the problem in the REVERSE_BYTES_32 defenition in ndas_scsi_cmd_fmt.h. see update #191 and #192)
 
Zuletzt bearbeitet:
with the next make command I get errors, which I expect are from using the wrong compile parameters in ./ndaslinux.mk (error: unrecognized command line option):

Code:
$ make
Invoking make against the kernel at /home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux
make -C /home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux \
                SUBDIRS=/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86 \
                KBUILD_VERBOSE=1 \
                ndas_root=/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86 \
                modules
make[1]: Entering directory `/home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28'
Makefile:210: use: CROSS_COMPILE=/home/freetz/freetz-trunk-11072/toolchain/target/bin/mips-linux-uclibc-
test -e include/linux/autoconf.h -a -e include/config/auto.conf || (            \
        echo;                                                           \
        echo "  ERROR: Kernel configuration is invalid.";               \
        echo "         include/linux/autoconf.h or include/config/auto.conf are missing.";      \
        echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
        echo;                                                           \
        /bin/false)
mkdir -p /home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/.tmp_versions ; rm -f /home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/.tmp_versions/*
make -f scripts/Makefile.build obj=/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86
  /home/freetz/freetz-trunk-11072/toolchain/target/bin/mips-linux-uclibc-gcc -Wp,-MD,/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/.block24.o.d  -nostdinc -isystem /home/freetz/freetz-trunk-11072/toolchain/build/mips_gcc-4.6.4_uClibc-0.9.32.1/mips-linux-uclibc/bin/../lib/gcc/mips-linux-uclibc/4.6.4/include -D__KERNEL__ -Iinclude  -I/home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28/arch/x86/include -include include/linux/autoconf.h  -DNEW_CONFIG -I/home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-error=unused-but-set-variable -Os -m64 -mno-red-zone -mcmodel=kernel -maccumulate-outgoing-args -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -Iarch/x86/include/asm/mach-default -fomit-frame-pointer -DMODULE -DLINUX -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/inc -D_X86 -DNDAS_DONT_CARE_SCHEDULER -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(block24)"  -D"KBUILD_MODNAME=KBUILD_STR(ndas_block)"  -c -o /home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block24.o /home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block24.c
cc1: error: unrecognized command line option '-m64'
cc1: error: unrecognized command line option '-mno-red-zone'
cc1: error: unrecognized command line option '-mcmodel=kernel'
cc1: error: unrecognized command line option '-maccumulate-outgoing-args'
make[2]: *** [/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block24.o] Error 1
make[1]: *** [_module_/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86] Error 2
make[1]: Leaving directory `/home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28'
make: *** [/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/ndas_sal.ko] Error 2
$



Code:
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$ grep -i m64 *
ndaslinux.mk:           -fno-stack-protector -m64 -mtune=generic -mno-red-zone \

Code:
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$ grep -i mno-red-zone *
ndaslinux.mk:           -fno-stack-protector -m64 -mtune=generic -mno-red-zone \

Code:
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$ grep -i maccumulate-outgoing-args *
ndaslinux.mk:           -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 \
ndaslinux.mk:           -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args \

Hope I get some time tomorrow to look further... (just delete these parameters I guess)


Edit1 (13-10-2013 21:05):
From the last failures it looks that something goes wrong during the initial make.

During processing of 'ndaslinux.mk' the 'nxp-vendor' variable should be 'freetz', and the 'nxp-cpu' variable should be 'mips' as dictated in '2.6.28/arch/targets/freetz.mk' using freetz_big: "nxp-os=linux nxp-cpu=mips nxp-vendor=freetz"

During the initial make process something else is a bit strange, possible indicating not all variables are used as set in 'arch/targets/freetz.mk'.
build_freetz/ndas-2.6.28.x86/ instead of build_freetz/ndas-2.6.28.mips (or mipsel for make freetz_little).


Looks this is mostly done in 2.6.28/common.mk
Have to look more deeper into what is happeing here..
 
Zuletzt bearbeitet:
Just look at this part:
Code:
#else
#define REVERSE_BYTES_64(Destination, Source) { \
        *Destination = *Source; \
        }

#define REVERSE_BYTES_32(Destination, Source) \
        *Destination = *Source; \
        }

#define REVERSE_BYTES_16(Destination, Source) { \
        *Destination = *Source \
        }

You can see that it is exactly what I suspected, the definition of REVERSE_BYTES_32 is missing the "{", while it is present for REVERSE_BYTES_16 and REVERSE_BYTES_64, so just insert that "{" at the right place.

This change makes it work
No, this change doesn't make it work, this change only makes it compile. So remove this change and change the definition of REVERSE_BYTES_32 as I mentioned.


with the next make command I get errors, which I expect are from using the wrong compile parameters in ./ndaslinux.mk
For the compilation of kernel modules you should set no options that are different from the options for the rest of the kernel. This whole ndaslinux.mk seems to contain options for different architectures, which is just stupid. Just invoke the kernel makefile with the proper directory information, and the kernel configuration should provide the correct options. The invocation itself seems fine, although I don't know why they set ndas_root. So probably the included Makefile somewhere reads ndaslinux.mk, which in turn does things it should not do.
 
Hi Ralf,

Nice catch. I completely missed that.

I will give it a try and report back..


Edit (14-10-2013: 20:31)

Yes, with your change it works!

Code:
$ diff -dur 2.6.28-orig/ 2.6.28/
diff -dur 2.6.28-orig/netdisk/ndas_scsi_cmd_fmt.h 2.6.28/netdisk/ndas_scsi_cmd_fmt.h
--- 2.6.28-orig/netdisk/ndas_scsi_cmd_fmt.h     2013-10-14 20:22:55.290027009 +0200
+++ 2.6.28/netdisk/ndas_scsi_cmd_fmt.h  2013-10-14 20:22:26.809623472 +0200
@@ -4641,7 +4641,7 @@
        *Destination = *Source; \
        }

-#define REVERSE_BYTES_32(Destination, Source) \
+#define REVERSE_BYTES_32(Destination, Source) { \
        *Destination = *Source; \
        }


Now I see my mistake.
I assumed that from the line "#ifdef __LITTLE_ENDIAN_BYTEORDER" to "#endif //#ifdef __LITTLE_ENDIAN_BYTEORDER" where not applicable if "__$(XPLAT_CONFIG_ENDIAN_BYTEORDER)_ENDIAN_BYTEORDER" was set to BIG, but it is only from "#endif //#ifdef __LITTLE_ENDIAN_BYTEORDER" to "#else", all after this else is applicable for BIG_ENDIAN

Just this small "{" ....

Thanks a lot for helping me a step further!


Edit2 (14-10-2013: 22:06):

Unfortunalty the second make still failes with the same error as before.

Code:
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86$ make
Invoking make against the kernel at /home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux
make -C /home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux \
                SUBDIRS=/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86 \
                KBUILD_VERBOSE=1 \
                ndas_root=/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86 \
                modules
make[1]: Entering directory `/home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28'
Makefile:210: use: CROSS_COMPILE=/home/freetz/freetz-trunk-11072/toolchain/target/bin/mips-linux-uclibc-
test -e include/linux/autoconf.h -a -e include/config/auto.conf || (            \
        echo;                                                           \
        echo "  ERROR: Kernel configuration is invalid.";               \
        echo "         include/linux/autoconf.h or include/config/auto.conf are missing.";      \
        echo "         Run 'make oldconfig && make prepare' on kernel src to fix it.";  \
        echo;                                                           \
        /bin/false)
mkdir -p /home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/.tmp_versions ; rm -f /home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/.tmp_versions/*

  WARNING: Symbol version dump /home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28/Module.symvers
           is missing; modules will have no dependencies and modversions.

make -f scripts/Makefile.build obj=/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86
  /home/freetz/freetz-trunk-11072/toolchain/target/bin/mips-linux-uclibc-gcc -Wp,-MD,/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/.block24.o.d  -nostdinc -isystem /home/freetz/freetz-trunk-11072/toolchain/build/mips_gcc-4.6.4_uClibc-0.9.32.1/mips-linux-uclibc/bin/../lib/gcc/mips-linux-uclibc/4.6.4/include -D__KERNEL__ -Iinclude  -I/home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28/arch/x86/include -include include/linux/autoconf.h  -DNEW_CONFIG -I/home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28/include -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-error=unused-but-set-variable -Os -m64 -mno-red-zone -mcmodel=kernel -maccumulate-outgoing-args -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -Iarch/x86/include/asm/mach-default -fomit-frame-pointer -DMODULE -DLINUX -I/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/inc -D_X86 -DNDAS_DONT_CARE_SCHEDULER -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(block24)"  -D"KBUILD_MODNAME=KBUILD_STR(ndas_block)"  -c -o /home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block24.o /home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block24.c
cc1: error: unrecognized command line option '-m64'
cc1: error: unrecognized command line option '-mno-red-zone'
cc1: error: unrecognized command line option '-mcmodel=kernel'
cc1: error: unrecognized command line option '-maccumulate-outgoing-args'
make[2]: *** [/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/block/block24.o] Error 1
make[1]: *** [_module_/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86] Error 2
make[1]: Leaving directory `/home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28'
make: *** [/home/freetz/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86/ndas_sal.ko] Error 2
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28/build_freetz/ndas-2.6.28.x86$


Looking from ~/freetz-trunk-11072/ndas/ndas4linux/2.6.28/ for files containing the gcc parameters that cause the errors:

Code:
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$ grep -i mno-red-zone -r -n *
arch/cpu/x86_64.mk:6:   -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks \
ndaslinux.mk:61:                -fno-stack-protector -m64 -mtune=generic -mno-red-zone \
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$

Code:
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$ grep -i m64 -r -n * | grep -v m644
ndaslinux.mk:61:                -fno-stack-protector -m64 -mtune=generic -mno-red-zone \
test/probe.c:21:    "1VDSM64LSX67CKGRPJKX"
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$

Code:
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$ grep -i maccumulate-outgoing-args -r -n *
ndaslinux.mk:52:                -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 \
ndaslinux.mk:62:                -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args \
freetz@freetz-linux:~/freetz-trunk-11072/ndas/ndas4linux/2.6.28$

From this I suspect that the lines around line 61/62 from ndaslinux.mk are selected, but these parameters are selected if $(nxp-vendor) is empty, and $(nxp-cpu) is x86_64

Planning to remove these lines from ndaslinux.mk to see what is happening than...

Edit3 (14-10 23:09): Even with removing these parts from ndaslinux.mk I get the same error message.

Comparing the first gcc line between the little-endian and big-endian I see the following for one of the (many) parameters:
LE: -I/home/freetz/freetz-trunk-11072/source/kernel/ref-ur8-7270_05.51/linux-2.6.32/arch/mips/include
BE: -I/home/freetz/freetz-trunk-11072/source/kernel/ref-iks-7390_05.52/linux-2.6.28/arch/x86/include

But for both the architecture should be the same: mips.
 
Zuletzt bearbeitet:
As I wrote before, setting parameters for kernel modules is simply a bad idea.
There are mainly two reasons when companies don't want to release their source code. Either they think they had some great ideas, or they are too embarrassed to show the world what they have done.

Try what happens if you remove the include of ndaslinux.mk from the Makefile. Even better would be to replace the Makefile completely with a normal kernel-style Makefile.
 
Hi Ralf,

Today I tried the modules and executable I compiled for the 7270V3 (little-endian), and they work well.
(uploaded files via rudi shell, insmod the 3 module files, registered my netdisk, started ndasadmin, and mounted a partition which I could see)


For the 7390 (big-endian) I commented out ndaslinux.mk from the Makefile, and that resulted in the same error during the final make step.
 
Zuletzt bearbeitet:
Thanks to ER13 NDAS is now available in the latest trunk ( 11433 and later) for both little endian (e.g. 7170, 7270, ....) and also for big endian (e.g. 7390).

Also thanks to RalfFriedl for helping a lot.
 

Zurzeit aktive Besucher

Statistik des Forums

Themen
246,149
Beiträge
2,246,980
Mitglieder
373,668
Neuestes Mitglied
Stripi
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.