lupyuen / lupyuen.github.io

Lup Yuen's Articles and Resume
https://lupyuen.github.io
Apache License 2.0
74 stars 14 forks source link

Problem following https://lupyuen.github.io/articles/release#build-nuttx-for-star64 #19

Closed KenDickey closed 1 year ago

KenDickey commented 1 year ago

Greetings, I found your wonderful articles on NuttX on Star64 and thought to try things out on VisionFive 2.

The quick, dumb test of released build failed to initialize file system vf2-nuttx-test-run.txt

  /* Mount the file system containing the init program. */

  ret = nx_mount(CONFIG_INIT_MOUNT_SOURCE, CONFIG_INIT_MOUNT_TARGET,
                 CONFIG_INIT_MOUNT_FSTYPE, CONFIG_INIT_MOUNT_FLAGS,
                 CONFIG_INIT_MOUNT_DAT

I tried building from sources (on Raspberry Pi4/Raspian), but seem to be missing

nuttx-riscv-build.txt

Following the article, I have been trying to use the released sources, rather than those in your repo.

Raspian:RasPi4:~/RISCV/NuttX/nuttx >>> cat .git/config 
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    url = https://github.com/apache/nuttx.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
Raspian:RasPi4:~/RISCV/NuttX/nuttx >>> uname -a
Linux Raspian4 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr  3 17:24:16 BST 2023 aarch64 GNU/Linux
Raspian:RasPi4:~/RISCV/NuttX/nuttx >>> 

I am probably doing something incredibly dumb. Any help in making progess on getting NuttX up on VisionFive2 is appreciated.

Thanks much! -KenD

lupyuen commented 1 year ago

Hi: Thank you so much for testing NuttX on VisionFive 2 :-) You're right, there's a problem mounting the Init Filesystem:

  /* Mount the file system containing the init program. */
  ret = nx_mount(CONFIG_INIT_MOUNT_SOURCE, CONFIG_INIT_MOUNT_TARGET,
                 CONFIG_INIT_MOUNT_FSTYPE, CONFIG_INIT_MOUNT_FLAGS,
                 CONFIG_INIT_MOUNT_DATA);

Which is actually a ROMFS File System / Initial RAM Disk (initrd) that is supposed to contain the NuttX Shell (init):

→ grep INIT .config
...
CONFIG_INIT_FILEPATH="/system/bin/init"
CONFIG_INIT_MOUNT=y
CONFIG_INIT_MOUNT_SOURCE="/dev/ram0"
CONFIG_INIT_MOUNT_TARGET="/system/bin"
CONFIG_INIT_MOUNT_FSTYPE="romfs"
CONFIG_INIT_MOUNT_FLAGS=0x1
CONFIG_INIT_MOUNT_DATA=""

Could you help me with these:

(1) Enable the Filesystem Debug Log, so we can see the reason for the mounting failure:

make menuconfig
## Select "Build Setup > Debug Options"
## Enable "File System Debug Features, Error, Warnings and Info"
## Save and exit menuconfig
make

(2) What's the UBoot Config that we used for booting NuttX? It's possible that nuttx.initrd was not loaded correctly at 0x46100000

(3) What happens when we boot the pre-built version of NuttX? Here are the steps:

  1. Download the microSD Image: sdcard.img
  2. Write the downloaded image to a microSD Card with Balena Etcher or GNOME Disks
  3. Download the FIT file: starfiveu.fit
  4. Overwrite the file on the microSD Card
  5. Boot the microSD

We probably don't need to worry about for now? I think I had the same problem before, which I fixed by installing newlib. Or it might be something else in the NuttX Prerequisites.

Please lemme know the outcome. Thanks! :-)

KenDickey commented 1 year ago

OK. Getting closer.

I have to explain a bit. I am using VisionFive2 Debian on a micro SD card.

I downloaded your released/prebuilt nuttx.bin and initrd and used extlinux/extlinux.conf to load.

