starfive-tech / VisionFive2

445 stars 79 forks source link

fatal: Could not read from remote repository. fatal: clone of git@github.com:starfive-tech/buildroot.git #6

Closed omac777 closed 1 year ago

omac777 commented 1 year ago

PROBLEM

Ok so my first time to clone and build all this and the clone instructions failed.

git clone git@github.com:starfive-tech/VisionFive2.git
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:starfive-tech/buildroot.git' into submodule path '/home/davidm/visionfive2prep/VisionFive2/buildroot' failed
Failed to clone 'buildroot'. Retry scheduled

SOLUTION

Please change the instructions for the fetch sources to the steps that follow to save others some time:

  1. Create a preparation directory
mkdir visionfive2prep
cd visionfive2prep/
  1. Fetch the script to add the git lfs repo and install it git lfs
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh -o script.deb.sh
sudo bash ./script.deb.sh
sudo apt-get install git-lfs
  1. clone but use https instead
    git clone https://github.com/starfive-tech/VisionFive2.git

    Here's the successful clone output:

    Cloning into 'VisionFive2'...
    remote: Enumerating objects: 3901, done.        
    remote: Counting objects: 100% (25/25), done.        
    remote: Compressing objects: 100% (25/25), done.        
    remote: Total 3901 (delta 9), reused 3 (delta 0), pack-reused 3876        
    Receiving objects: 100% (3901/3901), 290.49 MiB | 33.77 MiB/s, done.
    Resolving deltas: 100% (2135/2135), done.
    Filtering content: 100% (9/9), 149.12 MiB | 31.34 MiB/s, done.

4 . Tweak the VisionFive2/.gitmodules file.
Replace git@github.com:starfive-tech → https://github.com/starfive-tech

cat .gitmodules 
[submodule "buildroot"]
    path = buildroot
    url = https://github.com/starfive-tech/buildroot.git
    branch = JH7110_VisionFive2_devel
[submodule "u-boot"]
    path = u-boot
    url = https://github.com/starfive-tech/u-boot.git
    branch = JH7110_VisionFive2_devel
[submodule "linux"]
    path = linux
    url = https://github.com/starfive-tech/linux.git
    branch = JH7110_VisionFive2_devel
[submodule "opensbi"]
    path = opensbi
    url = https://github.com/starfive-tech/opensbi.git
    branch = master
  1. Now check out and submodule update
cd VisionFive2
git checkout JH7110_VisionFive2_devel
git submodule update --init --recursive

Repository is read and cloned. Here's the successful submodule update output:

