how to encrypt fip for GXB P201 and possible bug in docs
Hi,
this is my first approach to both u-boot and this group, I have an S905w based board .
Here is my problem :
in the vanilla u-boot ( version 2019.07 ), there is a txt file ( u-boot-amlogic/board/amlogic/p201/README.p201 ) containing instructions on how to build the bootloader that you need in order to boot from an SD card starting from the p201_defconfig .
The problem is that I think that the original author mixed the two GXB and GXL targets and wrote something about GXL inside a document intended for GXB targets .
According to the description the gxb_p201_v1_defconfig is the target that I'm looking for ( considering the S905W hardware properties ) and it's a GXB target that uses "aml_encrypt_gxb" and not "aml_encrypt_gxl", infact after building the suggested amlogic-openlinux-20170606 Baylibre branch I have a "fip/gxb" populated with all the expected files where the "fip/gxl" content is not enough to build anything.
from this point on I'm unable to build anything since the last instructions in the README.p201 are mentioning files that are simply not generated and an utility like aml_encrypt_gxl which I don't think I should use for my P201 GXB target .
Am I wrong ? what are the final steps to create the right u-boot.bin.sd.bin by "adding together" the vanilla and Baylibre builds ?
Hi,
Quoted 2 lines · On 23/07/2019 19:57, [email protected] wrote:
Hi,
this is my first approach to both u-boot and this group, I have an S905w based board .
S905w is a derivative from S905X, not S905 (without X), S905 is GXBB and S905W, like S905X, S905L, S805X, S805Y, is from the GXL family.
Quoted 2 lines
Here is my problem :
in the vanilla u-boot ( version 2019.07 ), there is a txt file ( u-boot-amlogic/board/amlogic/p201/README.p201 ) containing instructions on how to build the bootloader that you need in order to boot from an SD card starting from thep201_defconfig.
So you should start from the P212 instead, which is the reference board for S905X, we don't support reference designs for S905W since this soc is not sold for SBCs, but only on final products.
Quoted 4 lines
The problem is that I think that the original author mixed the two GXB and GXL targets and wrote something about GXL inside a document intended for GXB targets .
According to the description the
gxb_p201_v1_defconfigis the target that I'm looking for ( considering the S905W hardware properties ) and it's a GXB target that uses "aml_encrypt_gxb" and not "aml_encrypt_gxl", infact after building the suggested amlogic-openlinux-20170606 Baylibre branch I have a "fip/gxb" populated with all the expected files where the "fip/gxl" content is not enough to build anything.
The P201 is really the S905 reference design for GXBB.
Quoted 4 lines
from this point on I'm unable to build anything since the last instructions in the README.p201 are mentioning files that are simply not generated and an utility like
aml_encrypt_gxlwhich I don't think I should use for my P201 GXB target .Am I wrong ? what are the final steps to create the right u-boot.bin.sd.bin by "adding together" the vanilla and Baylibre builds ?
Please retry from the P212 target, and tell me your results.
Typos may still occur, and I'll be happy to apply fixes !
Neil
Quoted 3 lines
Thanks for your answer .
I'm trying to expand my know-how about u-boot and I think that the closest description is this one ( I have an A95X F1 ) :
https://github.com/CoreELEC/device-trees-amlogic/blob/master/gxl_p281_2g_a95xr2.dts
At this point I need a guide about how to support this new board starting from already existing config files and sources .
Do you have any pointers ? I know how to build u-boot, but I don't know how and what I have to modify in order to achieve what I want .
PS
It's not clear to me if I can mix and match device tree definitions from the linux kernel and using them for u-boot
Hi,
Quoted 6 lines · Le 24/07/2019 à 23:36, [email protected] a écrit :
Thanks for your answer .
I'm trying to expand my know-how about u-boot and I think that the closest description is this one ( I have an A95X F1 ) :
https://github.com/CoreELEC/device-trees-amlogic/blob/master/gxl_p281_2g_a95xr2.dtsAt this point I need a guide about how to support this new board starting from already existing config files and sources .
We always avoided replacing the bootloader of a closed device, because we don't have the source of the FIP components (DDR setup, Power Pins & PWM, DVFS table), and usually these boxes has custom setups that could diverge from the reference designs.
If you feel confident enough, you'll need to dump the eMMC content to save the original bootloader (in the first 4MiB) and use the p281 amlogic u-boot config to generate the FIP binaries as explained in the mainline README file of P212.
If not, simply chainload the mainline u-boot.bin binary (not packaged with FIP stuff) from the original u-boot on the device, it should work well.
Then simply use the P212 mainline u-boot defconfig as a start.
Quoted 4 lines
Do you have any pointers ? I know how to build u-boot, but I don't know how and what I have to modify in order to achieve what I want .
PS
It's not clear to me if I can mix and match device tree definitions from the linux kernel and using them for u-boot
The mainline u-boot syncs the mainline Linux device tree, which was entirely rewritten to match the standard rules and requirements of upstream development, so you can't use the amlogic linux device tree files.
The following https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-p281.dts
should work on your device.
Neil
Quoted 2 lines
I'm interested in re-using already existing binaries but for now I'm more interested in closing down on how to build u-boot from sources and get it to work . I'll reserve this for another topic .
I have successfully compiled the "plain" p212 target ( meaning without any p281 specific step ) and I don't get the very last step inside the readme :
Quoted 1 line
dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
and this basically means : copy uboot but skip the first 512 bytes so you can leave the partition table alone
Quoted 1 line
dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
what are we doing here ? and most importantly : why just 444 bytes ? my fip/u-boot.bin.sd.bin is 803328 bytes .
Also, do you have any suggestions about how to create a complete sd image with kernel and rootfs ? I don't want a complete rootfs but really the bare minimum .
Hi,
Quoted 6 lines · Le 26/07/2019 à 20:03, [email protected] a écrit :
I'm interested in re-using already existing binaries but for now I'm more interested in closing down on how to build u-boot from sources and get it to work . I'll reserve this for another topic .
I have successfully compiled the "plain" p212 target ( meaning without any p281 specific step ) and I don't get the very last step inside the readme :
Quoted 1 line
dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=512 skip=1 seek=1
and this basically means : copy uboot but skip the first 512 bytes so you can leave the partition table alone
Exact,
Quoted 3 lines
Quoted 2 lines
dd if=fip/u-boot.bin.sd.bin of=$DEV conv=fsync,notrunc bs=1 count=444
what are we doing here ? and most importantly : why just 444 bytes ? my fip/u-boot.bin.sd.bin is 803328 bytes .
The first 444bytes are necessary for booting over sdcard, so we need to copy them at the start of the sdcard. It's a vendor specificity, at some point we stop trying to understand ;-)
Quoted 2 lines
Also, do you have any suggestions about how to create a complete sd image with kernel and rootfs ? I don't want a complete rootfs but really the bare minimum .
Buildroot, or meta-meson with Yocto or OpenEmbedded
With meta-meson, you can generate a full sdcard image, including u-boot :
https://github.com/superna9999/meta-meson
It contains a profile for amlogic-p281, but without u-boot, only with rootfs and a minimal fat partition containing a script to boot from vendor u-boot.
With buildroot, it should be able to generate you an ext4 image containing the kernel and the p281 dtb, since it's all upstream, but you'll need to partition and flash the rootfs manually.
Neil