RE: How should I build u-boot for qemu_arm64_defconfig and run it on arm64 qemu virt machine?
Hello all, I found by compiling u-boot-spl to start at 0x4020 and using -kernel option, I can make u-boot-spl start loaded and started from 0x4020. And then by loading the .itb file (FIT file) which contains u-boot proper binary at 0x4040 using -device loader option, and setting CONFIG_SPL_LOAD_FIT_ADDERSS to 0x4040 and I could make u-boot-spl execute u-boot at the end. To make .itb file, I used 'firmware = "uboot"' int the configuration, and 'type = "standalone"', 'os = "U-Boot"' and the 'uboot' image node. And I turned off SPL_BOOT_OS of course. I referenced the sample its files in u-boot. (I can't copy-paste the file now so I just tell you the key lines) Hope this helps someone layter. Thank you. Chan Kim >-Original Message- >From: U-Boot On Behalf Of 김찬 >Sent: Tuesday, May 9, 2023 3:13 PM >To: U-Boot Mailing List ; qemu-discuss@nongnu.org >Subject: RE: How should I build u-boot for qemu_arm64_defconfig and run it >on arm64 qemu virt machine? > > >Hi all, > >Hope someone who know this top reads this. >I made the pflashs.img with u-boot-spl and used it as the flash memory (from >address 0x ~). So the u-boot-spl program runs. >And I guess I have to load (using qemu command option) a kind of image that >contains u-boot proper and make the u-boot-spl to load u-boot proper at >another address from that image and jump to that address. >How can I make that image using mkimage if I have the u-boot.bin file? >I think the command should start like 'mkimage -O u-boot -T ... ' but I >don't know what type I should give for -T option. >I will be very much grateful If anyone tells me how to do it. >By the way, I want to check pci_init function once u-boot proper runs and I >found pci_init is called in board_init_r when u-boot proper runs. > >Thank you! >Chan Kim > >-Original Message- >From: "Chan Kim" >To: "U-Boot Mailing List" ; disc...@nongnu.org>; >Cc: >Sent: 2023-05-08 (월) 18:40:49 (UTC+09:00) >Subject: How should I build u-boot for qemu_arm64_defconfig and run it on >arm64 qemu virt machine? > >Hello experts, > > > >Today I tried this test from scratch. > >In my environment, CROSS_COMPILE=aarch64-none-elf. > >Under u-boot directory, when I do 'make CROSS_COMPILE=aarch64-none-elf- >qemu_arm64_defconfig' and 'make -j28', I see this error at the end. > > > >aarch64-none-elf-ld.bfd: invalid length for memory region .sram > > > >after examining it, I added in include/configs/qemu-arm.h, > > > >#define CONFIG_SPL_MAX_SIZE value to 0x40 > > > >After fixing it, I got another similar error for .sdram and I added in >include/configs/qemu-arm.h, > > > >#define CONFIG_SPL_BSS_START_ADDR 0x4080 > >#define CONFIG_SPL_BSS_MAX_SIZE 0x10 > > > >Now I can do 'make -j28' with no error. > >But I found I have both 'u-boot' and 'spl/u-boot-spl' generated and I >realized for this qemu_arm64_defconfig, CONFIG_SPL=y and I get both u-boot >proper and u-boot spl. (SPL: secondary program loader, proper: main >bootloader. SPL runs first and the proper runs next). > > > >Until now I did objcopy of the u-boot(proper) and then extended it to >0x40 byte. (the pflash size of the virt machine which starts at address >0x). > >$ aarch64-none-elf-objcopy -O binary u-boot.v2022.07/u-boot pflashp.img > >$ dd if=/dev/zero of=pflashp.img bs=1c count=1 seek=67108863 > > > >And the qemu command is : > >$ qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 -machine virt,gic- >version=max,secure=on,virtualization=true -cpu max -drive >if=pflash,file=pflashp.img -m 2G -nographic -device >loader,file=linux-5.15.68/arch/arm64/boot/Image,addr=0x8020 > > > >The qemu virt machine has RAM from 0x4000 until 0xbfff. > >And I could see u-boot runs and it waits input for 3 seconds and outputs the >u-boot prompt. > >This is running u-boot (proper) from address 0 but since I have u-boot-spl >too, I should run it from u-boot-spl first, shouldn't I? > > > >How am I supposed to run u-boot-spl and u-boot on this qemu machine? (from >lds files, it looks like they both start at address 0). > >(qemu machine is arm64 virt machine, qemu 6.2.0). > > > > > >Thank you. > > > >Chan Kim > > >
RE: How should I build u-boot for qemu_arm64_defconfig and run it on arm64 qemu virt machine?
Hi all, Hope someone who know this top reads this. I made the pflashs.img with u-boot-spl and used it as the flash memory (from address 0x ~). So the u-boot-spl program runs. And I guess I have to load (using qemu command option) a kind of image that contains u-boot proper and make the u-boot-spl to load u-boot proper at another address from that image and jump to that address. How can I make that image using mkimage if I have the u-boot.bin file? I think the command should start like 'mkimage -O u-boot -T ... ' but I don't know what type I should give for -T option. I will be very much grateful If anyone tells me how to do it. By the way, I want to check pci_init function once u-boot proper runs and I found pci_init is called in board_init_r when u-boot proper runs. Thank you! Chan Kim -Original Message- From: "Chan Kim" To: "U-Boot Mailing List" ; ; Cc: Sent: 2023-05-08 (월) 18:40:49 (UTC+09:00) Subject: How should I build u-boot for qemu_arm64_defconfig and run it on arm64 qemu virt machine? Hello experts, Today I tried this test from scratch. In my environment, CROSS_COMPILE=aarch64-none-elf. Under u-boot directory, when I do 'make CROSS_COMPILE=aarch64-none-elf- qemu_arm64_defconfig' and 'make -j28', I see this error at the end. aarch64-none-elf-ld.bfd: invalid length for memory region .sram after examining it, I added in include/configs/qemu-arm.h, #define CONFIG_SPL_MAX_SIZE value to 0x40 After fixing it, I got another similar error for .sdram and I added in include/configs/qemu-arm.h, #define CONFIG_SPL_BSS_START_ADDR 0x4080 #define CONFIG_SPL_BSS_MAX_SIZE 0x10 Now I can do 'make -j28' with no error. But I found I have both 'u-boot' and 'spl/u-boot-spl' generated and I realized for this qemu_arm64_defconfig, CONFIG_SPL=y and I get both u-boot proper and u-boot spl. (SPL: secondary program loader, proper: main bootloader. SPL runs first and the proper runs next). Until now I did objcopy of the u-boot(proper) and then extended it to 0x40 byte. (the pflash size of the virt machine which starts at address 0x). $ aarch64-none-elf-objcopy -O binary u-boot.v2022.07/u-boot pflashp.img $ dd if=/dev/zero of=pflashp.img bs=1c count=1 seek=67108863 And the qemu command is : $ qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 -machine virt,gic-version=max,secure=on,virtualization=true -cpu max -drive if=pflash,file=pflashp.img -m 2G -nographic -device loader,file=linux-5.15.68/arch/arm64/boot/Image,addr=0x8020 The qemu virt machine has RAM from 0x4000 until 0xbfff. And I could see u-boot runs and it waits input for 3 seconds and outputs the u-boot prompt. This is running u-boot (proper) from address 0 but since I have u-boot-spl too, I should run it from u-boot-spl first, shouldn't I? How am I supposed to run u-boot-spl and u-boot on this qemu machine? (from lds files, it looks like they both start at address 0). (qemu machine is arm64 virt machine, qemu 6.2.0). Thank you. Chan Kim
Re: How should I build u-boot for qemu_arm64_defconfig and run it on arm64 qemu virt machine?
Hi Chan, On Mon, 8 May 2023 at 03:41, Chan Kim wrote: > > Hello experts, > > > > Today I tried this test from scratch. > > In my environment, CROSS_COMPILE=aarch64-none-elf. > > Under u-boot directory, when I do 'make CROSS_COMPILE=aarch64-none-elf- > qemu_arm64_defconfig' and 'make -j28', I see this error at the end. > > > > aarch64-none-elf-ld.bfd: invalid length for memory region .sram > > > > after examining it, I added in include/configs/qemu-arm.h, > > > > #define CONFIG_SPL_MAX_SIZE value to 0x40 > > > > After fixing it, I got another similar error for .sdram and I added in > include/configs/qemu-arm.h, > > > > #define CONFIG_SPL_BSS_START_ADDR 0x4080 > > #define CONFIG_SPL_BSS_MAX_SIZE 0x10 > > > > Now I can do 'make -j28' with no error. > > But I found I have both 'u-boot' and 'spl/u-boot-spl' generated and I > realized for this qemu_arm64_defconfig, CONFIG_SPL=y and I get both u-boot > proper and u-boot spl. (SPL: secondary program loader, proper: main > bootloader. SPL runs first and the proper runs next). > > > > Until now I did objcopy of the u-boot(proper) and then extended it to > 0x40 byte. (the pflash size of the virt machine which starts at address > 0x). > > $ aarch64-none-elf-objcopy -O binary u-boot.v2022.07/u-boot pflashp.img > > $ dd if=/dev/zero of=pflashp.img bs=1c count=1 seek=67108863 > > > > And the qemu command is : > > $ qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 -machine > virt,gic-version=max,secure=on,virtualization=true -cpu max -drive > if=pflash,file=pflashp.img -m 2G -nographic -device > loader,file=linux-5.15.68/arch/arm64/boot/Image,addr=0x8020 > > > > The qemu virt machine has RAM from 0x4000 until 0xbfff. > > And I could see u-boot runs and it waits input for 3 seconds and outputs the > u-boot prompt. > > This is running u-boot (proper) from address 0 but since I have u-boot-spl > too, I should run it from u-boot-spl first, shouldn't I? > > > > How am I supposed to run u-boot-spl and u-boot on this qemu machine? (from > lds files, it looks like they both start at address 0). > > (qemu machine is arm64 virt machine, qemu 6.2.0). Have you tried the docs here? https://u-boot.readthedocs.io/en/latest/board/emulation/qemu-arm.html Why are you trying to run SPL? Regards, Simon
How should I build u-boot for qemu_arm64_defconfig and run it on arm64 qemu virt machine?
Hello experts, Today I tried this test from scratch. In my environment, CROSS_COMPILE=aarch64-none-elf. Under u-boot directory, when I do 'make CROSS_COMPILE=aarch64-none-elf- qemu_arm64_defconfig' and 'make -j28', I see this error at the end. aarch64-none-elf-ld.bfd: invalid length for memory region .sram after examining it, I added in include/configs/qemu-arm.h, #define CONFIG_SPL_MAX_SIZE value to 0x40 After fixing it, I got another similar error for .sdram and I added in include/configs/qemu-arm.h, #define CONFIG_SPL_BSS_START_ADDR 0x4080 #define CONFIG_SPL_BSS_MAX_SIZE 0x10 Now I can do 'make -j28' with no error. But I found I have both 'u-boot' and 'spl/u-boot-spl' generated and I realized for this qemu_arm64_defconfig, CONFIG_SPL=y and I get both u-boot proper and u-boot spl. (SPL: secondary program loader, proper: main bootloader. SPL runs first and the proper runs next). Until now I did objcopy of the u-boot(proper) and then extended it to 0x40 byte. (the pflash size of the virt machine which starts at address 0x). $ aarch64-none-elf-objcopy -O binary u-boot.v2022.07/u-boot pflashp.img $ dd if=/dev/zero of=pflashp.img bs=1c count=1 seek=67108863 And the qemu command is : $ qemu-6.2.0/build/aarch64-softmmu/qemu-system-aarch64 -machine virt,gic-version=max,secure=on,virtualization=true -cpu max -drive if=pflash,file=pflashp.img -m 2G -nographic -device loader,file=linux-5.15.68/arch/arm64/boot/Image,addr=0x8020 The qemu virt machine has RAM from 0x4000 until 0xbfff. And I could see u-boot runs and it waits input for 3 seconds and outputs the u-boot prompt. This is running u-boot (proper) from address 0 but since I have u-boot-spl too, I should run it from u-boot-spl first, shouldn't I? How am I supposed to run u-boot-spl and u-boot on this qemu machine? (from lds files, it looks like they both start at address 0). (qemu machine is arm64 virt machine, qemu 6.2.0). Thank you. Chan Kim