Submodule 'buildroot' (https://github.com/starfive-tech/buildroot.git) registered for path 'buildroot'
Submodule 'linux' (https://github.com/starfive-tech/linux.git) registered for path 'linux'
Submodule 'opensbi' (https://github.com/starfive-tech/opensbi.git) registered for path 'opensbi'
Submodule 'u-boot' (https://github.com/starfive-tech/u-boot.git) registered for path 'u-boot'
Cloning into '/home/davidm/visionfive2prep/VisionFive2/buildroot'...
Cloning into '/home/davidm/visionfive2prep/VisionFive2/linux'...
Cloning into '/home/davidm/visionfive2prep/VisionFive2/opensbi'...
Cloning into '/home/davidm/visionfive2prep/VisionFive2/u-boot'...
Submodule path 'buildroot': checked out '4646c7fb71bbb628552a1e4d750fe74360345415'
Submodule path 'linux': checked out '7b7b4eddd8d5ae55f6e0ee09b93e16e23ab4f97b'
Submodule path 'opensbi': checked out '6f1fe98c2f565a394f258178b0daa3843672395c'
Submodule path 'u-boot': checked out '5ac796dddad5065c586360d01563db4c25a6865b'
omac777 commented 1 year ago

while doing the make -j$(nproc), I experienced another one of those git@github.com:starfive-tech/linux.git repo urls.
I would hope not to be fetching more sources once I start building.

Initialized empty Git repository in /home/davidm/visionfive2prep/VisionFive2/buildroot/dl/linux/git/.git/
GIT_DIR=/home/davidm/visionfive2prep/VisionFive2/buildroot/dl/linux/git/.git git remote add origin 'git@github.com:starfive-tech/linux.git' 
GIT_DIR=/home/davidm/visionfive2prep/VisionFive2/buildroot/dl/linux/git/.git git remote set-url origin 'git@github.com:starfive-tech/linux.git' 
Fetching all references
GIT_DIR=/home/davidm/visionfive2prep/VisionFive2/buildroot/dl/linux/git/.git git fetch origin 
The authenticity of host 'github.com (140.82.112.3)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.
This key is not known by any other names

It breaks the build by the way,.

git@github.com: Permission denied (publickey).
**fatal: Could not read from remote repository.**

Please make sure you have the correct access rights
and the repository exists.
Detected a corrupted git cache.
This is the second time in a row; bailing out
wget --passive-ftp -nd -t 3 -O '/home/davidm/visionfive2prep/VisionFive2/work/buildroot_initramfs/build/.linux-JH7110_VisionFive2_devel-br1.tar.gz.kXkcSh/output' 'http://sources.buildroot.net/linux/linux-JH7110_VisionFive2_devel-br1.tar.gz' 
--2022-12-15 17:50:29--  http://sources.buildroot.net/linux/linux-JH7110_VisionFive2_devel-br1.tar.gz
Resolving sources.buildroot.net (sources.buildroot.net)... 172.67.72.56, 104.26.0.37, 104.26.1.37, ...
Connecting to sources.buildroot.net (sources.buildroot.net)|172.67.72.56|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
**2022-12-15 17:50:29 ERROR 404: Not Found.**
andyhu-stf commented 1 year ago

Hi omac777, now the sdk recommend to download the code through git ssh, you can try to add ssh public key to your github account.

or you can still replace the "git ssh" with "git https" like your method, you can modify the .gitmodules to change the dowload url. Besides this one, the conf/buildroot_initramfs_config and conf/buildroot_rootfs_config also need to modify the BR2_KERNEL_HEADERS_CUSTOM_REPO_URL="git@github.com:starfive-tech/linux.git" to BR2_KERNEL_HEADERS_CUSTOM_REPO_URL="https://github.com/starfive-tech/linux.git"

yoyojacky commented 1 year ago

I have modified : /home/user/VisionFive2/buildroot/dl/linux/git/.git/config file and changed git@github.com:starfive-tech/linux.git to https://github.com/starfive-tech/linux.git and it stack at `jacky@Dev1:~/VisionFive2$ make -j$(nproc) make -C /home/jacky/VisionFive2/buildroot RISCV=/home/jacky/VisionFive2/work/buildroot_initramfs/host O=/home/jacky/VisionFive2/work/buildroot_initramfs make[1]: Entering directory '/home/jacky/VisionFive2/buildroot'

linux-headers JH7110_VisionFive2_devel Downloading GIT_DIR=/home/jacky/VisionFive2/buildroot/dl/linux/git/.git git init . Reinitialized existing Git repository in /home/jacky/VisionFive2/buildroot/dl/linux/git/.git/ GIT_DIR=/home/jacky/VisionFive2/buildroot/dl/linux/git/.git git remote set-url origin 'https://github.com/starfive-tech/linux.git' Fetching all references GIT_DIR=/home/jacky/VisionFive2/buildroot/dl/linux/git/.git git fetch origin` several times...

yoyojacky commented 1 year ago

problem solved by editing "/home/jacky/VisionFive2/buildroot/dl/linux/git/.git/config" Change "git@github.com:starfive-tech/linux.git " to "https://github.com/starfive-tech/linux.git" and re-execute : make -j $(nproc)

---OUTPUT GIT_DIR=/home/jacky/VisionFive2/buildroot/dl/linux/git/.git git init . Initialized empty Git repository in /home/jacky/VisionFive2/buildroot/dl/linux/git/.git/ GIT_DIR=/home/jacky/VisionFive2/buildroot/dl/linux/git/.git git remote add origin 'https://github.com/starfive-tech/linux.git' GIT_DIR=/home/jacky/VisionFive2/buildroot/dl/linux/git/.git git remote set-url origin 'https://github.com/starfive-tech/linux.git' Fetching all references GIT_DIR=/home/jacky/VisionFive2/buildroot/dl/linux/git/.git git fetch origin remote: Enumerating objects: 9211752, done. remote: Counting objects: 100% (132322/132322), done. remote: Compressing objects: 100% (53167/53167), done. remote: Total 9211752 (delta 97366), reused 97444 (delta 78850), pack-reused 9079430 Receiving objects: 100% (9211752/9211752), 2.08 GiB | 2.11 MiB/s, done. Resolving deltas: 100% (7808806/7808806), done.

omac777 commented 1 year ago

Thank you.  Much appreciated Mr. Hu.  Stay awesome :)

On Sunday, December 18, 2022 at 08:51:18 p.m. EST, Andy Hu ***@***.***> wrote:  

Hi omac777, now the sdk recommend to download the code through git ssh, you can try to add ssh public key to your github account.

or you can still replace the "git ssh" with "git https" like your methond, you can modify the .gitmodules to git https url. Besides this one, the conf/buildroot_initramfs_config and conf/buildroot_rootfs_config also need to modify the @.***:starfive-tech/linux.git" to BR2_KERNEL_HEADERS_CUSTOM_REPO_URL="https://github.com/starfive-tech/linux.git"

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

omac777 commented 1 year ago

The build output did complete. It took 2.5 hours on a phenomx8 popos 22.04.

gists github wouldn't let me upload this build output file so here it is from easyupload: https://easyupload.io/0at0v4

I didn't see the all the expected generated output files in the work directory as mentioned in the readme. https://github.com/starfive-tech/VisionFive2#readme

work/ ├── visionfive2_fw_payload.img NO ├── image.fit NO ├── initramfs.cpio.gz YES ├── u-boot-spl.bin.normal.out NO ├── linux/arch/riscv/boot YES ├── dts YES │ └── starfive YES │ ├── jh7110-visionfive-v2-ac108.dtb YES │ ├── jh7110-visionfive-v2.dtb YES │ ├── jh7110-visionfive-v2-wm8960.dtb YES │ ├── vf2-overlay YES │ │ └── vf2-overlay-uart3-i2c.dtbo YES └── Image.gz YES

andyhu-stf commented 1 year ago

@omac777 , It seem that your build output is not good. Through your build log, please see the below:

cmd: ./create_hdr --bin /home/davidm/visionfive2prep/VisionFive2/work/u-boot/spl/u-boot-spl.bin --version 0x01010101 --common_hdr u-boot-spl.bin.normal.common.hdr --hdr u-boot-spl.bin.normal.hdr input_files/input_sbl_normal.cfg
./create_hdr: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory

$ ldd soft_3rdpart/spl_tool/create_hdr
        linux-vdso.so.1 (0x00007ffda8fe8000)
        /lib/$LIB/liblsp.so => /lib/lib/x86_64-linux-gnu/liblsp.so (0x00007f2106aca000)
        libcrypto.so.1.1 => /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007f21065ff000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f210620e000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f210600a000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2105deb000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2107efc000)

the create_hdr need libcrypto.so which should be contained in openssl. You should install it firstly

omac777 commented 1 year ago
cd ~/visionfive2prep/VisionFive2/
ldd soft_3rdpart/spl_tool/create_hdr
    linux-vdso.so.1 (0x00007ffc82d96000)
    libcrypto.so.1.1 => not found
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f39c5600000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f39c6dea000)

openssl is already installed.

sudo apt-get install openssl
openssl is already the newest version (3.0.2-0ubuntu1.7).

libssl-dev was installed as per pre-requisite instructions. It was supposed to contain libcrypto.

On Ubuntu 22.04 Jammy, there was an error to do with libcrypto: https://askubuntu.com/questions/1403778/upgrading-to-ubuntu-22-04-causes-libcrypto-errors-apt-dpkg-broken

The core root of the issue is the build is using libssl1.1 instead of what it should be using which is libssl3 for jammy. libssl1.1 is no longer provided: https://packages.ubuntu.com/search?suite=default&section=all&arch=any&keywords=libssl&searchon=names

Installing libssl1.1 is a workaround not what I would recommend, but for the sake of just getting this build up for VF2 here are possible instructions to install libssl1.1. I'll try to build it with this again.

wget http://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.1_1.1.0l-1~deb9u6_amd64.deb
sha256sum libssl1.1_1.1.0l-1~deb9u6_amd64.deb 
sudo dpkg -i ./libssl1.1_1.1.0l-1~deb9u6_amd64.deb
cd ~/visionfive2prep/VisionFive2/
ldd soft_3rdpart/spl_tool/create_hdr
soft_3rdpart/spl_tool/create_hdr: /lib/x86_64-linux-gnu/libcrypto.so.1.1: version `OPENSSL_1_1_1' not found (required by soft_3rdpart/spl_tool/create_hdr)
    linux-vdso.so.1 (0x00007ffe97796000)
    libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007febbac00000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007febba800000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007febbc5a2000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007febbc59a000)
    /lib64/ld-linux-x86-64.so.2 (0x00007febbc5c2000)

Please add something about this in the pre-requisite packages in the instructions to make it smoother for other developers on-boarding.

It's mystery to me why this build doesn't use libssl3 yet since libssl1.1 is no longer part of jammy ubuntu 22.04 which was recommended to build the image with.

Thank you again.

omac777 commented 1 year ago

The build failed. I cannot proceed. Please tweak the build process to use libssl3 since I may not use libssl1.1 for obvious security reasons. Others will encounter this difficulty with any Ubuntu/Popos 22.04+.