Error while cross compiling linux kernel

107 views
Skip to first unread message

knilaks...@gmail.com

unread,
Oct 18, 2018, 1:54:56 AM10/18/18
to RISC-V HW Dev
I tried to cross compile Linux 4.18.14 kernel.Itried the command  make -j ARCH=riscv
but got some unreference error.ThenI tried  make -j ARCH=riscv CROSS_COMPILE=
risc64-unknown-linux-gnu-
I got the follwing error
Makefile:1027: recipe for target 'vmlinux' failed
arch/riscv/kernel/setup.o: In function `.L24':
setup.c:(.init.text+0x2e2): undefined reference to `swiotlb_init'
Makefile:1027: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

Any suggestions to overcome this?

Michael Clark

unread,
Oct 18, 2018, 7:30:39 AM10/18/18
to knilaks...@gmail.com, RISC-V HW Dev
Try this patch (apply with patch -p1 < swiotlb.patch)

knilaks...@gmail.com

unread,
Oct 19, 2018, 5:40:16 AM10/19/18
to RISC-V HW Dev
Thanks Michael it working.
I have some more confusion
1.How can I edit the configuration to support MMU less architecture for 32 bit RISCV?

Michael Clark

unread,
Oct 19, 2018, 3:27:03 PM10/19/18
to knilaks...@gmail.com, RISC-V HW Dev


On 19/10/2018, at 10:40 PM, knilaks...@gmail.com wrote:

Thanks Michael it working.
I have some more confusion
1.How can I edit the configuration to support MMU less architecture for 32 bit RISCV?

There is no no-MMU Linux port at present. The port requires FDPIC support in binutils. In regular PIC binaries, the offset between the read-only .text,.rodata sections and the read-write .data,.bss sections is fixed. This is historical. No-MMU systems require multiple instances of the same binary or shlib to be shared with the same addresses for .text,.rodata and different memory addresses for .data,.bss. 

In FDPIC, the offset to .data,.bss is no longer PC-Relative like it is with PIC rather it is relative to a TOC register, likely gp-relative on RISC-V as gp is currently reserved when generating PIC code. FDPIC also requires function pointers to point to function descriptors that contain both the function address and the FDPIC register value (pointer to GOT Base in .data,.bss). The FDPIC register needs to be loaded in the PLTs for inter-module calls, so each module can find its .data,.bss (as it’s no longer PC-Relative).

FDPIC has some interesting properties. A larger set of pointers can be leaked without revealing the location of .text (via static analysis i.e. known .data pointer can reveal .text via static analysis which can be used for ROP). However this is only partial as pointers to .rodata can still be leaked.

Unfortunately no-MMU Linux is crusty because nobody tests it so your out of luck. Nevertheless FDPIC would be useful for other no-MMU applications where there is more than one ELF loaded in memory or where the ROM/RAM layout (distance between ROM and RAM) is not known at link time. It’s a pity. Also we don’t have ASLR for regular PIC.
This is because IO redirection ‘>’ is executed by your shell and not sudo. You are reading the web with sudo. Try piping to tee.

curl https://foo.bar l sudo tee etc/inittab

or use -o

sudo curl -o etc/inittab https://foo.bar


On Thursday, October 18, 2018 at 11:24:56 AM UTC+5:30, knilaks...@gmail.com wrote:
I tried to cross compile Linux 4.18.14 kernel.Itried the command  make -j ARCH=riscv
but got some unreference error.ThenI tried  make -j ARCH=riscv CROSS_COMPILE=
risc64-unknown-linux-gnu-
I got the follwing error
Makefile:1027: recipe for target 'vmlinux' failed
arch/riscv/kernel/setup.o: In function `.L24':
setup.c:(.init.text+0x2e2): undefined reference to `swiotlb_init'
Makefile:1027: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1

Any suggestions to overcome this?

--
You received this message because you are subscribed to the Google Groups "RISC-V HW Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hw-dev+un...@groups.riscv.org.
To post to this group, send email to hw-...@groups.riscv.org.
Visit this group at https://groups.google.com/a/groups.riscv.org/group/hw-dev/.
To view this discussion on the web visit https://groups.google.com/a/groups.riscv.org/d/msgid/hw-dev/aee5c782-b683-40a3-8d33-dabe5b0e87ef%40groups.riscv.org.

knilaks...@gmail.com

unread,
Oct 21, 2018, 2:45:55 PM10/21/18
to RISC-V HW Dev

Thanks Michael

On Thursday, October 18, 2018 at 11:24:56 AM UTC+5:30, knilaks...@gmail.com wrote:

knilaks...@gmail.com

unread,
Oct 23, 2018, 11:08:42 AM10/23/18
to RISC-V HW Dev


I couldn't save the inittab file

knilaks...@gmail.com

unread,
Oct 23, 2018, 11:10:09 AM10/23/18
to RISC-V HW Dev
I have mounted 64MB portion from disk.The mnt partition is read only.How to make it write enable?


On Thursday, October 18, 2018 at 11:24:56 AM UTC+5:30, knilaks...@gmail.com wrote:

Tommy Murphy

unread,
Oct 23, 2018, 11:30:37 AM10/23/18
to RISC-V HW Dev
On Tuesday, 23 October 2018 16:08:42 UTC+1, knilaks...@gmail.com wrote:

I couldn't save the inittab file

Did you edit/save it as root/sudo? 

knilaks...@gmail.com

unread,
Oct 23, 2018, 11:35:43 AM10/23/18
to RISC-V HW Dev
sudo mount -o loop root.bin mnt
I've used this one

knilaks...@gmail.com

unread,
Oct 23, 2018, 11:37:36 AM10/23/18
to RISC-V HW Dev
dd if=/dev/zero of=root.bin bs=1M count=64
mkfs.ext2 -F root.bin
sudo mount -o loop root.bin mnt



Tommy Murphy

unread,
Oct 23, 2018, 11:43:05 AM10/23/18
to RISC-V HW Dev

On Tuesday, 23 October 2018 16:35:43 UTC+1, knilaks...@gmail.com wrote:
sudo mount -o loop root.bin mnt
I've used this one

Eh? What has that got to do with editing and saving  the file?
You said that you could not save your edits to the inittab file.
I asked if you edited and saved it with root/su privileges?

knilaks...@gmail.com

unread,
Oct 23, 2018, 1:20:34 PM10/23/18
to RISC-V HW Dev
Yes I used to do with sudo privileges
Reply all
Reply to author
Forward
0 new messages