Code Monkey home page Code Monkey logo

qqxiaoming / quard_star_tutorial Goto Github PK

View Code? Open in Web Editor NEW
202.0 11.0 46.0 2.49 GB

This project aims to build an Embedded Linux System, in order to analyze the chip from the power-on execution of the first instruction to the entire system running, based on qemu simulator development board. 本项目旨在真正从0开始构建嵌入式linux系统,为了剖析芯片从上电开始执行第一条指令到整个系统运行,基于qemu定制模拟器开发板。

Home Page: https://quard-star-tutorial.rtfd.io

License: Other

tutorials riscv-emulator embedded-linux qemu qemu-riscv riscv riscv-linux riscv-simulator

quard_star_tutorial's Introduction

Hi there 👋

  • 👀 Language 👉 🇨🇳(native language) 🇺🇸 🇯🇵

  • 😃 Develop OS 👉

  • 💡 Programming Language 👉

  • 📚 Duolingo State 👇

QQxiaoming's duolingo

  • 💻 Github State 👇

QQxiaoming's Github

More...

quard_star_tutorial's People

Contributors

fanghuaqi avatar qqxiaoming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quard_star_tutorial's Issues

build img issue

合成img文件的时候 losetup 分区在脚本里面没有做, 需要先手动搞一波
losetup -o 0 --sizelimit 1073741824 /dev/loop70 output/rootfs/rootfs.img -P
sfdisk /dev/loop70
/dev/loop70p1 : start= 2048, size= 196608, type=c
/dev/loop70p2 : start= 198656, size= 1898496, type=83

mkfs.vfat /dev/loop70p1
mkfs.ext4 /dev/loop70p2

关于riscv编译工具链的问题

在文件./build.sh中,有以下几条路径

GLIB_ELF_CROSS_COMPILE_DIR=/opt/gcc-riscv64-unknown-linux-gnu
GLIB_ELF_CROSS_PREFIX=$GLIB_ELF_CROSS_COMPILE_DIR/bin/riscv64-unknown-linux-gnu
GLIB_ELF_CROSS_PREFIX_SYSROOT_DIR=$GLIB_ELF_CROSS_COMPILE_DIR/sysroot
NEWLIB_ELF_CROSS_COMPILE_DIR=/home/tc/Desktop/riscv-tool/riscv/
NEWLIB_ELF_CROSS_PREFIX=$NEWLIB_ELF_CROSS_COMPILE_DIR/bin/riscv64-unknown-elf

我在文档中没有找到对应的编译器安装路径的描述,也去官方的仓库(ch22章节提到了换源码编译工具)尝试自己编译源码看看能不能出现对应的文件夹,但是仓库中包含的子仓库太大,导致没法下载,甚至因此自己搭了个vps,但是很遗憾,有一些子库好像并未开放,没法完全clone下来。
我想问问您是怎么将仓库clone下来的?
下面是clone报错代码

Cloning into '/home/tc/Desktop/riscv-gnu-toolchain/musl'...
fatal: remote error: access denied or repository not exported: /git/musl
fatal: clone of 'git://git.musl-libc.org/git/musl' into submodule path '/home/tc/Desktop/riscv-gnu-toolchain/musl' failed
Failed to clone 'musl'. Retry scheduled
Cloning into '/home/tc/Desktop/riscv-gnu-toolchain/pk'...
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/riscv-software-src/riscv-pk.git' into submodule path '/home/tc/Desktop/riscv-gnu-toolchain/pk' failed
Failed to clone 'pk'. Retry scheduled
Cloning into '/home/tc/Desktop/riscv-gnu-toolchain/qemu'...
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git://gitlab.com/qemu-project/qemu.git' into submodule path '/home/tc/Desktop/riscv-gnu-toolchain/qemu' failed
Failed to clone 'qemu'. Retry scheduled
Cloning into '/home/tc/Desktop/riscv-gnu-toolchain/spike'...
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/riscv-software-src/riscv-isa-sim.git' into submodule path '/home/tc/Desktop/riscv-gnu-toolchain/spike' failed
Failed to clone 'spike'. Retry scheduled
Cloning into '/home/tc/Desktop/riscv-gnu-toolchain/musl'...
fatal: remote error: access denied or repository not exported: /git/musl
fatal: clone of 'git://git.musl-libc.org/git/musl' into submodule path '/home/tc/Desktop/riscv-gnu-toolchain/musl' failed
Failed to clone 'musl' a second time, aborting

可以认识一下吗?

可以加个微信吗? 我在工作中也开始使用qemu,我不会问一些显而易见或者动动手就能在网上搜到的问题,我觉得你做这一件事很酷。

sudo无法使用的问题

作者你好,我在移植sudo的时候遇到了以下问题,请问应该怎么解决
-bash-5.2$ sudo ls

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

