Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Milkv duo support NAND image #487

Open
Markus250 opened this issue Aug 28, 2024 · 12 comments
Open

Milkv duo support NAND image #487

Markus250 opened this issue Aug 28, 2024 · 12 comments

Comments

@Markus250
Copy link

In buildroot I can compile image for SPI NAND next command:
./build.sh milkv-duo-spinand
and in the folder out/
I will receive the files for the firmware nand (boot.spinand, fip.bin, rootfs.spinand, system.spinand)
I load this into nand and it works
How can create an image for nand using this layer (yocto)?

sorry for my eng

vishwamartur added a commit to vishwamartur/meta-riscv that referenced this issue Nov 1, 2024
Related to riscv#487

Add support for creating NAND image for Milk-V Duo in Yocto layer.

* **conf/machine/milkv-duo.conf**
  - Add NAND-specific configurations.
  - Update `IMAGE_BOOT_FILES` to include `boot.spinand`, `fip.bin`, `rootfs.spinand`, and `system.spinand`.
  - Update `WKS_FILE` to use `milkv-duo-spinand.wks`.

* **wic/milkv-duo-spinand.wks**
  - Create a new `wic/milkv-duo-spinand.wks` file for NAND image creation.
  - Add partitions for `boot.spinand`, `fip.bin`, `rootfs.spinand`, and `system.spinand`.

* **recipes-bsp/u-boot/files/milkv-duo-support-files.patch**
  - Add NAND-specific configurations.
  - Update `milkv-duo_defconfig` to include NAND support.

* **recipes-bsp/milkv-duo-fsbl/milkv-duo-fsbl.bb**
  - Add NAND-specific configurations.
  - Update `do_compile` to include NAND-specific parameters.
kraj pushed a commit that referenced this issue Dec 3, 2024
Related to #487

Add support for creating NAND image for Milk-V Duo in Yocto layer.

* **conf/machine/milkv-duo.conf**
  - Add NAND-specific configurations.
  - Update `IMAGE_BOOT_FILES` to include `boot.spinand`, `fip.bin`, `rootfs.spinand`, and `system.spinand`.
  - Update `WKS_FILE` to use `milkv-duo-spinand.wks`.

* **wic/milkv-duo-spinand.wks**
  - Create a new `wic/milkv-duo-spinand.wks` file for NAND image creation.
  - Add partitions for `boot.spinand`, `fip.bin`, `rootfs.spinand`, and `system.spinand`.

* **recipes-bsp/u-boot/files/milkv-duo-support-files.patch**
  - Add NAND-specific configurations.
  - Update `milkv-duo_defconfig` to include NAND support.

* **recipes-bsp/milkv-duo-fsbl/milkv-duo-fsbl.bb**
  - Add NAND-specific configurations.
  - Update `do_compile` to include NAND-specific parameters.
@Markus250
Copy link
Author

Thanks

@ziswiler
Copy link

This broke the build for me:

make: Leaving directory '/var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/git/firmware'
usage: fiptool.py [-h] [-v] {genfip} ...
fiptool.py: error: unrecognized arguments: --NAND_BOOT=1
WARNING: /var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/temp/run.do_compile.1911581:150 exit 2 from 'python3 /var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/git/firmware/plat/cv180x/fiptool.py genfip /var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/git/firmware/build/fip.bin --MONITOR_RUNADDR=0x80000000 --CHIP_CONF=/var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/git/firmware/plat/cv180x/chip_conf.bin --NOR_INFO=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF --NAND_INFO=00000000 --BL2=/var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/git/firmware/build/cv180x/bl2.bin --BLCP_IMG_RUNADDR=0x05200200 --BLCP_PARAM_LOADADDR=0 --BLCP_2ND=/var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/git/firmware/build/blank.bin --BLCP_2ND_RUNADDR=0x83f40000 --DDR_PARAM=/var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/git/firmware/test/cv181x/ddr_param.bin --MONITOR=/var/home/sumo/Sources/riscv-yocto/build/tmp/deploy/images/milkv-duo/fw_dynamic.bin --LOADER_2ND=/var/home/sumo/Sources/riscv-yocto/build/tmp/deploy/images/milkv-duo/u-boot.bin --NAND_BOOT=1'
WARNING: Backtrace (BB generated script): 
        #1: do_compile, /var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/temp/run.do_compile.1911581, line 150
        #2: main, /var/home/sumo/Sources/riscv-yocto/build/tmp/work/riscv64-poky-linux/milkv-duo-fsbl/1.0/temp/run.do_compile.1911581, line 202

@Markus250
Copy link
Author