extlinux.conf.txt

These files are in mmcblk1p3 (mounted here as /boot)

root@starfive:/boot/extlinux# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.7G     0  1.7G   0% /dev
tmpfs           390M  3.0M  387M   1% /run
/dev/mmcblk1p4   30G   19G   11G  63% /
tmpfs           2.0G     0  2.0G   0% /dev/shm
tmpfs           5.0M   12K  5.0M   1% /run/lock
/dev/mmcblk1p3  100M   34M   67M  34% /boot
tmpfs           390M   32K  390M   1% /run/user/107
tmpfs           390M   24K  390M   1% /run/user/0

So I don't know what SD partition of the four I should write the .fit image to. What is the process?

(For entire <>.img I use dd if=<in> of=/dev/sda bs=4M status=progress conv=sync . I have not found another usable flasher for aarch64 linux.
The VF2 /boot files, I just scp using Debian).

I.e. I don't understand the concrete semantics of

  • Overwrite the file on the microSD Card

Also, the build of NuttX from the official Apache github is the one which dies for lack of , so I don't have a working build of NuttX to tweak.

My assumption here is that is specific to riscv64 and the makefile/build process is looking in the wrong place?

Should I git clone from your working pine64 location and try that, rather than the Apache NuttX distro?

Thanks again for all. I am learning a lot! -KenD

On 2023-09-10 20:24, Lup Yuen Lee wrote:

Hi: Thank you so much for testing NuttX on VisionFive 2 :-) You're right, there's a problem mounting the Init Filesystem:

/ Mount the file system containing the init program. / ret = nx_mount(CONFIG_INIT_MOUNT_SOURCE, CONFIG_INIT_MOUNT_TARGET, CONFIG_INIT_MOUNT_FSTYPE, CONFIG_INIT_MOUNT_FLAGS, CONFIG_INIT_MOUNT_DATA);

Which is actually a ROMFS File System / Initial RAM Disk (initrd) that is supposed to contain the NuttX Shell (init):

→ grep INIT .config ... CONFIG_INIT_FILEPATH="/system/bin/init" CONFIG_INIT_MOUNT=y CONFIG_INIT_MOUNT_SOURCE="/dev/ram0" CONFIG_INIT_MOUNT_TARGET="/system/bin" CONFIG_INIT_MOUNT_FSTYPE="romfs" CONFIG_INIT_MOUNT_FLAGS=0x1 CONFIG_INIT_MOUNT_DATA=""

Could you help me with these:

(1) Enable the Filesystem Debug Log, so we can see the reason for the mounting failure:

make menuconfig

Select "Build Setup > Debug Options"

Enable "File System Debug Features, Error, Warnings and Info"

Save and exit menuconfig

make

(2) What's the UBoot Config that we used for booting NuttX? It's possible that nuttx.initrd was not loaded correctly at 0x46100000

(3) What happens when we boot the pre-built version of NuttX? Here are the steps:

  • Download the microSD Image: sdcard.img
  • Write the downloaded image to a microSD Card with Balena Etcher or GNOME Disks
  • Download the FIT file: starfiveu.fit
  • Overwrite the file on the microSD Card
  • Boot the microSD

We probably don't need to worry about for now? I think I had the same problem before, which I fixed by installing newlib. Or it might be something else in the NuttX Prerequisites.

Please lemme know the outcome. Thanks! :-)

-- Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***> --=_3b934643443b146931805f28b2400b14 Content-Transfer-Encoding: base64 Content-Type: text/plain; name=extlinux.conf Content-Disposition: attachment; filename=extlinux.conf; size=1008

