提交 bfcb44c3 编写于 作者: Y yafen

目录结构调整

上级 3c5ceba7
......@@ -21,8 +21,9 @@ You can get introduction of openEuler RaspberryPi SIG from [sig-RaspberryPi](htt
## Files and Directories
- [scripts](./scripts): Script for building openEuler image for Raspberry Pi
- [Build on host](scripts/build-img.sh)
- [Build in a Docker container](scripts/build-img-docker.sh)
- [Quickly Build(without kernel compilation)](scripts/build-image.sh)
- [Build on host(with kernel compilation)](scripts/build-image-common.sh)
- [Build in a Docker container(with kernel compilation)](scripts/build-image-docker.sh)
- [documents](./documents/):
- [Building openEuler image for Raspberry Pi](documents/openEuler镜像的构建.md)
- [Cross-compile the kernel](documents/交叉编译内核.md)
......@@ -43,7 +44,7 @@ Basic information of the above image:
- Kernel version: 4.19.90-2005.2.0.0002
- Firmware source: [firmware](https://github.com/raspberrypi/firmware), [bluez-firmware](https://github.com/RPi-Distro/bluez-firmware), [firmware-nonfree](https://github.com/RPi-Distro/firmware-nonfree)
- Repository of rootfs: [openEuler-20.03-LTS](http://repo.openeuler.org/openEuler-20.03-LTS/everything/aarch64/)
- Repository inside the image: [openEuler 20.03 LTS repository](https://gitee.com/openeuler/raspberrypi/blob/master/scripts/config/openEuler-20.03-LTS.repo)
- Repository inside the image: [openEuler 20.03 LTS repository](https://gitee.com/openeuler/raspberrypi/blob/master/scripts/config-common/openEuler-20.03-LTS.repo)
## How to Use image
......@@ -70,7 +71,7 @@ Build images with packages of raspberrypi-kernel, raspberrypi-firmware, and rasp
Run the following command to build an image:
`sudo bash build-img-quick.sh -d DIR -r REPO -n IMAGE_NAME`
`sudo bash build-image.sh -d DIR -r REPO -n IMAGE_NAME`
The meaning of each parameter:
......@@ -84,10 +85,10 @@ The meaning of each parameter:
The URL/path of target repo file, or the list of repositories' baseurls. Note that, the baseurls should be separated by space and enclosed in double quotes.
By default, the parameter is the path of the repo file which should be in the `openEuler` directory. Examples are as follows:
By default, the parameter is the path of the repo file which should be in the `config` directory. Examples are as follows:
- The URL of target repo file: `https://gitee.com/src-openeuler/openEuler-repos/blob/openEuler-20.03-LTS/generic.repo`
- The path of target repo file: `/opt/raspi-image-build/openEuler/openEuler-20.03-LTS.repo`
- The path of target repo file: `./config/openEuler-20.09.repo`
- List of repo's baseurls: `"http://repo.openeuler.org/openEuler-20.03-LTS/OS/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS/source"`
3. -n, --name IMAGE_NAME
......@@ -108,7 +109,7 @@ Here, we provide two approaches to build an image, which both include compiling
Run the following command to build an image:
`sudo bash build-img.sh -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
`sudo bash build-image-common.sh -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
The meaning of each parameter:
......@@ -134,10 +135,10 @@ The meaning of each parameter:
The URL/path of target repo file, or the list of repositories' baseurls. Note that, the baseurls should be separated by space and enclosed in double quotes.
By default, the parameter is the path of the repo file which should be in the `openEuler` directory. Examples are as follows:
By default, the parameter is the path of the repo file which should be in the `config-common` directory. Examples are as follows:
- The URL of target repo file: `https://gitee.com/src-openeuler/openEuler-repos/blob/openEuler-20.03-LTS/generic.repo`
- The path of target repo file: `/opt/raspi-image-build/openEuler/openEuler-20.03-LTS.repo`
- The path of target repo file: `./config-common/openEuler-20.03-LTS.repo`
- List of repo's baseurls: `"http://repo.openeuler.org/openEuler-20.03-LTS/OS/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS/source"`
6. --cores N
......@@ -148,7 +149,7 @@ The meaning of each parameter:
Run the following command to build an image:
`sudo bash build-img-docker.sh -d DOCKER_FILE -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
`sudo bash build-image-docker.sh -d DOCKER_FILE -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
Caution, before running the script, you need to install Docker. The script will automatically import the Docker image into the local system according to the script's parameter: DOCKER_FILE.
......
......@@ -19,8 +19,9 @@ SIG 组基本信息位于 [sig-RaspberryPi](https://gitee.com/jianminw/community
## 仓库目录
- [scripts](./scripts): 构建 openEuler 树莓派镜像的脚本
- [主机上构建](scripts/build-img.sh)
- [Docker 容器中构建](scripts/build-img-docker.sh)
- [快速构建(不编译内核)](scripts/build-image.sh)
- [主机上构建(编译内核)](scripts/build-image-common.sh)
- [Docker 容器中构建(编译内核)](scripts/build-image-docker.sh)
- [documents](./documents/): 使用文档
- [openEuler 镜像的构建](documents/openEuler镜像的构建.md)
- [交叉编译内核](documents/交叉编译内核.md)
......@@ -42,7 +43,7 @@ openEuler 20.03 LTS 的内测版本镜像,[下载](https://isrc.iscas.ac.cn/eu
- 内核版本:4.19.90-2005.2.0.0002
- 固件来源:[firmware](https://github.com/raspberrypi/firmware)[bluez-firmware](https://github.com/RPi-Distro/bluez-firmware)[firmware-nonfree](https://github.com/RPi-Distro/firmware-nonfree)
- 构建文件系统的源仓库:[openEuler-20.03-LTS](http://repo.openeuler.org/openEuler-20.03-LTS/everything/aarch64/)
- 镜像内置源仓库:[openEuler 20.03 LTS 源仓库](https://gitee.com/openeuler/raspberrypi/blob/master/scripts/config/openEuler-20.03-LTS.repo)
- 镜像内置源仓库:[openEuler 20.03 LTS 源仓库](https://gitee.com/openeuler/raspberrypi/blob/master/scripts/config-common/openEuler-20.03-LTS.repo)
## 使用镜像
......@@ -72,7 +73,7 @@ openEuler 20.03 LTS 的内测版本镜像,[下载](https://isrc.iscas.ac.cn/eu
构建镜像需执行命令:
`sudo bash build-img-quick.sh -d DIR -r REPO -n IMAGE_NAME`
`sudo bash build-image.sh -d DIR -r REPO -n IMAGE_NAME`
各个参数意义:
......@@ -86,9 +87,9 @@ openEuler 20.03 LTS 的内测版本镜像,[下载](https://isrc.iscas.ac.cn/eu
开发源 repo 文件的 URL 或者路径,也可以是开发源中资源库的 baseurl 列表。注意,如果该参数为资源库的 baseurl 列表,该参数需要使用双引号,各个 baseurl 之间以空格隔开。
默认使用脚本所在目录的 openEuler 文件夹下的 repo 文件。下面分别举例:
默认使用脚本所在目录的 config 文件夹下的 repo 文件。下面分别举例:
- 开发源 repo 文件的 URL:`https://gitee.com/src-openeuler/openEuler-repos/blob/openEuler-20.03-LTS/generic.repo`
- 开发源的 repo 文件路径:`/opt/raspi-image-build/openEuler/openEuler-20.03-LTS.repo`
- 开发源的 repo 文件路径:`./config/openEuler-20.09.repo`
- 资源库的 baseurl 列表:`"http://repo.openeuler.org/openEuler-20.03-LTS/OS/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS/source"`
3. -n, --name IMAGE_NAME
......@@ -111,7 +112,7 @@ openEuler 20.03 LTS 的内测版本镜像,[下载](https://isrc.iscas.ac.cn/eu
构建镜像需执行命令:
`sudo bash build-img.sh -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
`sudo bash build-image-common.sh -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
各个参数意义:
......@@ -137,9 +138,9 @@ openEuler 20.03 LTS 的内测版本镜像,[下载](https://isrc.iscas.ac.cn/eu
开发源 repo 文件的 URL 或者路径,也可以是开发源中资源库的 baseurl 列表。注意,如果该参数为资源库的 baseurl 列表,该参数需要使用双引号,各个 baseurl 之间以空格隔开。
默认使用脚本所在目录的 openEuler 文件夹下的 repo 文件。下面分别举例:
默认使用脚本所在目录的 config-common 文件夹下的 repo 文件。下面分别举例:
- 开发源 repo 文件的 URL:`https://gitee.com/src-openeuler/openEuler-repos/blob/openEuler-20.03-LTS/generic.repo`
- 开发源的 repo 文件路径:`/opt/raspi-image-build/openEuler/openEuler-20.03-LTS.repo`
- 开发源的 repo 文件路径:`./config-common/openEuler-20.03-LTS.repo`
- 资源库的 baseurl 列表:`"http://repo.openeuler.org/openEuler-20.03-LTS/OS/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/aarch64/ http://repo.openeuler.org/openEuler-20.03-LTS/source"`
6. --cores N
......@@ -150,7 +151,7 @@ openEuler 20.03 LTS 的内测版本镜像,[下载](https://isrc.iscas.ac.cn/eu
构建镜像需执行命令:
`sudo bash build-img-docker.sh -d DOCKER_FILE -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
`sudo bash build-image-docker.sh -d DOCKER_FILE -n IMAGE_NAME -k KERNEL_URL -b KERNEL_BRANCH -c KERNEL_DEFCONFIG -r REPO --cores N`
注意!!!运行该脚本前,需安装 Docker 运行环境。该脚本会自动将 DOCKER_FILE 参数对应的 Docker 镜像导入本机系统中。
......
......@@ -64,8 +64,8 @@
1. 下载并安装刷写镜像的工具,以下操作以 Win32 Disk Imager 工具为例。
2. 右键选择“以管理员身份运行”,打开 Win32 Disk Imager。
3. 选择镜像 img 文件
4. 选择待写入的 SD 卡盘符。
3. 在“映像文件”中选择 img 格式的镜像文件路径
4. 在“设备”中选择待写入的 SD 卡盘符。
5. 单击“写入”。如下图所示,界面通过任务进度条显示写入 SD 卡的进度。
![](images/写入SD.png)
......
......@@ -2,7 +2,7 @@
set -e
__usage="
Usage: build-img [OPTIONS]
Usage: build-image-common [OPTIONS]
Build raspberrypi image.
Options:
......@@ -142,16 +142,9 @@ prepare(){
mkdir ${cur_dir}/log
fi
LOG "prepare begin..."
rmp_names=("bison" "flex" "parted" "wget" "multipath-tools")
rmp_install_names=("bison" "flex" "parted" "wget" "kpartx")
rmp_len=${#rmp_names[@]}
for (( i=0; i<${rmp_len}; i++ ))
do
rpm -qa | grep ${rmp_names[i]} &> /dev/null
[ $? -eq 0 ] || yum install -y ${rmp_install_names[i]} &> /dev/null
[ $? -ne 0 ] && ERROR "yum install ${rmp_install_names[i]} failed." && yum_right=3
done
[ $yum_right ] && exit 3
dnf makecache
dnf install -y git bison flex wget dnf-plugins-core tar parted dosfstools grep bash xz kpartx
if [ ! -d ${run_dir}/img ]; then
mkdir ${run_dir}/img
fi
......@@ -605,7 +598,7 @@ output_dir=${run_dir}/output
rootfs_dir=${run_dir}/rootfs_${builddate}
root_mnt=${run_dir}/root
boot_mnt=${run_dir}/boot
euler_dir=${cur_dir}/config
euler_dir=${cur_dir}/config-common
CONFIG_RPM_LIST=${euler_dir}/rpmlist
prepare
......
......@@ -3,7 +3,7 @@
set -e
__usage="
Usage: build-img-docker [OPTIONS]
Usage: build-image-docker [OPTIONS]
Build raspberrypi image.
Options:
......@@ -136,7 +136,7 @@ docker_file_name=${docker_file##*/}
docker_img_name=`docker load --input ${cur_dir}/tmp/${docker_file_name}`
docker_img_name=${docker_img_name##*: }
(echo "FROM $docker_img_name" && grep -v FROM ${cur_dir}/config/Dockerfile_makeraspi) | docker build -t ${docker_img_name}-${buildid} --no-cache -f- .
(echo "FROM $docker_img_name" && grep -v FROM ${cur_dir}/config-common/Dockerfile_makeraspi) | docker build -t ${docker_img_name}-${buildid} --no-cache -f- .
echo docker run --rm --privileged=true -v ${cur_dir}:/work ${docker_img_name}-${buildid} ${params}
docker run --rm --privileged=true -v ${cur_dir}:/work ${docker_img_name}-${buildid} ${params}
chmod -R a+r ${cur_dir}/img
......
......@@ -3,11 +3,11 @@
set -e
__usage="
Usage: build-img-quick [OPTIONS]
Usage: build-image [OPTIONS]
Build raspberrypi image.
Options:
-d, --dir DIR The directory for storing the image and other temporary files. If the DIR does not exist, it will be created automatically.
-d, --dir DIR The directory for storing the image and other temporary files, which defaults to be the directory in which the script resides. If the DIR does not exist, it will be created automatically.
-r, --repo REPO_INFO The URL/path of target repo file or list of repo's baseurls which should be a space separated list.
-n, --name IMAGE_NAME The raspberrypi image name to be built.
-h, --help Show command help.
......@@ -114,8 +114,8 @@ prepare(){
mkdir -p ${log_dir}
fi
LOG "prepare begin..."
# dnf makecache
# dnf install -y dnf-plugins-core tar parted dosfstools
dnf makecache
dnf install -y dnf-plugins-core tar parted dosfstools grep bash xz kpartx
if [ -d ${rootfs_dir} ]; then
rm -rf ${rootfs_dir}
......@@ -320,14 +320,15 @@ if [ "$EUID" -ne 0 ]; then
exit
fi
workdir=$(cd $(dirname $0);pwd)
cur_dir=$(cd $(dirname $0);pwd)
workdir=${cur_dir}
parseargs "$@" || help $?
if [ "x$workdir" == "x" ] ; then
if [ "x$workdir" == "x" ]; then
echo `date` - ERROR, \"-d DIR or --dir DIR\" missing.
help 2
elif [ ! -d ${workdir} ] ; then
elif [ ! -d ${workdir} ]; then
echo `date` - INFO, output dir ${workdir} does not exists.
mkdir -p ${workdir}
echo `date` - INFO, output dir: ${workdir} created.
......@@ -335,7 +336,6 @@ fi
OS_NAME=openEuler
cur_dir=$(cd $(dirname $0);pwd)
workdir=$(cd "$(dirname $workdir)"; pwd)/$(basename $workdir)
rootfs_dir=${workdir}/raspi_output/rootfs
root_mnt=${workdir}/raspi_output/root
......@@ -343,10 +343,9 @@ boot_mnt=${workdir}/raspi_output/boot
tmp_dir=${workdir}/raspi_output/tmp
log_dir=${workdir}/raspi_output/log
img_dir=${workdir}/raspi_output/img
euler_dir=${cur_dir}/config-quick
euler_dir=${cur_dir}/config
CONFIG_RPM_LIST=${euler_dir}/rpmlist
builddate=$(date +%Y%m%d)
prepare
......
......@@ -2,15 +2,15 @@ FROM openeuler-20.03-lts:latest
RUN dnf clean expire-cache
COPY config/openEuler-20.03-LTS.repo /etc/yum.repos.d/openEuler-20.03-LTS.repo
COPY config-common/openEuler-20.03-LTS.repo /etc/yum.repos.d/openEuler-20.03-LTS.repo
RUN dnf -y install cmake gdb gcc gcc-c++ libstdc++-static ncurses ncurses-devel make python bash coreutils && \
dnf -y clean all
RUN dnf -y install module-init-tools git openssl-devel bc bison flex dosfstools parted wget device-mapper-multipath
RUN dnf -y install module-init-tools git openssl-devel bc bison flex dnf-plugins-core dosfstools parted wget device-mapper-multipath grep xz kpartx
RUN dnf -y install tar passwd diffutils
ENV SHELL=/bin/bash
ENTRYPOINT ["/bin/bash", "/work/build-img.sh"]
ENTRYPOINT ["/bin/bash", "/work/build-image-common.sh"]
../config/hosts
\ No newline at end of file
......@@ -12,7 +12,4 @@ hostname
ntp
bluez
pulseaudio-module-bluetooth
raspberrypi-kernel
raspberrypi-firmware
raspberrypi-bluetooth
openEuler-repos
\ No newline at end of file
../config//hosts
\ No newline at end of file
#!/bin/bash
set -e
systemctl enable sshd
systemctl enable ntpd
systemctl enable hciuart
......
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
[all]
#dtoverlay=vc4-fkms-v3d
# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
#sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# Uncomment some or all of these to enable the optional hardware interfaces
#dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on
# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18
# Additional overlays and parameters are documented /boot/overlays/README
# Enable audio (loads snd_bcm2835)
dtparam=audio=on
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
[all]
#dtoverlay=vc4-fkms-v3d
......@@ -12,4 +12,7 @@ hostname
ntp
bluez
pulseaudio-module-bluetooth
raspberrypi-kernel
raspberrypi-firmware
raspberrypi-bluetooth
openEuler-repos
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册