Yep, It doesn't work, I have exactly the same error
I am check fiptool.py args, he does not have --NAND_BOOT=1
@vishwamartur you make patch forfiptool.py?

@Markus250 Markus250 reopened this Feb 10, 2025
kraj added a commit to YoeDistro/meta-riscv that referenced this issue Feb 10, 2025
@kraj
Copy link
Collaborator

kraj commented Feb 10, 2025

@ziswiler @Markus250 I have removed the non existing option for now. I assume there is a patch for https://github.com/milkv-duo/duo-buildroot-sdk/blob/develop/fsbl/plat/cv181x/fiptool.py which is missing, or the option was added wrongly.

I have a patch here #510
can you test it out and see if it un-breaks you.

@Markus250
Copy link
Author

@kraj Yes, without this argument, the assembly of the image has advanced. Also, I had to comment the line
cp ${WORKDIR}/fip.bin ${DEPLOYDIR}/ in file milkv-duo-bootfiles.bb because in recipe milkv-duo-bootfiles.bb and milkv-duo-fsbl.bb simultaneous copying of the file fip.bin
But it still did not work, files rootfs.spinand, boot.spinand, etc.. do not appear, do not even gather =(
How much I could make out buildroot this files make python script mkubiimg.py, example from duo-buildroot-sdk/build/Makefile:
${Q}python3 $(COMMON_TOOLS_PATH)/spinand_tool/mkubiimg.py --ubionly $(FLASH_PARTITION_XML) ROOTFS $(OUTPUT_DIR)/rawimages/rootfs.sqsh $(OUTPUT_DIR)/rawimages/rootfs.spinand -b $(CONFIG_NANDFLASH_BLOCKSIZE) -p $(CONFIG_NANDFLASH_PAGESIZE)
Again, these are all my assumptions, I could never collect the image of NAND through Yocto
I will be grateful if you help me)

vishwamartur added a commit to vishwamartur/meta-riscv that referenced this issue Feb 11, 2025
Related to riscv#487

Add support for creating NAND image for Milk-V Duo in Yocto layer.

* **Remove non-existing argument**: Remove the `--NAND_BOOT=1` argument from `recipes-bsp/milkv-duo-fsbl/milkv-duo-fsbl.bb`.
* **Generate required files**: Update `recipes-bsp/milkv-duo-fsbl/milkv-duo-fsbl.bb` to generate `rootfs.spinand`, `boot.spinand`, and `system.spinand` files using `mkubiimg.py`.
* **Avoid file conflicts**: Remove the line `cp ${WORKDIR}/fip.bin ${DEPLOYDIR}/` from `recipes-bsp/milkv-duo-bootfiles/milkv-duo-bootfiles.bb` to avoid conflicts.
* **Update partition layout**: Add steps to generate `rootfs.spinand`, `boot.spinand`, and `system.spinand` files in `wic/milkv-duo-spinand.wks`.
* **Include necessary steps**: Update `kas/milkv-duo.yml` to include necessary steps for creating a NAND image.
@kraj
Copy link
Collaborator

kraj commented Feb 13, 2025

@Markus250 does the fix proposed in #511 fix the issue ?

@Markus250
Copy link
Author

@kraj Well, the assembly is going on, but the image for nand not created =(

@kraj
Copy link
Collaborator

kraj commented Feb 19, 2025

@kraj Well, the assembly is going on, but the image for nand not created =(

That seems not good. Does it work if we revert the original patch to add NAND support ?

@Markus250
Copy link
Author

@kraj That seems not good. Does it work if we revert the original patch to add NAND support ?

Unfortunately, no, if you look at how the buildroot does it, then there is more manipulations there, I tried to do it myself, but nothing worked for me

@kraj
Copy link
Collaborator

kraj commented Feb 27, 2025

@Markus250 ok, are you able to build if you revert b94502a ?

in meta-riscv you can do

git revert b94502a

and build

@Markus250
Copy link
Author

@kraj Yes, but need we must change the following:
conf/machine/milkv-duo.conf restore WKS_FILE ?= "milkv-duo.wks" instead of WKS_FILE ?= "milkv-duo-spinand.wks"
revert old milkv-duo-fsbl.bb from meta-riskv branch scarthgap
it seems like everything, then you can collect an image, but again, this image is not for spinand
in branch scarthgap image build successfully for sd-card, It is very sorry that no one can add the opportunity to collect under spi-nand =(

@kraj
Copy link
Collaborator

kraj commented Feb 27, 2025

if it is breaking then I would like to revert it. Can you post the patch that works for you ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants
@kraj @ziswiler @Markus250 and others