All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: problems compiling NTFS on GRUB2
@ 2004-08-13  6:59 lode leroy
  2004-08-13 10:25 ` Marco Gerards
  0 siblings, 1 reply; 7+ messages in thread
From: lode leroy @ 2004-08-13  6:59 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 645 bytes --]

>How do you compile and link fs/ntfs.c

I modified i386-pc.mk :%s/minix/ntfs/g

>Can you show a backtrace of the crash?

see attached mkimg.log

I noticed that there are some external unresolved link symbols...
ie. libntfs uses fprintf, calloc, mbrtowc, memcpy etc...

I suppose these will need to be defined in ntfs.o
and libntfs.a is compiled for linux, it will need to be compiled
for grub2. How do I do this? I suppose --no-stdlib
and make equivalents for <stdlib.h>, <ctype.h> etc....

_________________________________________________________________
Calculate your benefits and bet online. 
http://www.msn.be/sport/bookmaker2/default.asp

[-- Attachment #2: ntfs.log --]
[-- Type: text/plain, Size: 16771 bytes --]

set -e; 	  gcc -Ifs -I../fs -I. -Iinclude -I../include -Wall -W -Wall -W 
-Wshadow -Wpointer-arith -Wmissing-prototypes 		-Wundef -Wstrict-prototypes 
-g -Os -falign-jumps=1 -falign-loops=1 -falign-functions=1 -fno-builtin 
-mrtd -mregparm=3 -M ../fs/ntfs.c 	  | sed 's,ntfs\.o[ 
:]*,ntfs_mod-fs_ntfs.o ntfs_mod-fs_ntfs.d : ,g' > ntfs_mod-fs_ntfs.d; 	  [ 
-s ntfs_mod-fs_ntfs.d ] || rm -f ntfs_mod-fs_ntfs.d
set -e; 	  gcc -Ifs -I../fs -I. -Iinclude -I../include -Wall -W 
-DGRUB_DATADIR=\"/usr/local/share/grub/i386-pc\" -g -O2 -DGRUB_UTIL=1  -M 
../fs/ntfs.c 	  | sed 's,ntfs\.o[ :]*,grub_emu-fs_ntfs.o grub_emu-fs_ntfs.d 
: ,g' > grub_emu-fs_ntfs.d; 	  [ -s grub_emu-fs_ntfs.d ] || rm -f 
grub_emu-fs_ntfs.d
set -e; 	  gcc -Ifs -I../fs -I. -Iinclude -I../include -Wall -W 
-DGRUB_DATADIR=\"/usr/local/share/grub/i386-pc\" -g -O2 -DGRUB_UTIL=1  -M 
../fs/ntfs.c 	  | sed 's,ntfs\.o[ :]*,grub_setup-fs_ntfs.o 
grub_setup-fs_ntfs.d : ,g' > grub_setup-fs_ntfs.d; 	  [ -s 
grub_setup-fs_ntfs.d ] || rm -f grub_setup-fs_ntfs.d
ln -sf /home/ller/ntfsprogs-1.9.2/libntfs/.libs/libntfs.a libntfs.a
gcc -Ifs -I../fs -I. -Iinclude -I../include -Wall -W 
-DGRUB_DATADIR=\"/usr/local/share/grub/i386-pc\" -g -O2 -DGRUB_UTIL=1  -c -o 
grub_setup-fs_ntfs.o ../fs/ntfs.c
../fs/ntfs.c: In function `ntfs_device_grub_open':
../fs/ntfs.c:34: warning: unused parameter `flags'
../fs/ntfs.c: In function `ntfs_device_grub_sync':
../fs/ntfs.c:85: warning: unused parameter `dev'
../fs/ntfs.c: In function `ntfs_device_grub_write':
../fs/ntfs.c:92: warning: unused parameter `dev'
../fs/ntfs.c:92: warning: unused parameter `buffer'
../fs/ntfs.c:93: warning: unused parameter `count'
../fs/ntfs.c: In function `ntfs_device_grub_stat':
../fs/ntfs.c:100: warning: unused parameter `dev'
../fs/ntfs.c:100: warning: unused parameter `buf'
../fs/ntfs.c: In function `ntfs_device_grub_ioctl':
../fs/ntfs.c:107: warning: unused parameter `dev'
../fs/ntfs.c:107: warning: unused parameter `request'
../fs/ntfs.c:108: warning: unused parameter `argp'
../fs/ntfs.c: In function `ntfs_device_grub_pwrite':
../fs/ntfs.c:121: warning: unused parameter `dev'
../fs/ntfs.c:121: warning: unused parameter `buf'
../fs/ntfs.c:122: warning: unused parameter `count'
../fs/ntfs.c:122: warning: unused parameter `offset'
../fs/ntfs.c: In function `grub_ntfs_pathname_to_inode':
../fs/ntfs.c:198: warning: unused parameter `parent'
../fs/ntfs.c: In function `grub_ntfs_filldir':
../fs/ntfs.c:269: warning: unused parameter `pos'
../fs/ntfs.c:270: warning: unused parameter `mref'
../fs/ntfs.c: In function `grub_ntfs_read':
../fs/ntfs.c:368: warning: unused parameter `file'
../fs/ntfs.c:368: warning: unused parameter `buf'
../fs/ntfs.c:368: warning: unused parameter `len'
../fs/ntfs.c: In function `grub_ntfs_label':
../fs/ntfs.c:392: warning: unused parameter `device'
gcc -o grub-setup grub_setup-util_i386_pc_grub_setup.o 
grub_setup-util_i386_pc_biosdisk.o grub_setup-util_misc.o 
grub_setup-util_i386_pc_getroot.o grub_setup-kern_device.o 
grub_setup-kern_disk.o grub_setup-kern_err.o grub_setup-kern_misc.o 
grub_setup-disk_i386_pc_partition.o grub_setup-fs_fat.o grub_setup-fs_ext2.o 
grub_setup-fs_ufs.o grub_setup-fs_minix.o grub_setup-fs_ntfs.o 
grub_setup-kern_file.o grub_setup-kern_fs.o grub_setup-kern_env.o  libntfs.a
gcc -Ifs -I../fs -I. -Iinclude -I../include -Wall -W 
-DGRUB_DATADIR=\"/usr/local/share/grub/i386-pc\" -g -O2 -DGRUB_UTIL=1  -c -o 
grub_emu-fs_ntfs.o ../fs/ntfs.c
../fs/ntfs.c: In function `ntfs_device_grub_open':
../fs/ntfs.c:34: warning: unused parameter `flags'
../fs/ntfs.c: In function `ntfs_device_grub_sync':
../fs/ntfs.c:85: warning: unused parameter `dev'
../fs/ntfs.c: In function `ntfs_device_grub_write':
../fs/ntfs.c:92: warning: unused parameter `dev'
../fs/ntfs.c:92: warning: unused parameter `buffer'
../fs/ntfs.c:93: warning: unused parameter `count'
../fs/ntfs.c: In function `ntfs_device_grub_stat':
../fs/ntfs.c:100: warning: unused parameter `dev'
../fs/ntfs.c:100: warning: unused parameter `buf'
../fs/ntfs.c: In function `ntfs_device_grub_ioctl':
../fs/ntfs.c:107: warning: unused parameter `dev'
../fs/ntfs.c:107: warning: unused parameter `request'
../fs/ntfs.c:108: warning: unused parameter `argp'
../fs/ntfs.c: In function `ntfs_device_grub_pwrite':
../fs/ntfs.c:121: warning: unused parameter `dev'
../fs/ntfs.c:121: warning: unused parameter `buf'
../fs/ntfs.c:122: warning: unused parameter `count'
../fs/ntfs.c:122: warning: unused parameter `offset'
../fs/ntfs.c: In function `grub_ntfs_pathname_to_inode':
../fs/ntfs.c:198: warning: unused parameter `parent'
../fs/ntfs.c: In function `grub_ntfs_filldir':
../fs/ntfs.c:269: warning: unused parameter `pos'
../fs/ntfs.c:270: warning: unused parameter `mref'
../fs/ntfs.c: In function `grub_ntfs_read':
../fs/ntfs.c:368: warning: unused parameter `file'
../fs/ntfs.c:368: warning: unused parameter `buf'
../fs/ntfs.c:368: warning: unused parameter `len'
../fs/ntfs.c: In function `grub_ntfs_label':
../fs/ntfs.c:392: warning: unused parameter `device'
gcc -o grub-emu grub_emu-kern_main.o grub_emu-kern_device.o 
grub_emu-kern_disk.o grub_emu-kern_dl.o grub_emu-kern_file.o 
grub_emu-kern_fs.o grub_emu-kern_err.o grub_emu-kern_misc.o 
grub_emu-kern_loader.o grub_emu-kern_rescue.o grub_emu-kern_term.o 
grub_emu-disk_i386_pc_partition.o grub_emu-kern_env.o grub_emu-commands_ls.o 
grub_emu-commands_terminal.o grub_emu-commands_boot.o 
grub_emu-commands_cmp.o grub_emu-commands_cat.o 
grub_emu-util_i386_pc_biosdisk.o grub_emu-fs_fat.o grub_emu-fs_ext2.o 
grub_emu-fs_ufs.o grub_emu-fs_minix.o grub_emu-fs_ntfs.o 
grub_emu-normal_cmdline.o grub_emu-normal_command.o grub_emu-normal_main.o 
grub_emu-normal_menu.o grub_emu-normal_arg.o grub_emu-util_console.o 
grub_emu-util_grub_emu.o grub_emu-util_misc.o 
grub_emu-util_i386_pc_getroot.o  -lncurses libntfs.a
gcc -Ifs -I../fs -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow 
-Wpointer-arith -Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os 
-falign-jumps=1 -falign-loops=1 -falign-functions=1 -fno-builtin -mrtd 
-mregparm=3 -c -o ntfs_mod-fs_ntfs.o ../fs/ntfs.c
../fs/ntfs.c: In function `ntfs_device_grub_open':
../fs/ntfs.c:34: warning: unused parameter `flags'
../fs/ntfs.c: In function `ntfs_device_grub_sync':
../fs/ntfs.c:85: warning: unused parameter `dev'
../fs/ntfs.c: In function `ntfs_device_grub_write':
../fs/ntfs.c:92: warning: unused parameter `dev'
../fs/ntfs.c:92: warning: unused parameter `buffer'
../fs/ntfs.c:93: warning: unused parameter `count'
../fs/ntfs.c: In function `ntfs_device_grub_stat':
../fs/ntfs.c:100: warning: unused parameter `dev'
../fs/ntfs.c:100: warning: unused parameter `buf'
../fs/ntfs.c: In function `ntfs_device_grub_ioctl':
../fs/ntfs.c:107: warning: unused parameter `dev'
../fs/ntfs.c:107: warning: unused parameter `request'
../fs/ntfs.c:108: warning: unused parameter `argp'
../fs/ntfs.c: In function `ntfs_device_grub_pwrite':
../fs/ntfs.c:121: warning: unused parameter `dev'
../fs/ntfs.c:121: warning: unused parameter `buf'
../fs/ntfs.c:122: warning: unused parameter `count'
../fs/ntfs.c:122: warning: unused parameter `offset'
../fs/ntfs.c: At top level:
../fs/ntfs.c:199: warning: no previous prototype for 
`grub_ntfs_pathname_to_inode'
../fs/ntfs.c: In function `grub_ntfs_pathname_to_inode':
../fs/ntfs.c:198: warning: unused parameter `parent'
../fs/ntfs.c: In function `grub_ntfs_filldir':
../fs/ntfs.c:269: warning: unused parameter `pos'
../fs/ntfs.c:270: warning: unused parameter `mref'
../fs/ntfs.c: In function `grub_ntfs_read':
../fs/ntfs.c:368: warning: unused parameter `file'
../fs/ntfs.c:368: warning: unused parameter `buf'
../fs/ntfs.c:368: warning: unused parameter `len'
../fs/ntfs.c: In function `grub_ntfs_label':
../fs/ntfs.c:392: warning: unused parameter `device'
rm -f pre-ntfs.o
ld -r -o pre-ntfs.o ntfs_mod-fs_ntfs.o
nm -g --defined-only -P -p pre-ntfs.o | sed 's/^\([^ ]*\).*/\1 ntfs/' > 
def-ntfs.lst
nm -g --defined-only -P -p libntfs.a | sed 's/^\([^ ]*\).*/\1 ntfs/' >> 
def-ntfs.lst
echo 'ntfs' > und-ntfs.lst
nm -u -P -p pre-ntfs.o | cut -f1 -d' ' >> und-ntfs.lst
cat kernel_syms.lst def-_chain.lst def-fat.lst def-ext2.lst def-ufs.lst 
def-minix.lst def-ntfs.lst def-_linux.lst def-normal.lst def-hello.lst 
def-boot.lst def-terminal.lst def-ls.lst def-cmp.lst def-cat.lst def-vga.lst 
def-font.lst def-_multiboot.lst /dev/null | ./genmoddep und-_chain.lst 
und-fat.lst und-ext2.lst und-ufs.lst und-minix.lst und-ntfs.lst 
und-_linux.lst und-normal.lst und-hello.lst und-boot.lst und-terminal.lst 
und-ls.lst und-cmp.lst und-cat.lst und-vga.lst und-font.lst 
und-_multiboot.lst > moddep.lst \
  || (rm -f moddep.lst; exit 1)
sh ../genmodsrc.sh '_chain' moddep.lst > mod-_chain.c || (rm -f 
mod-_chain.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-_chain.o mod-_chain.c
rm -f _chain.mod
ld -r -o _chain.mod pre-_chain.o mod-_chain.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment _chain.mod
sh ../genmodsrc.sh '_linux' moddep.lst > mod-_linux.c || (rm -f 
mod-_linux.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-_linux.o mod-_linux.c
rm -f _linux.mod
ld -r -o _linux.mod pre-_linux.o mod-_linux.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment _linux.mod
sh ../genmodsrc.sh 'fat' moddep.lst > mod-fat.c || (rm -f mod-fat.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-fat.o mod-fat.c
rm -f fat.mod
ld -r -o fat.mod pre-fat.o mod-fat.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment fat.mod
sh ../genmodsrc.sh 'ufs' moddep.lst > mod-ufs.c || (rm -f mod-ufs.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-ufs.o mod-ufs.c
rm -f ufs.mod
ld -r -o ufs.mod pre-ufs.o mod-ufs.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment ufs.mod
sh ../genmodsrc.sh 'ext2' moddep.lst > mod-ext2.c || (rm -f mod-ext2.c; exit 
1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-ext2.o mod-ext2.c
rm -f ext2.mod
ld -r -o ext2.mod pre-ext2.o mod-ext2.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment ext2.mod
sh ../genmodsrc.sh 'minix' moddep.lst > mod-minix.c || (rm -f mod-minix.c; 
exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-minix.o mod-minix.c
rm -f minix.mod
ld -r -o minix.mod pre-minix.o mod-minix.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment minix.mod
sh ../genmodsrc.sh 'ntfs' moddep.lst > mod-ntfs.c || (rm -f mod-ntfs.c; exit 
1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-ntfs.o mod-ntfs.c
rm -f ntfs.mod
ld -r -o ntfs.mod pre-ntfs.o mod-ntfs.o libntfs.a
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment ntfs.mod
sh ../genmodsrc.sh 'normal' moddep.lst > mod-normal.c || (rm -f 
mod-normal.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-normal.o mod-normal.c
rm -f normal.mod
ld -r -o normal.mod pre-normal.o mod-normal.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment normal.mod
sh ../genmodsrc.sh 'hello' moddep.lst > mod-hello.c || (rm -f mod-hello.c; 
exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-hello.o mod-hello.c
rm -f hello.mod
ld -r -o hello.mod pre-hello.o mod-hello.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment hello.mod
sh ../genmodsrc.sh 'vga' moddep.lst > mod-vga.c || (rm -f mod-vga.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-vga.o mod-vga.c
rm -f vga.mod
ld -r -o vga.mod pre-vga.o mod-vga.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment vga.mod
sh ../genmodsrc.sh 'font' moddep.lst > mod-font.c || (rm -f mod-font.c; exit 
1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-font.o mod-font.c
rm -f font.mod
ld -r -o font.mod pre-font.o mod-font.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment font.mod
sh ../genmodsrc.sh '_multiboot' moddep.lst > mod-_multiboot.c || (rm -f 
mod-_multiboot.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-_multiboot.o mod-_multiboot.c
rm -f _multiboot.mod
ld -r -o _multiboot.mod pre-_multiboot.o mod-_multiboot.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment _multiboot.mod
sh ../genmodsrc.sh 'ls' moddep.lst > mod-ls.c || (rm -f mod-ls.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-ls.o mod-ls.c
rm -f ls.mod
ld -r -o ls.mod pre-ls.o mod-ls.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment ls.mod
sh ../genmodsrc.sh 'boot' moddep.lst > mod-boot.c || (rm -f mod-boot.c; exit 
1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-boot.o mod-boot.c
rm -f boot.mod
ld -r -o boot.mod pre-boot.o mod-boot.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment boot.mod
sh ../genmodsrc.sh 'cmp' moddep.lst > mod-cmp.c || (rm -f mod-cmp.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-cmp.o mod-cmp.c
rm -f cmp.mod
ld -r -o cmp.mod pre-cmp.o mod-cmp.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment cmp.mod
sh ../genmodsrc.sh 'cat' moddep.lst > mod-cat.c || (rm -f mod-cat.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-cat.o mod-cat.c
rm -f cat.mod
ld -r -o cat.mod pre-cat.o mod-cat.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment cat.mod
sh ../genmodsrc.sh 'terminal' moddep.lst > mod-terminal.c || (rm -f 
mod-terminal.c; exit 1)
gcc -I. -Iinclude -I../include -Wall -W -Wall -W -Wshadow -Wpointer-arith 
-Wmissing-prototypes 		-Wundef -Wstrict-prototypes -g -Os -falign-jumps=1 
-falign-loops=1 -falign-functions=1 -fno-builtin -mrtd -mregparm=3 -c -o 
mod-terminal.o mod-terminal.c
rm -f terminal.mod
ld -r -o terminal.mod pre-terminal.o mod-terminal.o
strip --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note -R 
.comment terminal.mod


[-- Attachment #3: mkimg.log --]
[-- Type: text/plain, Size: 23165 bytes --]

execve("./grub-mkimage", ["./grub-mkimage", "-d", ".", "-o", "core.img", 
"_chain", "ntfs", "ls", "terminal", "normal", "vga", "font", "hello", "cat", 
"cmp"], [/* 26 vars */]) = 0
brk(0)                                  = 0x804cd6c
open("/etc/ld.so.preload", O_RDONLY)    = -1 ENOENT (No such file or 
directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=20493, ...}) = 0
old_mmap(NULL, 20493, PROT_READ, MAP_PRIVATE, 3, 0) = 0x40015000
close(3)                                = 0
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0p\\\1\000"..., 1024) 
= 1024
fstat64(3, {st_mode=S_IFREG|0755, st_size=1435624, ...}) = 0
old_mmap(NULL, 1256740, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x4001b000
mprotect(0x40145000, 36132, PROT_NONE)  = 0
old_mmap(0x40145000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 
0x12a000) = 0x40145000
old_mmap(0x4014a000, 15652, PROT_READ|PROT_WRITE, 
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4014a000
close(3)                                = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x4014e000
munmap(0x40015000, 20493)               = 0
brk(0)                                  = 0x804cd6c
brk(0x804dd6c)                          = 0x804dd6c
brk(0x804e000)                          = 0x804e000
open("core.img", O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 3
open("./moddep.lst", O_RDONLY)          = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=179, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) 
= 0x40015000
read(4, "_chain:\nfat:\next2:\nufs:\nminix:\nn"..., 4096) = 179
read(4, "", 4096)                       = 0
close(4)                                = 0
munmap(0x40015000, 4096)                = 0
brk(0x804f000)                          = 0x804f000
brk(0x8050000)                          = 0x8050000
brk(0x8051000)                          = 0x8051000
brk(0x8052000)                          = 0x8052000
brk(0x8053000)                          = 0x8053000
brk(0x8054000)                          = 0x8054000
brk(0x8055000)                          = 0x8055000
brk(0x8056000)                          = 0x8056000
brk(0x8057000)                          = 0x8057000
brk(0x8058000)                          = 0x8058000
brk(0x8059000)                          = 0x8059000
brk(0x805a000)                          = 0x805a000
brk(0x805b000)                          = 0x805b000
brk(0x805c000)                          = 0x805c000
brk(0x805d000)                          = 0x805d000
brk(0x805e000)                          = 0x805e000
brk(0x805f000)                          = 0x805f000
brk(0x8060000)                          = 0x8060000
brk(0x8061000)                          = 0x8061000
brk(0x8062000)                          = 0x8062000
brk(0x8063000)                          = 0x8063000
brk(0x8064000)                          = 0x8064000
brk(0x8065000)                          = 0x8065000
brk(0x8066000)                          = 0x8066000
brk(0x8067000)                          = 0x8067000
brk(0x8068000)                          = 0x8068000
brk(0x8069000)                          = 0x8069000
brk(0x806a000)                          = 0x806a000
brk(0x806b000)                          = 0x806b000
brk(0x806c000)                          = 0x806c000
brk(0x806d000)                          = 0x806d000
brk(0x806e000)                          = 0x806e000
brk(0x806f000)                          = 0x806f000
brk(0x8070000)                          = 0x8070000
brk(0x8071000)                          = 0x8071000
brk(0x8072000)                          = 0x8072000
brk(0x8073000)                          = 0x8073000
brk(0x8074000)                          = 0x8074000
brk(0x8075000)                          = 0x8075000
brk(0x8076000)                          = 0x8076000
brk(0x8077000)                          = 0x8077000
brk(0x8078000)                          = 0x8078000
brk(0x8079000)                          = 0x8079000
brk(0x807a000)                          = 0x807a000
brk(0x807b000)                          = 0x807b000
brk(0x807c000)                          = 0x807c000
brk(0x807d000)                          = 0x807d000
brk(0x807e000)                          = 0x807e000
brk(0x807f000)                          = 0x807f000
brk(0x8080000)                          = 0x8080000
brk(0x8081000)                          = 0x8081000
brk(0x8082000)                          = 0x8082000
brk(0x8083000)                          = 0x8083000
brk(0x8084000)                          = 0x8084000
brk(0x8085000)                          = 0x8085000
brk(0x8086000)                          = 0x8086000
brk(0x8087000)                          = 0x8087000
brk(0x8088000)                          = 0x8088000
brk(0x8089000)                          = 0x8089000
brk(0x808a000)                          = 0x808a000
brk(0x808b000)                          = 0x808b000
brk(0x808c000)                          = 0x808c000
brk(0x808d000)                          = 0x808d000
brk(0x808e000)                          = 0x808e000
brk(0x808f000)                          = 0x808f000
brk(0x8090000)                          = 0x8090000
brk(0x8091000)                          = 0x8091000
brk(0x8092000)                          = 0x8092000
brk(0x8093000)                          = 0x8093000
brk(0x8094000)                          = 0x8094000
brk(0x8095000)                          = 0x8095000
brk(0x8096000)                          = 0x8096000
brk(0x8097000)                          = 0x8097000
brk(0x8098000)                          = 0x8098000
brk(0x8099000)                          = 0x8099000
brk(0x809a000)                          = 0x809a000
brk(0x809b000)                          = 0x809b000
brk(0x809c000)                          = 0x809c000
brk(0x809d000)                          = 0x809d000
brk(0x809e000)                          = 0x809e000
brk(0x809f000)                          = 0x809f000
brk(0x80a0000)                          = 0x80a0000
brk(0x80a1000)                          = 0x80a1000
brk(0x80a2000)                          = 0x80a2000
brk(0x80a3000)                          = 0x80a3000
brk(0x80a4000)                          = 0x80a4000
brk(0x80a5000)                          = 0x80a5000
brk(0x80a6000)                          = 0x80a6000
brk(0x80a7000)                          = 0x80a7000
brk(0x80a8000)                          = 0x80a8000
brk(0x80a9000)                          = 0x80a9000
brk(0x80aa000)                          = 0x80aa000
brk(0x80ab000)                          = 0x80ab000
brk(0x80ac000)                          = 0x80ac000
brk(0x80ad000)                          = 0x80ad000
brk(0x80ae000)                          = 0x80ae000
brk(0x80af000)                          = 0x80af000
brk(0x80b0000)                          = 0x80b0000
brk(0x80b1000)                          = 0x80b1000
brk(0x80b2000)                          = 0x80b2000
brk(0x80b3000)                          = 0x80b3000
brk(0x80b4000)                          = 0x80b4000
brk(0x80b5000)                          = 0x80b5000
brk(0x80b6000)                          = 0x80b6000
brk(0x80b7000)                          = 0x80b7000
brk(0x80b8000)                          = 0x80b8000
brk(0x80b9000)                          = 0x80b9000
brk(0x80ba000)                          = 0x80ba000
brk(0x80bb000)                          = 0x80bb000
brk(0x80bc000)                          = 0x80bc000
brk(0x80bd000)                          = 0x80bd000
brk(0x80be000)                          = 0x80be000
brk(0x80bf000)                          = 0x80bf000
brk(0x80c0000)                          = 0x80c0000
brk(0x80c1000)                          = 0x80c1000
brk(0x80c2000)                          = 0x80c2000
brk(0x80c3000)                          = 0x80c3000
brk(0x80c4000)                          = 0x80c4000
brk(0x80c5000)                          = 0x80c5000
brk(0x80c6000)                          = 0x80c6000
brk(0x80c7000)                          = 0x80c7000
brk(0x80c8000)                          = 0x80c8000
brk(0x80c9000)                          = 0x80c9000
brk(0x80ca000)                          = 0x80ca000
brk(0x80cb000)                          = 0x80cb000
brk(0x80cc000)                          = 0x80cc000
brk(0x80cd000)                          = 0x80cd000
brk(0x80ce000)                          = 0x80ce000
brk(0x80cf000)                          = 0x80cf000
brk(0x80d0000)                          = 0x80d0000
brk(0x80d1000)                          = 0x80d1000
brk(0x80d2000)                          = 0x80d2000
brk(0x80d3000)                          = 0x80d3000
brk(0x80d4000)                          = 0x80d4000
brk(0x80d5000)                          = 0x80d5000
brk(0x80d6000)                          = 0x80d6000
brk(0x80d7000)                          = 0x80d7000
brk(0x80d8000)                          = 0x80d8000
brk(0x80d9000)                          = 0x80d9000
brk(0x80da000)                          = 0x80da000
brk(0x80db000)                          = 0x80db000
brk(0x80dc000)                          = 0x80dc000
brk(0x80dd000)                          = 0x80dd000
brk(0x80de000)                          = 0x80de000
brk(0x80df000)                          = 0x80df000
brk(0x80e0000)                          = 0x80e0000
brk(0x80e1000)                          = 0x80e1000
brk(0x80e2000)                          = 0x80e2000
brk(0x80e3000)                          = 0x80e3000
brk(0x80e4000)                          = 0x80e4000
brk(0x80e5000)                          = 0x80e5000
brk(0x80e6000)                          = 0x80e6000
brk(0x80e7000)                          = 0x80e7000
brk(0x80e8000)                          = 0x80e8000
brk(0x80e9000)                          = 0x80e9000
brk(0x80ea000)                          = 0x80ea000
brk(0x80eb000)                          = 0x80eb000
brk(0x80ec000)                          = 0x80ec000
brk(0x80ed000)                          = 0x80ed000
brk(0x80ee000)                          = 0x80ee000
brk(0x80ef000)                          = 0x80ef000
brk(0x80f0000)                          = 0x80f0000
brk(0x80f1000)                          = 0x80f1000
brk(0x80f2000)                          = 0x80f2000
brk(0x80f3000)                          = 0x80f3000
brk(0x80f4000)                          = 0x80f4000
brk(0x80f5000)                          = 0x80f5000
brk(0x80f6000)                          = 0x80f6000
brk(0x80f7000)                          = 0x80f7000
brk(0x80f8000)                          = 0x80f8000
brk(0x80f9000)                          = 0x80f9000
brk(0x80fa000)                          = 0x80fa000
brk(0x80fb000)                          = 0x80fb000
brk(0x80fc000)                          = 0x80fc000
brk(0x80fd000)                          = 0x80fd000
brk(0x80fe000)                          = 0x80fe000
brk(0x80ff000)                          = 0x80ff000
brk(0x8100000)                          = 0x8100000
brk(0x8101000)                          = 0x8101000
brk(0x8102000)                          = 0x8102000
brk(0x8103000)                          = 0x8103000
brk(0x8104000)                          = 0x8104000
brk(0x8105000)                          = 0x8105000
brk(0x8106000)                          = 0x8106000
brk(0x8107000)                          = 0x8107000
brk(0x8108000)                          = 0x8108000
brk(0x8109000)                          = 0x8109000
brk(0x810a000)                          = 0x810a000
brk(0x810b000)                          = 0x810b000
brk(0x810c000)                          = 0x810c000
brk(0x810d000)                          = 0x810d000
brk(0x810e000)                          = 0x810e000
brk(0x810f000)                          = 0x810f000
brk(0x8110000)                          = 0x8110000
brk(0x8111000)                          = 0x8111000
brk(0x8112000)                          = 0x8112000
brk(0x8113000)                          = 0x8113000
brk(0x8114000)                          = 0x8114000
brk(0x8115000)                          = 0x8115000
brk(0x8116000)                          = 0x8116000
brk(0x8117000)                          = 0x8117000
brk(0x8118000)                          = 0x8118000
brk(0x8119000)                          = 0x8119000
brk(0x811a000)                          = 0x811a000
brk(0x811b000)                          = 0x811b000
brk(0x811c000)                          = 0x811c000
brk(0x811d000)                          = 0x811d000
brk(0x811e000)                          = 0x811e000
brk(0x811f000)                          = 0x811f000
brk(0x8120000)                          = 0x8120000
brk(0x8121000)                          = 0x8121000
brk(0x8122000)                          = 0x8122000
brk(0x8123000)                          = 0x8123000
brk(0x8124000)                          = 0x8124000
brk(0x8125000)                          = 0x8125000
brk(0x8126000)                          = 0x8126000
brk(0x8127000)                          = 0x8127000
brk(0x8128000)                          = 0x8128000
brk(0x8129000)                          = 0x8129000
brk(0x812a000)                          = 0x812a000
brk(0x812b000)                          = 0x812b000
brk(0x812c000)                          = 0x812c000
brk(0x812d000)                          = 0x812d000
brk(0x812e000)                          = 0x812e000
brk(0x812f000)                          = 0x812f000
brk(0x8130000)                          = 0x8130000
brk(0x8131000)                          = 0x8131000
brk(0x8132000)                          = 0x8132000
brk(0x8133000)                          = 0x8133000
brk(0x8134000)                          = 0x8134000
brk(0x8135000)                          = 0x8135000
brk(0x8136000)                          = 0x8136000
brk(0x8137000)                          = 0x8137000
brk(0x8138000)                          = 0x8138000
brk(0x8139000)                          = 0x8139000
brk(0x813a000)                          = 0x813a000
brk(0x813b000)                          = 0x813b000
brk(0x813c000)                          = 0x813c000
brk(0x813d000)                          = 0x813d000
brk(0x813e000)                          = 0x813e000
brk(0x813f000)                          = 0x813f000
brk(0x8140000)                          = 0x8140000
brk(0x8141000)                          = 0x8141000
brk(0x8142000)                          = 0x8142000
brk(0x8143000)                          = 0x8143000
brk(0x8144000)                          = 0x8144000
brk(0x8145000)                          = 0x8145000
brk(0x8146000)                          = 0x8146000
brk(0x8147000)                          = 0x8147000
brk(0x8148000)                          = 0x8148000
brk(0x8149000)                          = 0x8149000
brk(0x814a000)                          = 0x814a000
brk(0x814b000)                          = 0x814b000
brk(0x814c000)                          = 0x814c000
brk(0x814d000)                          = 0x814d000
brk(0x814e000)                          = 0x814e000
brk(0x814f000)                          = 0x814f000
brk(0x8150000)                          = 0x8150000
brk(0x8151000)                          = 0x8151000
brk(0x8152000)                          = 0x8152000
brk(0x8153000)                          = 0x8153000
brk(0x8154000)                          = 0x8154000
brk(0x8155000)                          = 0x8155000
brk(0x8156000)                          = 0x8156000
brk(0x8157000)                          = 0x8157000
brk(0x8158000)                          = 0x8158000
brk(0x8159000)                          = 0x8159000
brk(0x815a000)                          = 0x815a000
brk(0x815b000)                          = 0x815b000
brk(0x815c000)                          = 0x815c000
brk(0x815d000)                          = 0x815d000
brk(0x815e000)                          = 0x815e000
brk(0x815f000)                          = 0x815f000
brk(0x8160000)                          = 0x8160000
brk(0x8161000)                          = 0x8161000
brk(0x8162000)                          = 0x8162000
brk(0x8163000)                          = 0x8163000
brk(0x8164000)                          = 0x8164000
brk(0x8165000)                          = 0x8165000
brk(0x8166000)                          = 0x8166000
brk(0x8167000)                          = 0x8167000
brk(0x8168000)                          = 0x8168000
brk(0x8169000)                          = 0x8169000
brk(0x816a000)                          = 0x816a000
brk(0x816b000)                          = 0x816b000
brk(0x816c000)                          = 0x816c000
brk(0x816d000)                          = 0x816d000
brk(0x816e000)                          = 0x816e000
brk(0x816f000)                          = 0x816f000
brk(0x8170000)                          = 0x8170000
brk(0x8171000)                          = 0x8171000
brk(0x8172000)                          = 0x8172000
brk(0x8173000)                          = 0x8173000
brk(0x8174000)                          = 0x8174000
brk(0x8175000)                          = 0x8175000
brk(0x8176000)                          = 0x8176000
brk(0x8177000)                          = 0x8177000
brk(0x8178000)                          = 0x8178000
brk(0x8179000)                          = 0x8179000
brk(0x817a000)                          = 0x817a000
brk(0x817b000)                          = 0x817b000
brk(0x817c000)                          = 0x817c000
brk(0x817d000)                          = 0x817d000
brk(0x817e000)                          = 0x817e000
brk(0x817f000)                          = 0x817f000
brk(0x8180000)                          = 0x8180000
brk(0x8181000)                          = 0x8181000
brk(0x8182000)                          = 0x8182000
brk(0x8183000)                          = 0x8183000
brk(0x8184000)                          = 0x8184000
brk(0x8185000)                          = 0x8185000
brk(0x8186000)                          = 0x8186000
brk(0x8187000)                          = 0x8187000
brk(0x8188000)                          = 0x8188000
brk(0x8189000)                          = 0x8189000
brk(0x818a000)                          = 0x818a000
brk(0x818b000)                          = 0x818b000
brk(0x818c000)                          = 0x818c000
brk(0x818d000)                          = 0x818d000
brk(0x818e000)                          = 0x818e000
brk(0x818f000)                          = 0x818f000
brk(0x8190000)                          = 0x8190000
brk(0x8191000)                          = 0x8191000
brk(0x8192000)                          = 0x8192000
brk(0x8193000)                          = 0x8193000
brk(0x8194000)                          = 0x8194000
brk(0x8195000)                          = 0x8195000
brk(0x8196000)                          = 0x8196000
brk(0x8197000)                          = 0x8197000
brk(0x8198000)                          = 0x8198000
brk(0x8199000)                          = 0x8199000
brk(0x819a000)                          = 0x819a000
brk(0x819b000)                          = 0x819b000
brk(0x819c000)                          = 0x819c000
brk(0x819d000)                          = 0x819d000
brk(0x819e000)                          = 0x819e000
brk(0x819f000)                          = 0x819f000
brk(0x81a0000)                          = 0x81a0000
brk(0x81a1000)                          = 0x81a1000
brk(0x81a2000)                          = 0x81a2000
brk(0x81a3000)                          = 0x81a3000
brk(0x81a4000)                          = 0x81a4000
brk(0x81a5000)                          = 0x81a5000
brk(0x81a6000)                          = 0x81a6000
brk(0x81a7000)                          = 0x81a7000
brk(0x81a8000)                          = 0x81a8000
brk(0x81a9000)                          = 0x81a9000
brk(0x81aa000)                          = 0x81aa000
brk(0x81ab000)                          = 0x81ab000
brk(0x81ac000)                          = 0x81ac000
brk(0x81ad000)                          = 0x81ad000
brk(0x81ae000)                          = 0x81ae000
brk(0x81af000)                          = 0x81af000
brk(0x81b0000)                          = 0x81b0000
brk(0x81b1000)                          = 0x81b1000
brk(0x81b2000)                          = 0x81b2000
brk(0x81b3000)                          = 0x81b3000
brk(0x81b4000)                          = 0x81b4000
brk(0x81b5000)                          = 0x81b5000
brk(0x81b6000)                          = 0x81b6000
brk(0x81b7000)                          = 0x81b7000
brk(0x81b8000)                          = 0x81b8000
brk(0x81b9000)                          = 0x81b9000
brk(0x81ba000)                          = 0x81ba000
brk(0x81bb000)                          = 0x81bb000
brk(0x81bc000)                          = 0x81bc000
brk(0x81bd000)                          = 0x81bd000
brk(0x81be000)                          = 0x81be000
brk(0x81bf000)                          = 0x81bf000
brk(0x81c0000)                          = 0x81c0000
brk(0x81c1000)                          = 0x81c1000
brk(0x81c2000)                          = 0x81c2000
brk(0x81c3000)                          = 0x81c3000
brk(0x81c4000)                          = 0x81c4000
brk(0x81c5000)                          = 0x81c5000
brk(0x81c6000)                          = 0x81c6000
brk(0x81c7000)                          = 0x81c7000
brk(0x81c8000)                          = 0x81c8000
brk(0x81c9000)                          = 0x81c9000
brk(0x81ca000)                          = 0x81ca000
brk(0x81cb000)                          = 0x81cb000
brk(0x81cc000)                          = 0x81cc000
brk(0x81cd000)                          = 0x81cd000
brk(0x81ce000)                          = 0x81ce000
brk(0x81cf000)                          = 0x81cf000
brk(0x81d0000)                          = 0x81d0000
brk(0x81d1000)                          = 0x81d1000
brk(0x81d2000)                          = 0x81d2000
brk(0x81d3000)                          = 0x81d3000
brk(0x81d4000)                          = 0x81d4000
brk(0x81d5000)                          = 0x81d5000
brk(0x81d6000)                          = 0x81d6000
brk(0x81d7000)                          = 0x81d7000
brk(0x81d8000)                          = 0x81d8000
brk(0x81d9000)                          = 0x81d9000
brk(0x81da000)                          = 0x81da000
brk(0x81db000)                          = 0x81db000
brk(0x81dc000)                          = 0x81dc000
brk(0x81dd000)                          = 0x81dd000
brk(0x81de000)                          = 0x81de000
brk(0x81df000)                          = 0x81df000
brk(0x81e0000)                          = 0x81e0000
brk(0x81e1000)                          = 0x81e1000
brk(0x81e2000)                          = 0x81e2000
brk(0x81e3000)                          = 0x81e3000
brk(0x81e4000)                          = 0x81e4000
brk(0x81e5000)                          = 0x81e5000
brk(0x81e6000)                          = 0x81e6000
brk(0x81e7000)                          = 0x81e7000
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++


^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: problems compiling NTFS on GRUB2
@ 2004-08-16  9:22 lode leroy
  2004-08-16  9:44 ` Marco Gerards
  0 siblings, 1 reply; 7+ messages in thread