For security reasons, the password you type will not be visible.

Password:
Sorry, try again.
Password:
Sorry, try again.
Password:
sudo: 3 incorrect password attempts
-bash-5.2$ xqemu: terminating on signal 2

关于ch9的疑问

作者您好,我在学习您的ch9的时候遇到了一些问题,现象是build.sh可以编译,但是qemu的所有串口均无打印,我在lowlevelboot的start.S中手动添加了一些打印log的语句,发现这些语句能在serial3中产生输出。
个人怀疑原因可能是opensbi或者uboot未能成功加载
不知道您那边是否遇到过这种情况

使用ip命令配置can网络出错

最近有社区朋友读到我的博客后通过邮件向我咨询了一个问题,特此提单记录下。

在配置can网络时出现如下错误。

image

对 build.sh lowlevelboot 的疑问

编译 lowlevelboot 时 用的是 riscv64-unknown-elf 工具链

unknown 这个 工具链 应该 不认识 C库,

然后我在 archlinux 上高了一个 riscv64-unknown-elf 工具链 编译 ,果然报错了
image

另外 教程ch4一节 是去 https://toolchains.bootlin.com/ 下载的 工具链 , 下载的也是 glibc 的版本 (认识 C库)

编译qemu时, 支持audio需要装那些库? (ubuntu 20.04)

--audio-drv-list=pa,alsa,sdl,oss

pa 应该是 PulseAudio , 我似乎已经装了

 sudo apt install pulseaudio
Reading package lists... Done
Building dependency tree
Reading state information... Done
pulseaudio is already the newest version (1:13.99.1-1ubuntu3.14).
The following package was automatically installed and is no longer required:
  libfwupdplugin1
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
R :: code/quard_star_tutorial »

但还是会出错

../meson.build:1405:6: ERROR: Problem encountered: Audio driver "pa" not available.

trusted_domain load error

hi, when i use ./build.sh trusted_domain, i got this error:

CC lseek.o
CC fstat.o
CC sbrk.o
CC sbi.o
CC it.o
CC main.o
AS startup.o
AS portASM.o
LD trusted_fw.elf
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: build/trusted_fw.elf has a LOAD segment with RWX permissions
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-svfprintf.o): in function _svfprintf_r': vfprintf.c:(.text._svfprintf_r+0x68): relocation truncated to fit: R_RISCV_HI20 against .L20'
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-ldtoa.o): in function .L298': ldtoa.c:(.text.ediv+0x64): relocation truncated to fit: R_RISCV_HI20 against ezero'
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-ldtoa.o): in function .L415': ldtoa.c:(.text.emul+0x66): relocation truncated to fit: R_RISCV_HI20 against ezero'
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-ldtoa.o): in function .L534': ldtoa.c:(.text._ldtoa_r+0xe8): relocation truncated to fit: R_RISCV_HI20 against eone'
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-assert.o): in function __assert_func': assert.c:(.text.__assert_func+0x1a): relocation truncated to fit: R_RISCV_HI20 against .LC0'
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-locale.o): in function __locale_mb_cur_max': locale.c:(.text.__locale_mb_cur_max+0x0): relocation truncated to fit: R_RISCV_HI20 against symbol __global_locale' defined in .data.__global_locale section in /opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-locale.o)
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-vfiprintf.o): in function .L28': vfprintf.c:(.text._vfiprintf_r+0x6a): relocation truncated to fit: R_RISCV_HI20 against .L46'
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-fini.o): in function __libc_fini_array': fini.c:(.text.__libc_fini_array+0x4): relocation truncated to fit: R_RISCV_HI20 against symbol __fini_array_start' defined in .text section in build/trusted_fw.elf
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-init.o): in function __libc_init_array': init.c:(.text.__libc_init_array+0x4): relocation truncated to fit: R_RISCV_HI20 against symbol __preinit_array_end' defined in .text section in build/trusted_fw.elf
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-freer.o): in function _malloc_trim_r': mallocr.c:(.text._malloc_trim_r+0x4): relocation truncated to fit: R_RISCV_HI20 against symbol _malloc_av' defined in .data._malloc_av section in /opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-mallocr.o)
/opt/gcc-riscv64-unknown-elf/bin/../lib/gcc/riscv64-unknown-elf/12.2.0/../../../../riscv64-unknown-elf/lib/libc.a(lib_a-freer.o): in function `_free_r':
mallocr.c:(.text._free_r+0x1c): 从输出所省略的额外重寻址溢出
collect2: error: ld returned 1 exit status
make: *** [Makefile:151:build/trusted_fw.elf] 错误 1

The other ./build cmds work fine.
my OS is ubuntun 20.04
riscv compiler is:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.