diff --git a/README.en.md b/README.en.md index 41f530de70fcab11677bfdbe139e957d42dc63bf..22d176fc6cd3de0dfaff38262383eb25f6caec35 100644 --- a/README.en.md +++ b/README.en.md @@ -20,7 +20,7 @@ git config --global credential.helper store ``` 4. Install repo tools by running the commands below. ``` -curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo +curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo chmod a+x /usr/local/bin/repo pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests ``` @@ -75,8 +75,8 @@ $PHY_DEV/auto_patch.sh $PROJ_ROOT # Build ## 3.1 Build OpenHarmony source code ``` -cd $PROJ_ROOT -./build.sh --product-name d2000 --ccache --target-cpu arm64 +cd $PROJ_ROOT +./build.sh --product-name d2000 --ccache --target-cpu arm64 ``` Prompt message will be printed after building successfully: ``` @@ -85,35 +85,19 @@ post_process ``` Out put files ``` -$PROJ_ROOT/out/d2000/packages/phone/images/system.img +$PROJ_ROOT/out/d2000/packages/phone/images/system.img $PROJ_ROOT/out/d2000/packages/phone/images/vendor.img $PROJ_ROOT/out/d2000/packages/phone/images/userdata.img +$PROJ_ROOT/out/d2000/packages/phone/images/ramdisk.img ``` ## 3.2 Build linux kernel -Phytium device source code provided linux kernel precompiled files in: -``` -$PHY_DEV/device_board_phytium/d2000/loader -``` -You can also connect Phytium Information Technology Co. LTD to get linux kernel source code, and build it by yourself referring to the README in linux kernel source code. +Please connect Phytium Technology Co. LTD by emails provided at the end of this file to get linux kernel source code, and build it by yourself referring to the README in linux kernel source code. >**!!! Notice:** As vpu is compiled as a module of linux kernel modules, when you update linux kernel, you should update the ko files of vpu at the same time. When linux kernel project is built, the ko files of vpu will be generated to the path below : **linux_kernel/drivers/media/platform/phytium-vpu/vxd/vxd.ko linux_kernel/drivers/media/platform/phytium-vpu/mem_man/img_mem.ko** These two ko files should be copied to the path **/system/lib64/media/plugins/** of system partition on development board, when you burn the image. -## 3.3 Build Ramdisk -``` -export RAMDISK=$WORK_SPACE/ramdisk -mkdir $RAMDISK -cd $RAMDISK -cp $PROJ_ROOT/device/board/phytium/d2000/loader/ramdisk/initramfs_data.cpio $RAMDISK -sudo cpio -idmv < initramfs_data.cpio -rm initramfs_data.cpio -cp $PROJ_ROOT/out/d2000/packages/phone/ramdisk/* $RAMDISK -rf -cp $PROJ_ROOT/device/soc/phytium/d2000/hardware/gpu/mesa3d_kernel_5.10/lib/ $RAMDISK -r -sudo find . | cpio -o -Hnewc > ../initramfs.img -``` - # Burn Images ## 4.1 Hard disk partition Prepare a hard disk of SATA,clean all the partitions on it.Under a linux environment, use the fdisk command to create four partitions on the disk. The order of partitions should be boot/system/vendor/userdata. The size of each partition can be set according to the actual situation, for example:500M/3G/500M/10G. @@ -136,7 +120,7 @@ Use command dd to burn the images, which is produced in chapter[3.1 Build OpenHa ``` sudo dd if=system.img of=/dev/sdx2 bs=1M sudo dd if=vendor.img of=/dev/sdx3 bs=1M -sudo dd if=userdata.img of=/dev/sdx4 bs=1M +sudo dd if=userdata.img of=/dev/sdx4 bs=1M ``` >**!!! Notice:** If the system booting is blocked, try to format data partition(**sudo mkfs.ext4 sdx4**) @@ -152,12 +136,11 @@ sudo mkfs.ext4 sdx1 mkdir ~/disk sudo mount /dev/sdx1 ~/disk ``` -3. Copy the linux kernel images, device tree files, which are got in chapter [3.2 Build linux kernel](#32-build-linux-kernel), and ramdisk image which is got in chapter [3.3 Build ramdisk](#33-build-ramdisk), to boot partition. -Take the linux kernel precompiled files as example: +3. Copy the linux kernel images, device tree files, which are got in chapter [3.2 Build linux kernel](#32-build-linux-kernel), and ramdisk image which is got in chapter [3.1 Build OpenHarmony source code](#31-build-openharmony-source-code), to boot partition. ``` -sudo cp $PHY_DEV/device_board_phytium/d2000/loader/Image ~/disk/ -sudo cp $PHY_DEV/device_board_phytium/d2000/loader/d2000-devboard-dsk.dtb ~/disk/ -sudo cp $WORK_SPACE/initramfs.img ~/disk/ +sudo cp linux_kernel/arch/arm64/boot/Image ~/disk/ +sudo cp linux_kernel/arch/arm64/boot/dts/phytium/d2000-devboard-dsk.dtb ~/disk/ +sudo cp $PROJ_ROOT/out/d2000/packages/phone/images/ramdisk.img ~/disk/ sync ``` >If you have the linux kernel source code, you can get all files to burn in linux kernel output files. Get more details from README in linux kernel source code. @@ -175,13 +158,12 @@ sudo mkfs.vfat sdx1 mkdir ~/disk sudo mount /dev/sdx1 ~/disk ``` -3) Copy the linux kernel images, device tree files , EFI files, which are got in chapter [3.2 Build linux kernel](#32-build-linux-kernel), and ramdisk image which is got in chapter [3.3 Build ramdisk](#33-build-ramdisk), to boot partition. -Take the linux kernel precompiled files as example: +3) Copy the linux kernel images, device tree files , EFI files, which are got in chapter [3.2 Build linux kernel](#32-build-linux-kernel), and ramdisk image which is got in chapter [3.1 Build OpenHarmony source code](#31-build-openharmony-source-code), to boot partition. ``` -sudo cp $PHY_DEV/device_board_phytium/d2000/loader/Image ~/disk/ -sudo cp $PHY_DEV/device_board_phytium/d2000/loader/d2000-devboard-dsk.dtb ~/disk/ +sudo cp linux_kernel/arch/arm64/boot/Image ~/disk/ +sudo cp linux_kernel/arch/arm64/boot/dts/phytium/d2000-devboard-dsk.dtb ~/disk/ sudo cp $PHY_DEV/device_board_phytium/d2000/loader/EFI/ ~/disk/ -r -sudo cp $WORK_SPACE/initramfs.img ~/disk/ +sudo cp $PROJ_ROOT/out/d2000/packages/phone/images/ramdisk.img ~/disk/ sync ``` >If you have the linux kernel source code, you can get all files to burn in linux kernel output files. Get more details from README in linux kernel source code. @@ -202,7 +184,7 @@ Press Enter in the serial port debugging tool window, after power on, and you wi setenv bootargs console=ttyAMA1,115200 earlycon=p1011,0x28001000 root=/dev/ram0 elevator=deadline rootwait rw loglevel=6 hardware=d2000 rootfstype=ext4 initrd=0x93000000,90M ext4load scsi 0:1 0x90100000 d2000-devboard-dsk.dtb ext4load scsi 0:1 0x90200000 Image -ext4load scsi 0:1 0x93000000 initramfs.img +ext4load scsi 0:1 0x93000000 ramdisk.img booti 0x90200000 - 0x90100000 ``` ## 5.2 Boot by UEFI diff --git a/README.md b/README.md index 823860fa84b523a661361877d40ec86bac5fd510..4e786170bc0c4c3abf3e421a84083f15abbba003 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,8 @@ $PHY_DEV/auto_patch.sh $PROJ_ROOT # 代码编译 ## 3.1 编译OpenHarmony源码 ``` -cd $PROJ_ROOT -./build.sh --product-name d2000 --ccache --target-cpu arm64 +cd $PROJ_ROOT +./build.sh --product-name d2000 --ccache --target-cpu arm64 ``` 编译成功提示: ``` @@ -84,16 +84,13 @@ post_process ``` 编译生成的文件 ``` -$PROJ_ROOT/out/d2000/packages/phone/images/system.img +$PROJ_ROOT/out/d2000/packages/phone/images/system.img $PROJ_ROOT/out/d2000/packages/phone/images/vendor.img $PROJ_ROOT/out/d2000/packages/phone/images/userdata.img +$PROJ_ROOT/out/d2000/packages/phone/images/ramdisk.img ``` ## 3.2 编译 Linux kernel -phytium device提供了kernel预编译好的文件: -``` -$PHY_DEV/device_board_phytium/d2000/loader -``` -也可以联系phytium公司获取kernel源码,并参考kernel源码中的README,编译出相关文件。 +请通过文末提供的邮件联系phytium公司获取kernel源码,并参考kernel源码中的README,编译出相关文件。 >**!!!注意:** vpu是作为Linux Kernel的modules的方式进行编译的,内核代码修改更新时,需要同步更新vpu相关的ko文件。 linux kernel源码编译后,vpu的ko文件生成的位置: @@ -102,19 +99,6 @@ linux_kernel/drivers/media/platform/phytium-vpu/mem_man/img_mem.ko 镜像烧写时,将这两个ko文件拷贝到开发板的system分区: /system/lib64/media/plugins/ -## 3.3 Ramdisk编译 -``` -export RAMDISK=$WORK_SPACE/ramdisk -mkdir $RAMDISK -cd $RAMDISK -cp $PROJ_ROOT/device/board/phytium/d2000/loader/ramdisk/initramfs_data.cpio $RAMDISK -sudo cpio -idmv < initramfs_data.cpio -rm initramfs_data.cpio -cp $PROJ_ROOT/out/d2000/packages/phone/ramdisk/* $RAMDISK -rf -cp $PROJ_ROOT/device/soc/phytium/d2000/hardware/gpu/mesa3d_kernel_5.10/lib/ $RAMDISK -r -sudo find . | cpio -o -Hnewc > ../initramfs.img -``` - # 镜像烧写 ## 4.1 硬盘分区 准备一块SATA硬盘,删除原有分区后,在linux下,使用fdsik命令分区,创建4个分区,依次为boot,system,vendor,userdata,根据实际情况设定,比如可以设定为500M,3G,500M,10G。 @@ -137,7 +121,7 @@ sudo mkfs.ext4 sdx4 ``` sudo dd if=system.img of=/dev/sdx2 bs=1M sudo dd if=vendor.img of=/dev/sdx3 bs=1M -sudo dd if=userdata.img of=/dev/sdx4 bs=1M +sudo dd if=userdata.img of=/dev/sdx4 bs=1M ``` ## 4.3. 烧录boot分区 boot分区的烧录,启动方式不一样,烧录方法不一样,区分为Uboot启动和UEFI启动两种。 @@ -151,12 +135,11 @@ sudo mkfs.ext4 sdx1 mkdir ~/disk sudo mount /dev/sdx1 ~/disk ``` -3. 将[3.2 编译 Linux kernel](#32-编译-linux-kernel)章节中生成的Kernel镜像,设备树文件,以及[3.3 Ramdisk编译](#33-ramdisk编译)章节中生成的ramdisk拷贝到boot分区。 -以直接使用预编译好的文件为例: +3. 将[3.2 编译 Linux kernel](#32-编译-linux-kernel)章节中生成的Kernel镜像,设备树文件,以及[3.3 编译OpenHarmony源码](#31-编译openharmony源码)章节中生成的ramdisk拷贝到boot分区。 ``` -sudo cp $PHY_DEV/device_board_phytium/d2000/loader/Image ~/disk/ -sudo cp $PHY_DEV/device_board_phytium/d2000/loader/d2000-devboard-dsk.dtb ~/disk/ -sudo cp $WORK_SPACE/initramfs.img ~/disk/ +sudo cp linux_kernel/arch/arm64/boot/Image ~/disk/ +sudo cp linux_kernel/arch/arm64/boot/dts/phytium/d2000-devboard-dsk.dtb ~/disk/ +sudo cp $PROJ_ROOT/out/d2000/packages/phone/images/ramdisk.img ~/disk/ sync ``` >如果使用kernel源码编译的文件,参考kernel源码中提供的README。 @@ -174,13 +157,12 @@ sudo mkfs.vfat sdx1 mkdir ~/disk sudo mount /dev/sdx1 ~/disk ``` -3) 将[3.2 编译 Linux kernel](#32-编译-linux-kernel)章节中生成的Kernel镜像,设备树文件,EFI文件,以及[3.3 Ramdisk编译](#33-ramdisk编译)章节中生成的ramdisk拷贝到EFI分区。 -以直接使用预编译好的文件为例: +3) 将[3.2 编译 Linux kernel](#32-编译-linux-kernel)章节中生成的Kernel镜像,设备树文件,EFI文件,以及[3.1 编译OpenHarmony源码](#31-编译openharmony源码)章节中生成的ramdisk拷贝到EFI分区。 ``` -sudo cp $PHY_DEV/device_board_phytium/d2000/loader/Image ~/disk/ -sudo cp $PHY_DEV/device_board_phytium/d2000/loader/d2000-devboard-dsk.dtb ~/disk/ +sudo cp linux_kernel/arch/arm64/boot/Image ~/disk/ +sudo cp linux_kernel/arch/arm64/boot/dts/phytium/d2000-devboard-dsk.dtb ~/disk/ sudo cp $PHY_DEV/device_board_phytium/d2000/loader/EFI/ ~/disk/ -r -sudo cp $WORK_SPACE/initramfs.img ~/disk/ +sudo cp $PROJ_ROOT/out/d2000/packages/phone/images/ramdisk.img ~/disk/ sync ``` >如果使用kernel源码编译的文件,参考kernel源码中提供的README。 @@ -201,7 +183,7 @@ sudo umount ~/disk setenv bootargs console=ttyAMA1,115200 earlycon=p1011,0x28001000 root=/dev/ram0 elevator=deadline rootwait rw loglevel=6 hardware=d2000 rootfstype=ext4 initrd=0x93000000,90M ext4load scsi 0:1 0x90100000 d2000-devboard-dsk.dtb ext4load scsi 0:1 0x90200000 Image -ext4load scsi 0:1 0x93000000 initramfs.img +ext4load scsi 0:1 0x93000000 ramdisk.img booti 0x90200000 - 0x90100000 ``` ## 5.2 UEFI启动 diff --git a/device_board_phytium/d2000/loader/EFI/BOOT/grub.cfg b/device_board_phytium/d2000/loader/EFI/BOOT/grub.cfg index b16df1e29fbd753292483c76080037213e13de90..bc3e20b165c598a124e8c16a922ba776943be57f 100755 --- a/device_board_phytium/d2000/loader/EFI/BOOT/grub.cfg +++ b/device_board_phytium/d2000/loader/EFI/BOOT/grub.cfg @@ -6,5 +6,5 @@ timeout=10 menuentry 'boot'{ linux /Image LABEL=boot root=/dev/ram0 hardware=d2000 selinux=0 rootfstype=ext4 -initrd /initramfs.img +initrd /ramdisk.img } diff --git a/device_board_phytium/d2000/loader/Image b/device_board_phytium/d2000/loader/Image deleted file mode 100644 index b135360a885f154575650fdb61dab46eeadb47f5..0000000000000000000000000000000000000000 Binary files a/device_board_phytium/d2000/loader/Image and /dev/null differ diff --git a/device_board_phytium/d2000/loader/d2000-devboard-dsk.dtb b/device_board_phytium/d2000/loader/d2000-devboard-dsk.dtb deleted file mode 100644 index e737a4cdc3bb2af81d701ff1542d70fd9e91713e..0000000000000000000000000000000000000000 Binary files a/device_board_phytium/d2000/loader/d2000-devboard-dsk.dtb and /dev/null differ diff --git a/device_board_phytium/d2000/loader/ramdisk/initramfs_data.cpio b/device_board_phytium/d2000/loader/ramdisk/initramfs_data.cpio deleted file mode 100644 index d6ba78ad5b6a750c9f0fe78c88bf8028466388cf..0000000000000000000000000000000000000000 Binary files a/device_board_phytium/d2000/loader/ramdisk/initramfs_data.cpio and /dev/null differ