IyMgL2V4dGxpbnV4L2V4dGxpbnV4LmNvbmYKIyMKIyMgSU1QT1JUQU5UIFdBUk5JTkcKIyMKIyMg VGhlIGNvbmZpZ3VyYXRpb24gb2YgdGhpcyBmaWxlIGlzIGdlbmVyYXRlZCBhdXRvbWF0aWNhbGx5 LgojIyBEbyBub3QgZWRpdCB0aGlzIGZpbGUgbWFudWFsbHksIHVzZTogdS1ib290LXVwZGF0ZQoK ZGVmYXVsdCBsMAptZW51IHRpdGxlIFUtQm9vdCBtZW51CnByb21wdCAwCnRpbWVvdXQgNTAKCgps YWJlbCBsMAoJbWVudSBsYWJlbCBEZWJpYW4gR05VL0xpbnV4IGJvb2t3b3JtL3NpZCA1LjE1LjAt c3RhcmZpdmUKCWxpbnV4IC92bWxpbnV6LTUuMTUuMC1zdGFyZml2ZQoJaW5pdHJkIC9pbml0cmQu aW1nLTUuMTUuMC1zdGFyZml2ZQoJCgkKCWZkdGRpciAvZHRicwoJYXBwZW5kICByb290PS9kZXYv bW1jYmxrMXA0IHJ3IGNvbnNvbGU9dHR5MCBjb25zb2xlPXR0eVMwLDExNTIwMCBlYXJseWNvbiBy b290d2FpdCBzdG1tYWNldGg9Y2hhaW5fbW9kZToxIHNlbGludXg9MAoKbGFiZWwgbDByCgltZW51 IGxhYmVsIERlYmlhbiBHTlUvTGludXggYm9va3dvcm0vc2lkIDUuMTUuMC1zdGFyZml2ZSAocmVz Y3VlIHRhcmdldCkKCWxpbnV4IC92bWxpbnV6LTUuMTUuMC1zdGFyZml2ZQoJaW5pdHJkIC9pbml0 cmQuaW1nLTUuMTUuMC1zdGFyZml2ZQoJCglmZHRkaXIgL2R0YnMKCWFwcGVuZCAgcm9vdD0vZGV2 L21tY2JsazFwNCBydyBjb25zb2xlPXR0eTAgY29uc29sZT10dHlTMCwxMTUyMDAgZWFybHljb24g cm9vdHdhaXQgc3RtbWFjZXRoPWNoYWluX21vZGU6MSBzZWxpbnV4PTAgc2luZ2xlCgkKbGFiZWwg MTEKCW1lbnUgbGFiZWwgTnV0dFggcmlzY3Y2NAoJbGludXggL251dHR4LmJpbgoJaW5pdHJkIC9u dXR0eC5pbml0cmQKCQoJZmR0ZGlyIC9kdGJzCiMJYXBwZW5kICByb290PS9kZXYvbW1jYmxrMXA0 IHJ3IGNvbnNvbGU9dHR5MCBjb25zb2xlPXR0eVMwLDExNTIwMCBlYXJseWNvbiByb290d2FpdCBz dG1tYWNldGg9Y2hhaW5fbW9kZToxIHNlbGludXg9MCBzaW5nbGUK --=_3b934643443b146931805f28b2400b14--

lupyuen commented 1 year ago

Thanks for bearing with me :-) This script seems OK for creating a bootable NuttX microSD on Pi 4, lemme know if it works:

I haven't figured out how to create an extlinux.conf that works with NuttX, normally I run U-Boot Commands directly like this. I might need some time to experiment with this.

Building NuttX Mainline from github.com/apache/nuttx should work fine. Lemme try building NuttX on Pi 4 and see if it works. Thanks! :-)

KenDickey commented 1 year ago

On 2023-09-11 23:15, Lup Yuen Lee wrote:

Thanks for bearing with me :-) This script seems OK for creating a bootable NuttX microSD on Pi 4, lemme know if it works:

  • Create a Bootable NuttX microSD for JH7110

YES! We have liftoff! (attached).

vf2-nutx.txt

-KenD

KenDickey commented 1 year ago

vf2-nutx.txt

lupyuen commented 1 year ago

Wow thank you so much! You made my day :-)

KenDickey commented 1 year ago

Hey! You made my day!