From: lode leroy @ 2004-08-16  9:22 UTC (permalink / raw)
  To: grub-devel

>Ok.  But I assume you have to add something in order to link it to the 
>library?
ah, yes indeed...

+ grub_setup_LDFLAGS = libntfs.a

+ grub_emu_LDFLAGS = libntfs.a

  ntfs.mod: pre-ntfs.o mod-ntfs.o
      -rm -f $@
-      $(LD) -r -o $@ $^
+      $(LD) -r -o $@ $^ libntfs.a
       $(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -R .note 
-R .comment $@

Would you have suggestions on compile flags needed to compile libntfs
for grub? (now they are -g -O2 -MT -MD -KP -MF )

>I don't think it is easy and clean to use libntfs.

I figure that libntfs was intended to be " a library to avoid code 
duplication
and provide access to NTFS to other GPLed programs " therefore
I assume that using this effort would result in the better solution.

>But the best way to implement NTFS is by writing it yourself.  It is
>on my todo already, or do you want to do this?

I have no intention whatsoever to implement an ntfs driver... providing
the glue between grub and libntfs is/should be a much smaller effort...
Unless you're telling me trying to do this is a lost effort?

>Another thing to consider is its size.
ntfs.mod is 74KB . I don't thinks thats insurmountable...

-- lode

_________________________________________________________________
Don't just search. Find. http://search.msn.be




^ permalink raw reply	[flat|nested] 7+ messages in thread
* problems compiling NTFS on GRUB2
@ 2004-08-12 12:43 lode leroy
  2004-08-12 13:02 ` Marco Gerards
  0 siblings, 1 reply; 7+ messages in thread
From: lode leroy @ 2004-08-12 12:43 UTC (permalink / raw)
  To: grub-devel

Hello grub,

I'm trying to compile the attached file, to provide
NTFS support for GRUB2. It's supposed to use libntfs
(http://linux-ntfs.sourceforge.net/).

to compile libntfs, I used
./configure --disable-default-device-io-ops
                --disable-gnome-vfs
                --enable-really-static

the in config.h, I added
#define printf grub_printf
#undef errno

then "make" in libntfs, which gives me a libntfs.a

Then I tried to compile fs/ntfs.c, which works,
but I then get a crash in
./grub-mkinage -d . -o core.img _chain ntfs ls terminal normal vga

Can anyone advise on this?

-- lode

#include <grub/fs.h>
#include <grub/disk.h>
#include <grub/file.h>
#include <grub/types.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/err.h>
#include <grub/dl.h>

#include <ntfs/types.h>
#include <ntfs/inode.h>
#include <ntfs/dir.h>

#ifndef GRUB_UTIL
static grub_dl_t my_mod;
#endif

#define PATH_SEP '/'

struct grub_ntfs_data
{
  struct ntfs_device *dev;
  ntfs_volume *vol;
  ntfs_inode *ino;

  grub_disk_t disk;
  grub_uint32_t current_pos;

  int (*hook) (const char *filename, int dir);
};

static int ntfs_device_grub_open(struct ntfs_device *dev, int flags)
{
  struct grub_ntfs_data* data = (struct grub_ntfs_data*)dev->d_private;
  data->current_pos = 0;
  return 0;
}

static s64 ntfs_device_grub_seek(struct ntfs_device *dev, s64 offset,
				 int whence)
{
  struct grub_ntfs_data* data = (struct grub_ntfs_data*)dev->d_private;

  switch (whence) {
  case SEEK_SET:
    data->current_pos = offset;
    break;
  case SEEK_CUR:
    data->current_pos += offset;
    break;
  case SEEK_END:
    grub_errno = ENOTSUP;
    return -1;
    break;
  default:
    grub_printf("grub_seek() wrong mode %d\n", whence);
    grub_errno = EINVAL;
    return -1;
  }

  return data->current_pos;
}

static s64 ntfs_device_grub_read(struct ntfs_device *dev, void *buf, s64 
count)
{
  struct grub_ntfs_data* data = (struct grub_ntfs_data*)dev->d_private;
  s64 sector = data->current_pos / 512;
  s64 offset = data->current_pos % 512;
  s64 size = count;
  s64 numread = grub_disk_read(data->disk, sector, offset, size, buf);
  data->current_pos += numread;
  return numread;
}

static int ntfs_device_grub_close(struct ntfs_device *dev)
{
  struct grub_ntfs_data* data = (struct grub_ntfs_data*)dev->d_private;
  grub_free (data);
  dev->d_private = NULL;
  return 0;
}

static int ntfs_device_grub_sync(struct ntfs_device *dev)
{
  grub_printf("grub_fsync() unimplemented\n");
  errno = ENOTSUP;
  return -1;
}

static s64 ntfs_device_grub_write(struct ntfs_device *dev, const void 
*buffer,
				  s64 count)
{
  grub_printf("grub_write() unimplemented\n");
  errno = ENOTSUP;
  return -1;
}

static int ntfs_device_grub_stat(struct ntfs_device *dev, struct stat *buf)
{
  grub_printf("grub_fstat() unimplemented\n");
  errno = ENOTSUP;
  return -1;
}

static int ntfs_device_grub_ioctl(struct ntfs_device *dev, int request,
				  void *argp)
{
  grub_printf("grub_ioctl() unimplemented\n");
  errno = ENOTSUP;
  return -1;
}

static s64 ntfs_device_grub_pread(struct ntfs_device *dev, void *buf,
				  s64 count, s64 offset)
{
  return ntfs_pread(dev, offset, count, buf);
}

static s64 ntfs_device_grub_pwrite(struct ntfs_device *dev, const void *buf,
				   s64 count, s64 offset)
{
  grub_printf("grub_pwrite() unimplemented\n");
  errno = ENOTSUP;
  return -1;
}

struct ntfs_device_operations ntfs_device_grub_io_ops = {
  .open   = ntfs_device_grub_open,
  .close  = ntfs_device_grub_close,
  .seek   = ntfs_device_grub_seek,
  .read   = ntfs_device_grub_read,
  .write  = ntfs_device_grub_write,
  .pread  = ntfs_device_grub_pread,
  .pwrite = ntfs_device_grub_pwrite,
  .sync   = ntfs_device_grub_sync,
  .stat   = ntfs_device_grub_stat,
  .ioctl  = ntfs_device_grub_ioctl
};


static struct grub_ntfs_data *
grub_ntfs_mount(grub_disk_t disk)
{
  struct grub_ntfs_data *data = 0;

  if (!disk)
    goto fail;

  data = (struct grub_ntfs_data *) grub_malloc (sizeof (*data));
  if (!data)
    goto fail;

  data->dev = ntfs_device_alloc (disk->name, 0, &ntfs_device_grub_io_ops, 
disk);
  if (! data->dev)
    goto fail;

  data->vol = ntfs_device_mount (data->dev, MS_RDONLY);
  if (! data->vol)
    goto fail;

  data->disk = disk;

  return data;

fail:

  if (data && data->vol)
    ntfs_device_umount (data->vol, FALSE);
  if (data && data->dev)
    ntfs_device_free (data->dev);
  grub_free (data);
  grub_error (GRUB_ERR_BAD_FS, "not a ntfs filesystem");
  return 0;
}

static int
grub_ntfs_umount(struct grub_ntfs_data *data)
{
  int rvl = 0;

  if (! data)
    goto fail;

  if (data->vol)
    ntfs_device_umount (data->vol, FALSE);
  if (data->dev)
    rvl = ntfs_device_free (data->dev);
  grub_free (data);
  return rvl;

fail:
  return 0;
}

ntfs_inode*
grub_ntfs_pathname_to_inode(ntfs_volume *vol, ntfs_inode *parent, const 
char* pathname)
{
  char *p = 0;
  char *q = 0;
  uchar_t *unicode = 0;
  int max_path = 0;
  int name_len = 0;
  char *ascii = 0;
  ntfs_inode *ni = 0;
  s64 inum = 0;

  ni = ntfs_inode_open (vol, FILE_root);
  if (! ni)
    goto fail;

  ascii = grub_strdup (pathname);
  if (! ascii)
    goto fail;

  max_path = grub_strlen(pathname)+1;
  unicode = grub_malloc (max_path);
  if (! unicode)
    goto fail;

  p = ascii;
  while (p && *p && *p == PATH_SEP) // Remove leading /'s
    p++;

  while (p && *p)
    {
      q = grub_strrchr (p, PATH_SEP);

      if (q != NULL) {
	*q = '\0';
	q++;
      }

      name_len = ntfs_mbstoucs (p, &unicode, max_path);
      if (name_len < 0)
	goto fail;

      inum = ntfs_inode_lookup_by_name (ni, unicode, name_len);
      if (inum == -1) {
	grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
	goto fail;
      }

      ntfs_inode_close(ni);

      ni = ntfs_inode_open (vol, inum);
      if (! ni) {
	grub_error (GRUB_ERR_FILE_NOT_FOUND, "open inode failed");
	goto fail;
      }

      p = q;
      while (p && *p && *p == PATH_SEP)
	p++;
    }
  grub_free (unicode);
  grub_free (ascii);
  return ni;

fail:
  grub_free (unicode);
  grub_free (ascii);
  return 0;
}

static int
grub_ntfs_filldir(void *dirent, const uchar_t *unicode,
		  const int name_len, const int name_type, const s64 pos,
		  const MFT_REF mref, const unsigned dt_type)
{
  struct grub_ntfs_data *data = (struct grub_ntfs_data*) dirent;
  char *filename = 0;
  int max_path = name_len + 1;

  filename = grub_malloc (max_path);
  if (! filename)
    goto fail;

  if (ntfs_ucstombs (unicode, name_len, &filename, max_path) <0)
    goto fail;

  if (filename[0] == '$')
    goto fail;

  if ((name_type & FILE_NAME_WIN32_AND_DOS) == FILE_NAME_WIN32)
    data->hook(filename, dt_type == NTFS_DT_DIR);

fail:
  grub_free (filename);
  return 0;
}

static grub_err_t
grub_ntfs_dir (grub_device_t device, const char* path,
               int (*hook) (const char *filename, int dir))
{
  struct grub_ntfs_data *data = 0;
  grub_disk_t disk = device->disk;
  s64 pos = 0;
  ntfs_inode *ni = 0;

#ifndef GRUB_UTIL
  grub_dl_ref (my_mod);
#endif

  data = grub_ntfs_mount (disk);
  if (! data)
    goto fail;

  ni = grub_ntfs_pathname_to_inode(data->vol, 0, path);
  if (! ni)
    goto fail;

  if (! (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY))
    {
      grub_error (GRUB_ERR_BAD_FILE_TYPE, "not a directory");
      return 0;
    }
  data->hook = hook;
  ntfs_readdir (ni, &pos, data, grub_ntfs_filldir);
  data->hook = 0;

fail:
  ntfs_inode_close (ni);
  grub_ntfs_umount (data);

#ifndef GRUB_UTIL
  grub_dl_ref (my_mod);
#endif

  return grub_errno;
}

static grub_err_t
grub_ntfs_open (grub_file_t file, const char* name)
{
  struct grub_ntfs_data *data = 0;

#ifndef GRUB_UTIL
  grub_dl_ref (my_mod);
#endif

  data = grub_ntfs_mount (file->device->disk);
  if (! data)
    goto fail;

  data->ino = grub_ntfs_pathname_to_inode(data->vol, 0, name);
  file->size = 42; //TODO: get actual file size

  file->data = data;
  return GRUB_ERR_NONE;

fail:
  if (data->ino)
    ntfs_inode_close (data->ino);
  grub_ntfs_umount (data);
  grub_free (data);

#ifndef GRUB_UTIL
  grub_dl_unref (my_mod);
#endif

  return grub_errno;
}

static grub_ssize_t
grub_ntfs_read (grub_file_t file, char* buf, grub_ssize_t len)
{
  return -1;
}

static grub_err_t
grub_ntfs_close (grub_file_t file)
{
  struct grub_ntfs_data *data = 0;
  data = (struct grub_ntfs_data*) file->data;
  if (data->ino)
    ntfs_inode_close (data->ino);
  if (data->vol)
    grub_ntfs_umount (data);
  grub_free (file->data);

#ifndef GRUB_UTIL
  grub_dl_unref (my_mod);
#endif

  return grub_errno;
}

static grub_err_t
grub_ntfs_label (grub_device_t device, char **label)
{
  *label = grub_strndup("ntfs_label", 11);
  return GRUB_ERR_NONE;
}


static struct grub_fs grub_ntfs_fs =
  {
    .name = "ntfs",
    .dir = grub_ntfs_dir,
    .open = grub_ntfs_open,
    .read = grub_ntfs_read,
    .close = grub_ntfs_close,
    .label = grub_ntfs_label,
    .next = 0
  };

#ifdef GRUB_UTIL
void
grub_ntfs_init (void)
{
  grub_fs_register (&grub_ntfs_fs);
}

void
grub_ntfs_fini (void)
{
  grub_fs_unregister (&grub_ntfs_fs);
}
#else /* ! GRUB_UTIL */
GRUB_MOD_INIT
{
  grub_fs_register (&grub_ntfs_fs);
  my_mod = mod;
}

GRUB_MOD_FINI
{
  grub_fs_unregister (&grub_ntfs_fs);
}
#endif /* ! GRUB_UTIL */

_________________________________________________________________
Try before you buy http://linkstat.neckermann.de/go.mb1?benl_10044




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-08-16 10:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-13  6:59 problems compiling NTFS on GRUB2 lode leroy
2004-08-13 10:25 ` Marco Gerards
  -- strict thread matches above, loose matches on Subject: below --
2004-08-16  9:22 lode leroy
2004-08-16  9:44 ` Marco Gerards
2004-08-16 10:35   ` Yoshinori K. Okuji
2004-08-12 12:43 lode leroy
2004-08-12 13:02 ` Marco Gerards

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.