* [Qemu-devel] HelloWord kernel for qemu-system-aarch64 @ 2014-09-04 10:40 Semion Prihodko 2014-09-04 13:29 ` Peter Maydell 0 siblings, 1 reply; 11+ messages in thread From: Semion Prihodko @ 2014-09-04 10:40 UTC (permalink / raw) To: qemu-devel [-- Attachment #1: Type: text/plain, Size: 694 bytes --] Hi guys, Need your help. I trying to find a way to compile/link a minimal kernel which outputs "Hello World" in qemu-system-aarch64. No tutorial found. There is no problem running the same example in Foundation emulator, but I need QEMU. Trying to reuse axf-file in Foundation example: aarch64-linux-gnu-objcopy -O binary hello.axf kernel.bin qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 1 -m 3G -kernel kernel.bin I got: qemu: fatal: Trying to execute code outside RAM or ROM at 0x0000000000000000 What's wrong here? Can you show me some tutorial how to build minimal HelloWorld kernel for qemu-system-aarch64 (without need to generate axf-file)? Thanks in advance. [-- Attachment #2: Type: text/html, Size: 904 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-04 10:40 [Qemu-devel] HelloWord kernel for qemu-system-aarch64 Semion Prihodko @ 2014-09-04 13:29 ` Peter Maydell 2014-09-04 13:40 ` Semion Prihodko 0 siblings, 1 reply; 11+ messages in thread From: Peter Maydell @ 2014-09-04 13:29 UTC (permalink / raw) To: Semion Prihodko; +Cc: QEMU Developers On 4 September 2014 11:40, Semion Prihodko <semion.ababo@gmail.com> wrote: > Hi guys, > > Need your help. I trying to find a way to compile/link a minimal kernel > which outputs "Hello World" in qemu-system-aarch64. No tutorial found. There > is no problem running the same example in Foundation emulator, but I need > QEMU. > > Trying to reuse axf-file in Foundation example: > > aarch64-linux-gnu-objcopy -O binary hello.axf kernel.bin > qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 1 -m 3G > -kernel kernel.bin > > I got: > > qemu: fatal: Trying to execute code outside RAM or ROM at 0x0000000000000000 If you use "-kernel" and it's not an ELF file, then we assume it's a Linux kernel image with the arm64 Linux image header format. Since in your case this probably isn't true, we're crashing very early on. You probably want: (1) to pass the ELF file directly to QEMU rather than converting it to a binary (2) to make sure your image is linked correctly to work with the "virt" board's memory layout, which is different from that of the Foundation models thanks -- PMM ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-04 13:29 ` Peter Maydell @ 2014-09-04 13:40 ` Semion Prihodko 2014-09-04 13:44 ` Peter Maydell 2014-09-04 18:15 ` Christopher Covington 0 siblings, 2 replies; 11+ messages in thread From: Semion Prihodko @ 2014-09-04 13:40 UTC (permalink / raw) To: Peter Maydell; +Cc: QEMU Developers [-- Attachment #1: Type: text/plain, Size: 1396 bytes --] Still don't know how to build/run a simple Hello World kernel on qemu-system-aarch64? Guys, this is a very basic thing, please provide concrete steps. Thanks. 2014-09-04 16:29 GMT+03:00 Peter Maydell <peter.maydell@linaro.org>: > On 4 September 2014 11:40, Semion Prihodko <semion.ababo@gmail.com> wrote: > > Hi guys, > > > > Need your help. I trying to find a way to compile/link a minimal kernel > > which outputs "Hello World" in qemu-system-aarch64. No tutorial found. > There > > is no problem running the same example in Foundation emulator, but I need > > QEMU. > > > > Trying to reuse axf-file in Foundation example: > > > > aarch64-linux-gnu-objcopy -O binary hello.axf kernel.bin > > qemu-system-aarch64 -machine virt -cpu cortex-a57 -nographic -smp 1 -m 3G > > -kernel kernel.bin > > > > I got: > > > > qemu: fatal: Trying to execute code outside RAM or ROM at > 0x0000000000000000 > > If you use "-kernel" and it's not an ELF file, then we assume it's > a Linux kernel image with the arm64 Linux image header format. > Since in your case this probably isn't true, we're crashing very > early on. > > You probably want: > (1) to pass the ELF file directly to QEMU rather than converting > it to a binary > (2) to make sure your image is linked correctly to work with > the "virt" board's memory layout, which is different from that > of the Foundation models > > thanks > -- PMM > [-- Attachment #2: Type: text/html, Size: 2162 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-04 13:40 ` Semion Prihodko @ 2014-09-04 13:44 ` Peter Maydell 2014-09-04 13:49 ` Semion Prihodko 2014-09-04 18:15 ` Christopher Covington 1 sibling, 1 reply; 11+ messages in thread From: Peter Maydell @ 2014-09-04 13:44 UTC (permalink / raw) To: Semion Prihodko; +Cc: QEMU Developers On 4 September 2014 14:40, Semion Prihodko <semion.ababo@gmail.com> wrote: > Still don't know how to build/run a simple Hello World kernel on > qemu-system-aarch64? > > Guys, this is a very basic thing, please provide concrete steps. Thanks It's a non-standard use case. The usual use case is "boot Linux", which you can find documented here, for instance: http://www.bennee.com/~alex/blog/2014/05/09/running-linux-in-qemus-aarch64-system-emulation-mode/ If you're trying to boot your own bare-metal image then you're expected to know what you're doing and be able to resolve problems to some extent. thanks -- PMM ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-04 13:44 ` Peter Maydell @ 2014-09-04 13:49 ` Semion Prihodko 2014-09-04 13:50 ` Peter Maydell 0 siblings, 1 reply; 11+ messages in thread From: Semion Prihodko @ 2014-09-04 13:49 UTC (permalink / raw) To: Peter Maydell; +Cc: QEMU Developers [-- Attachment #1: Type: text/plain, Size: 922 bytes --] Does it mean QEMU emulator is designed to run Linux only? This is not true. So I ask QEMU developers for help, because they are able to resolve problems to some extent. Please help me guys. Thanks. 2014-09-04 16:44 GMT+03:00 Peter Maydell <peter.maydell@linaro.org>: > On 4 September 2014 14:40, Semion Prihodko <semion.ababo@gmail.com> wrote: > > Still don't know how to build/run a simple Hello World kernel on > > qemu-system-aarch64? > > > > Guys, this is a very basic thing, please provide concrete steps. Thanks > > It's a non-standard use case. The usual use case is "boot > Linux", which you can find documented here, for instance: > > http://www.bennee.com/~alex/blog/2014/05/09/running-linux-in-qemus-aarch64-system-emulation-mode/ > > If you're trying to boot your own bare-metal image then > you're expected to know what you're doing and be able to > resolve problems to some extent. > > thanks > -- PMM > [-- Attachment #2: Type: text/html, Size: 1522 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-04 13:49 ` Semion Prihodko @ 2014-09-04 13:50 ` Peter Maydell 0 siblings, 0 replies; 11+ messages in thread From: Peter Maydell @ 2014-09-04 13:50 UTC (permalink / raw) To: Semion Prihodko; +Cc: QEMU Developers On 4 September 2014 14:49, Semion Prihodko <semion.ababo@gmail.com> wrote: > Does it mean QEMU emulator is designed to run Linux only? This is not true. No. It means what I said: you can do this, but you're doing something odd and therefore you can't expect that there will be documentation holding your hand every step of the way. > So I ask QEMU developers for help, because they are able to resolve problems > to some extent. Please help me guys. Thanks. I have in fact given you help: I suggested why your current attempt is crashing and a better approach you should take. thanks -- PMM ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-04 13:40 ` Semion Prihodko 2014-09-04 13:44 ` Peter Maydell @ 2014-09-04 18:15 ` Christopher Covington 2014-09-05 14:50 ` Semion Prihodko 1 sibling, 1 reply; 11+ messages in thread From: Christopher Covington @ 2014-09-04 18:15 UTC (permalink / raw) To: Semion Prihodko; +Cc: Peter Maydell, QEMU Developers Hi Semion, On 09/04/2014 09:40 AM, Semion Prihodko wrote: > Still don't know how to build/run a simple Hello World kernel on > qemu-system-aarch64? > > Guys, this is a very basic thing, please provide concrete steps. Thanks. Here you go. Start at the wget. http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg03487.html Angel semihosting isn't implemented upstream so a text hello world won't be trivial, although given enough time it should be possible to implement Angel semihosting for A64 in QEMU, implement DCC in QEMU and Newlib/libgloss or implement PL011 UART or VirtIO-MMIO console in Newlib/libgloss. Some of the bootloaders and firmwares out there (bootwrapper, ARM trusted firmware, UEFI/Tianocore) may have examples of using the PL011 UART. Christopher -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-04 18:15 ` Christopher Covington @ 2014-09-05 14:50 ` Semion Prihodko 2014-09-05 16:57 ` Claudio Fontana 0 siblings, 1 reply; 11+ messages in thread From: Semion Prihodko @ 2014-09-05 14:50 UTC (permalink / raw) To: Christopher Covington; +Cc: QEMU Developers [-- Attachment #1: Type: text/plain, Size: 1249 bytes --] Let's discard semihosting. I have aarch64-linux-gnu-* toolchain and qemu-system-aarch64 emulator. How can I build a minimal kernel which outputs Hello World! via serial port and run it on the emulator? 2014-09-04 21:15 GMT+03:00 Christopher Covington <cov@codeaurora.org>: > Hi Semion, > > On 09/04/2014 09:40 AM, Semion Prihodko wrote: > > Still don't know how to build/run a simple Hello World kernel on > > qemu-system-aarch64? > > > > Guys, this is a very basic thing, please provide concrete steps. Thanks. > > Here you go. Start at the wget. > > http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg03487.html > > Angel semihosting isn't implemented upstream so a text hello world won't be > trivial, although given enough time it should be possible to implement > Angel > semihosting for A64 in QEMU, implement DCC in QEMU and Newlib/libgloss or > implement PL011 UART or VirtIO-MMIO console in Newlib/libgloss. > > Some of the bootloaders and firmwares out there (bootwrapper, ARM trusted > firmware, UEFI/Tianocore) may have examples of using the PL011 UART. > > Christopher > > -- > Employee of Qualcomm Innovation Center, Inc. > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, > hosted by the Linux Foundation. > [-- Attachment #2: Type: text/html, Size: 1831 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-05 14:50 ` Semion Prihodko @ 2014-09-05 16:57 ` Claudio Fontana 2014-09-05 17:52 ` Semion Prihodko 0 siblings, 1 reply; 11+ messages in thread From: Claudio Fontana @ 2014-09-05 16:57 UTC (permalink / raw) To: Semion Prihodko, Christopher Covington; +Cc: QEMU Developers On 05.09.2014 16:50, Semion Prihodko wrote: > Let's discard semihosting. I have aarch64-linux-gnu-* toolchain and > qemu-system-aarch64 emulator. How can I build a minimal kernel which > outputs Hello World! via serial port and run it on the emulator? > If you run qemu with the "virt" platform, you can write to the UART at 0x9000000 to get a character out, works very early. You could check the AArch64 port of the OSv Operating System, has a simple boot loader you can look at (arch/aarch64/preboot.S and arch/aarch64/boot.S) and the pl011 device you find in drivers/pl011.cc https://github.com/cloudius-systems/osv/wiki/AArch64 Good luck, Claudio > > 2014-09-04 21:15 GMT+03:00 Christopher Covington <cov@codeaurora.org>: > >> Hi Semion, >> >> On 09/04/2014 09:40 AM, Semion Prihodko wrote: >>> Still don't know how to build/run a simple Hello World kernel on >>> qemu-system-aarch64? >>> >>> Guys, this is a very basic thing, please provide concrete steps. Thanks. >> >> Here you go. Start at the wget. >> >> http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg03487.html >> >> Angel semihosting isn't implemented upstream so a text hello world won't be >> trivial, although given enough time it should be possible to implement >> Angel >> semihosting for A64 in QEMU, implement DCC in QEMU and Newlib/libgloss or >> implement PL011 UART or VirtIO-MMIO console in Newlib/libgloss. >> >> Some of the bootloaders and firmwares out there (bootwrapper, ARM trusted >> firmware, UEFI/Tianocore) may have examples of using the PL011 UART. >> >> Christopher >> >> -- >> Employee of Qualcomm Innovation Center, Inc. >> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, >> hosted by the Linux Foundation. >> ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-05 16:57 ` Claudio Fontana @ 2014-09-05 17:52 ` Semion Prihodko 2014-09-05 18:27 ` Christopher Covington 0 siblings, 1 reply; 11+ messages in thread From: Semion Prihodko @ 2014-09-05 17:52 UTC (permalink / raw) To: Claudio Fontana; +Cc: QEMU Developers, Christopher Covington [-- Attachment #1: Type: text/plain, Size: 2194 bytes --] This is tricky to deepen in this large code base. It looks strange that there's no simple concrete tutorial like we have for all other CPU architectures (e.g. in osdev.org). 05 Сен 2014 г. 19:57 пользователь "Claudio Fontana" < claudio.fontana@huawei.com> написал: > On 05.09.2014 16:50, Semion Prihodko wrote: > > Let's discard semihosting. I have aarch64-linux-gnu-* toolchain and > > qemu-system-aarch64 emulator. How can I build a minimal kernel which > > outputs Hello World! via serial port and run it on the emulator? > > > > If you run qemu with the "virt" platform, you can write to the UART at > 0x9000000 > to get a character out, works very early. > > You could check the AArch64 port of the OSv Operating System, has a simple > boot loader > you can look at (arch/aarch64/preboot.S and arch/aarch64/boot.S) > and the pl011 device you find in drivers/pl011.cc > > https://github.com/cloudius-systems/osv/wiki/AArch64 > > Good luck, > > Claudio > > > > > 2014-09-04 21:15 GMT+03:00 Christopher Covington <cov@codeaurora.org>: > > > >> Hi Semion, > >> > >> On 09/04/2014 09:40 AM, Semion Prihodko wrote: > >>> Still don't know how to build/run a simple Hello World kernel on > >>> qemu-system-aarch64? > >>> > >>> Guys, this is a very basic thing, please provide concrete steps. > Thanks. > >> > >> Here you go. Start at the wget. > >> > >> http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg03487.html > >> > >> Angel semihosting isn't implemented upstream so a text hello world > won't be > >> trivial, although given enough time it should be possible to implement > >> Angel > >> semihosting for A64 in QEMU, implement DCC in QEMU and Newlib/libgloss > or > >> implement PL011 UART or VirtIO-MMIO console in Newlib/libgloss. > >> > >> Some of the bootloaders and firmwares out there (bootwrapper, ARM > trusted > >> firmware, UEFI/Tianocore) may have examples of using the PL011 UART. > >> > >> Christopher > >> > >> -- > >> Employee of Qualcomm Innovation Center, Inc. > >> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, > >> hosted by the Linux Foundation. > >> > > [-- Attachment #2: Type: text/html, Size: 3070 bytes --] ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] HelloWord kernel for qemu-system-aarch64 2014-09-05 17:52 ` Semion Prihodko @ 2014-09-05 18:27 ` Christopher Covington 0 siblings, 0 replies; 11+ messages in thread From: Christopher Covington @ 2014-09-05 18:27 UTC (permalink / raw) To: Semion Prihodko; +Cc: Claudio Fontana, QEMU Developers On 09/05/2014 01:52 PM, Semion Prihodko wrote: > This is tricky to deepen in this large code base. It looks strange that > there's no simple concrete tutorial like we have for all other CPU > architectures (e.g. in osdev.org <http://osdev.org>). AArch64 hasn't really changed the PL011 UART (nor GIC, nor VirtIO-MMIO, nor semihosting, although maybe DCC a little) as far as I recall. The UART functions from the following article are probably reusable. http://wiki.osdev.org/ARM_Integrator-CP_IRQTimerAndPIC Among other things, AArch64 is pretty new compared to the other architectures on osdev.org. If you get something going, maybe you can write the tutorial. Christopher > 05 Сен 2014 г. 19:57 пользователь "Claudio Fontana" > <claudio.fontana@huawei.com <mailto:claudio.fontana@huawei.com>> написал: > > On 05.09.2014 16 <tel:05.09.2014%2016>:50, Semion Prihodko wrote: > > Let's discard semihosting. I have aarch64-linux-gnu-* toolchain and > > qemu-system-aarch64 emulator. How can I build a minimal kernel which > > outputs Hello World! via serial port and run it on the emulator? > > > > If you run qemu with the "virt" platform, you can write to the UART at > 0x9000000 > to get a character out, works very early. > > You could check the AArch64 port of the OSv Operating System, has a simple > boot loader > you can look at (arch/aarch64/preboot.S and arch/aarch64/boot.S) > and the pl011 device you find in drivers/pl011.cc > > https://github.com/cloudius-systems/osv/wiki/AArch64 > > Good luck, > > Claudio > > > > > 2014-09-04 21:15 GMT+03:00 Christopher Covington <cov@codeaurora.org > <mailto:cov@codeaurora.org>>: > > > >> Hi Semion, > >> > >> On 09/04/2014 09:40 AM, Semion Prihodko wrote: > >>> Still don't know how to build/run a simple Hello World kernel on > >>> qemu-system-aarch64? > >>> > >>> Guys, this is a very basic thing, please provide concrete steps. Thanks. > >> > >> Here you go. Start at the wget. > >> > >> http://lists.gnu.org/archive/html/qemu-devel/2014-07/msg03487.html > >> > >> Angel semihosting isn't implemented upstream so a text hello world won't be > >> trivial, although given enough time it should be possible to implement > >> Angel > >> semihosting for A64 in QEMU, implement DCC in QEMU and Newlib/libgloss or > >> implement PL011 UART or VirtIO-MMIO console in Newlib/libgloss. > >> > >> Some of the bootloaders and firmwares out there (bootwrapper, ARM trusted > >> firmware, UEFI/Tianocore) may have examples of using the PL011 UART. > >> > >> Christopher > >> > >> -- > >> Employee of Qualcomm Innovation Center, Inc. > >> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, > >> hosted by the Linux Foundation. > >> > -- Employee of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation. ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2014-09-05 18:27 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-09-04 10:40 [Qemu-devel] HelloWord kernel for qemu-system-aarch64 Semion Prihodko 2014-09-04 13:29 ` Peter Maydell 2014-09-04 13:40 ` Semion Prihodko 2014-09-04 13:44 ` Peter Maydell 2014-09-04 13:49 ` Semion Prihodko 2014-09-04 13:50 ` Peter Maydell 2014-09-04 18:15 ` Christopher Covington 2014-09-05 14:50 ` Semion Prihodko 2014-09-05 16:57 ` Claudio Fontana 2014-09-05 17:52 ` Semion Prihodko 2014-09-05 18:27 ` Christopher Covington
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).