WhyCan Forum(哇酷开发者社区)

我们能随心所欲"有问题百度(谷歌)一下", 这得感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn

您尚未登录。

#1 2020-06-10 00:00:05

没事逛荡
会员
注册时间: 2018-10-22
累计积分: 28

DOPI编译

环境及编译流程:http://www.dopi.vip/tutorial/markdown/
环境:虚拟机64位ubuntu16.04lts

安装软件包:

sudo apt-get update && sudo apt-get install -y bzip2 build-essential libc6-dev-i386 ia32-libs lib32z1-dev libncurses5 libncurses5-dev u-boot-tools vim squashfs-tools gettext git zip subversion bc

这里提示两个问题:
1:

E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?

解决:

sudo rm /var/lib/dpkg/lock

2:

没有可用的软件包 ia32-libs,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,
或者只能在其他发布源中找到
然而下列软件包会取代它:
  lib32ncurses5 lib32z1

E: 软件包 ia32-libs 没有可安装候选

解决:

sudo apt-get install lib32z1 lib32ncurses5 

同时安装(没测试是否必须):

sudo apt-get install lib32stdc++6

安装工具链:

tar zxvf arm-himix100-linux.tgz
cd arm-himix100-linux
sudo ./arm-himix100-linux.install

完成后由提示:

export path /opt/hisi-linux/x86-arm/arm-himix100-linux/bin

需要使能环境变量:

source /etc/profile

然后可以arm-himix100-linux-gcc -v查看版本信息

分别clone uboot、内核和文件系统,按照说明编译
在编译内核时报错:

"mkimage" command not found - U-Boot images will not be built
arch/arm/boot/Makefile:87: recipe for target 'arch/arm/boot/uImage' failed
make[1]: *** [arch/arm/boot/uImage] Error 1
arch/arm/Makefile:334: recipe for target 'uImage' failed
make: *** [uImage] Error 2

需要安装工具:

sudo apt-get install u-boot-tools

再次编译完成

离线

#2 2020-06-10 11:04:45

Tony
Moderator
注册时间: 2019-05-31
累计积分: 134
个人网站

Re: DOPI编译

感谢大佬,昨晚晕哥发给我了就看了,现在才来捧场

离线

#3 2020-06-10 11:54:41

LinjieGuo
Moderator
注册时间: 2019-07-24
累计积分: 226

Re: DOPI编译

顶一下呀,我昨天也编译成功了,发现根文件系统是编译好的,貌似只是打包一下而已。

离线

#4 2020-06-10 14:55:50

没事逛荡
会员
注册时间: 2018-10-22
累计积分: 28

Re: DOPI编译

Tony 说:

感谢大佬,昨晚晕哥发给我了就看了,现在才来捧场

新手一枚,感谢版主~

离线

#5 2020-06-10 14:56:24

没事逛荡
会员
注册时间: 2018-10-22
累计积分: 28

Re: DOPI编译

LinjieGuo 说:

顶一下呀,我昨天也编译成功了,发现根文件系统是编译好的,貌似只是打包一下而已。

是的,就是打包了下,要再研究下编译。

离线

#6 2020-06-10 15:34:25

sea18c
会员
注册时间: 2019-08-05
累计积分: 161

Re: DOPI编译

没事逛荡 说:

环境及编译流程:http://www.dopi.vip/tutorial/markdown/
环境:虚拟机64位ubuntu16.04lts

安装软件包:
...


在安装软件包时把ia32-libs这个包去掉,后面就不会出错了,原因是当ia32-libs这个包没有安装时后面的包都没有安装。

离线

#7 2020-06-10 23:32:49

没事逛荡
会员
注册时间: 2018-10-22
累计积分: 28

Re: DOPI编译

sea18c 说:

在安装软件包时把ia32-libs这个包去掉,后面就不会出错了,原因是当ia32-libs这个包没有安装时后面的包都没有安装。

不晓得这个会不会用到,能装就装了

离线

#8 2020-06-25 12:45:33

没事逛荡
会员
注册时间: 2018-10-22
累计积分: 28

Re: DOPI编译

拿到板子,一直没顾上测试,把编译好的uboot、kernel、rootfs下载,结果运行不起来,先记录下
烧写log

Current Serial port selection: COM8
####################################################### ---- 10%
##################################################### ---- 20%
##################################################### ---- 30%
##################################################### ---- 40%
##################################################### ---- 50%
##################################################### ---- 60%
##################################################### ---- 70%
##################################################### ---- 80%
##################################################### ---- 90%
################################################### ---- 100%
Boot download completed!
start download process.
Boot started successfully!

Send command:	getinfo version
version: U-Boot 2016.11-dirty
[EOT](OK)

Send command:	getinfo bootmode
nand
[EOT](OK)

Send command:	getinfo nand
Block:128KB Chip:128MB*1 Page:2KB OOB:64B ECC:4bit/512 
ID:0xEF 0xAA 0x21 
Name:"W25N01GV"
[EOT](OK)

Send command:	nand erase 0x0 0x80000

NAND erase: device 0 offset 0x0, size 0x80000

Erasing at 0x0 --  25% complete.
Erasing at 0x20000 --  50% complete.
Erasing at 0x40000 --  75% complete.
Erasing at 0x60000 -- 100% complete.
OK
[EOT](OK)

Send command:	nand write 0x41000000 0x0 0x40000

NAND write: device 0 offset 0x0, size 0x40000
pure data length is 262144, len_incl_bad is 262144
 262144 bytes written: OK
[EOT](OK)

Send command:	mw.b 0x41000000 0xFF 0x3a0000
[EOT](OK)

Send command:	Downloading File : uImage

[Download File by usb]
file = Z:\ubuntu\uImage
address = 0x41000000
fileLength = 3699928 B
#
done

Send command:	nand erase 0x80000 0x500000

NAND erase: device 0 offset 0x80000, size 0x500000

Erasing at 0x80000 --   2% complete.
Erasing at 0xa0000 --   5% complete.
Erasing at 0xc0000 --   7% complete.
Erasing at 0xe0000 --  10% complete.[EOT](OK)

Send command:	nand write 0x41000000 0x80000 0x3a0000

NAND write: device 0 offset 0x80000, size 0x3a0000
pure data length is 3801088, len_incl_bad is 3801088
 3801088 bytes written: OK
[EOT](OK)
Partition kernel burnt successfully!

Send command:	getinfo nand
Block:128KB Chip:128MB*1 Page:2KB OOB:64B ECC:4bit/512 
ID:0xEF 0xAA 0x21 
Name:"W25N01GV"
[EOT](OK)

Send command:	mw.b 0x41000000 0xFF 0x20d2400
[EOT](OK)

Send command:	Downloading File : yaffs2-root-v2.12.img

[Download File by usb]
file = Z:\ubuntu\yaffs2-root-v2.12.img
address = 0x41000000
fileLength = 34415616 B
#########
done

Send command:	nand erase 0x580000 0x3200000

NAND erase: device 0 offset 0x580000, size 0x3200000

Erasing at 0x580000 --   0% complete.
Erasing at 0x5e0000 --   1% complete.
Erasing at 0x660000 --   2% complete.
Erasing at 0x6e0000 --   3% complete.[EOT](OK)

Send command:	nand write.yaffs 0x41000000 0x580000 0x20d2400

NAND write: device 0 offset 0x580000, size 0x20d2400
!!! yaffs2 filesystem image ecctype(28bits/1K) is NOT consistent with hardware ecctype(8bit).
Please remake yaffs2 filesystem image, make sure your yaffs2 filesystem image pagesize and ecctype is consistent with hardware config.
[EOT](OK)
Partition rootfs burnt successfully!

Send command:	reset
reset success!
Partition burnt completed!

USB channels were closed successfully.

启动log

System startup

Uncompress Ok!

U-Boot 2016.11-dirty (Jun 25 2020 - 11:40:18 +0800)hi3516ev200

Relocation Offset is: 03734000
Relocating to 43f34000, new gd at 43e93ef0, sp at 43e93ed0
SPI Nor:  Boot Media isn't SPI Nor
NAND:  SPI Nand ID Table Version 2.7
SPI Nand(cs 0) ID: 0xef 0xaa 0x21 Name:"W25N01GV"
Block:128KB Page:2KB OOB:64B ECC:4bit/512 
Chipsize:128 MiB
MMC:   
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   eth0
Warning: eth0 (eth0) using random MAC address - 7a:fc:90:53:6a:41

Hit any key to stop autoboot:  0 

NAND read: device 0 offset 0x80000, size 0x500000
 5242880 bytes read: OK
## Booting kernel from Legacy Image at 42000000 ...
   Image Name:   Linux-4.9.37
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3699864 Bytes = 3.5 MiB
   Load Address: 40008000
   Entry Point:  40008000
   Loading Kernel Image ... OK

Starting kernel ...

Booting Linux on physical CPU 0x0
Linux version 4.9.37 (sdong@sdong-Parallels-Virtual-Platform) (gcc version 6.3.0
CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
CPU: div instructions available: patching division code
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
OF: fdt:Machine model: Hisilicon HI3516EV200 DEMO Board
Memory policy: Data cache writeback
CPU: All CPU(s) started in SVC mode.
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 10160
Kernel command line: mem=40M console=tty0 console=ttyAMA0,115200 root=/dev/mtdb)
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 33012K/40960K available (5475K kernel code, 190K rwdata, 1332K rodata, )
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xc3000000 - 0xff800000   ( 968 MB)
    lowmem  : 0xc0000000 - 0xc2800000   (  40 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc0560f48   (5476 kB)
      .init : 0xc06b0000 - 0xc06dc000   ( 176 kB)
      .data : 0xc06dc000 - 0xc070bae0   ( 191 kB)
       .bss : 0xc070d000 - 0xc074e6a8   ( 262 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:16 nr_irqs:16 16
Gic dist init...
arm_arch_timer: Architected cp15 timer(s) running at 50.00MHz (phys).
clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xb8812736b, s
sched_clock: 56 bits at 50MHz, resolution 20ns, wraps every 4398046511100ns
Switching to timer-based delay loop, resolution 20ns
clocksource: arm,sp804: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6s
Console: colour dummy device 80x30
console [tty0] enabled
Calibrating delay loop (skipped), value calculated using timer frequency.. 100.)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x40008200 - 0x40008258
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 191s
futex hash table entries: 256 (order: -1, 3072 bytes)
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
Serial: AMBA PL011 UART driver
12040000.uart: ttyAMA0 at MMIO 0x12040000 (irq = 21, base_baud = 0) is a PL011 2
console [ttyAMA0] enabled
SCSI subsystem initialized
ssp-pl022 12071000.spi: ARM PL022 driver, device ID: 0x00800022
ssp-pl022 12071000.spi: mapped registers from 0x12071000 to c306b000
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Linux video capture interface: v2.00
clocksource: Switched to clocksource arch_sys_counter
NET: Registered protocol family 2
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
workingset: timestamp_bits=30 max_order=14 bucket_order=0
NFS: Registering the id_resolver key type
Key type id_resolver registered
Key type id_legacy registered
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
io scheduler noop registered
io scheduler deadline registered (default)
io scheduler cfq registered
pl061_gpio 120b0000.gpio_chip: PL061 GPIO chip @0x120b0000 registered
pl061_gpio 120b1000.gpio_chip: PL061 GPIO chip @0x120b1000 registered
pl061_gpio 120b2000.gpio_chip: PL061 GPIO chip @0x120b2000 registered
pl061_gpio 120b4000.gpio_chip: PL061 GPIO chip @0x120b4000 registered
pl061_gpio 120b5000.gpio_chip: PL061 GPIO chip @0x120b5000 registered
pl061_gpio 120b6000.gpio_chip: PL061 GPIO chip @0x120b6000 registered
pl061_gpio 120b7000.gpio_chip: PL061 GPIO chip @0x120b7000 registered
pl061_gpio 120b8000.gpio_chip: PL061 GPIO chip @0x120b8000 registered
brd: module loaded
loop: module loaded
hisi-sfc hisi_spi_nor.0: SPI Nor ID Table Version 1.2
hisi-sfc hisi_spi_nor.0: unrecognized Manufacturer ID
hisi-sfc hisi_spi_nor.0: spi nor register fail!
hisi-sfc: probe of hisi_spi_nor.0 failed with error -2
SPI Nand ID Table Version 2.7
SPI Nand(cs 0) ID: 0xef 0xaa 0x21
nand: device found, Manufacturer ID: 0xef, Chip ID: 0xaa
nand: Winbond W25N01GV
nand: 128MiB, SLC, page size: 2048
Nand(Auto): OOB:64B 
ECC:4bit/512 nand:  ECC provided by Flash Memory Controller
3 cmdlinepart partitions found on MTD device hinand
Creating 3 MTD partitions on "hinand":
0x000000000000-0x000000080000 : "boot"
0x000000080000-0x000000580000 : "kernel"
0x000000580000-0x000008000000 : "rootfs"
FEPHY:addr=1, la_am=0xb, ldo_am=0x4, r_tuning=0x1d
libphy: hisi_femac_mii_bus: probed
libphy: Fixed MDIO Bus: probed
Generic PHY 10041100.mdio:01: attached PHY driver [Generic PHY] (mii_bus:phy_ad)
phy_id=0x20669903, phy_mode=mii
hisi-femac 10040000.ethernet: using random MAC address 96:3a:64:f7:65:fe
dwc3 10030000.hidwc3: Configuration mismatch. dr_mode forced to gadget
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
hibvt_rtc 120e0000.rtc: rtc core: registered 120e0000.rtc as rtc0
hibvt_rtc 120e0000.rtc: RTC driver for hibvt enabled
i2c /dev entries driver
hibvt-i2c 12060000.i2c: hibvt-i2c0@100000hz registered
hibvt-i2c 12061000.i2c: hibvt-i2c1@100000hz registered
hibvt-i2c 12062000.i2c: hibvt-i2c2@100000hz registered
uvcvideo: Unable to create debugfs directory
usbcore: registered new interface driver uvcvideo
USB Video Class driver (1.1.1)
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
sdhci-pltfm: SDHCI platform and OF driver helper
mmc0: SDHCI controller on 10010000.sdhci [10010000.sdhci] using ADMA in legacy e
mmc1: SDHCI controller on 10020000.sdhci [10020000.sdhci] using ADMA in legacy e
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
Key type dns_resolver registered
hibvt_rtc 120e0000.rtc: setting system clock to 1970-01-01 00:00:04 UTC (4)
uart-pl011 12040000.uart: no DMA platform data
yaffs: dev is 32505858 name is "mtdblock2" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs2 filesystem) on device 31:2.
devtmpfs: error mounting -2
Freeing unused kernel memory: 176K (c06b0000 - c06dc000)
This architecture does not have kernel memory protection.
Kernel panic - not syncing: No working init found.  Try passing init= option to.
CPU: 0 PID: 1 Comm: swapper Not tainted 4.9.37 #1
Hardware name: Generic DT based system
Backtrace: 
[<c0012870>] (dump_backtrace) from [<c0012b2c>] (show_stack+0x18/0x1c)
 r7:00000000 r6:00000000 r5:00000000 r4:c070d2e8
[<c0012b14>] (show_stack) from [<c024f10c>] (dump_stack+0x24/0x28)
[<c024f0e8>] (dump_stack) from [<c00736a0>] (panic+0xd0/0x238)
[<c00735d4>] (panic) from [<c055c61c>] (__irq_alloc_descs+0x0/0x22c)
 r3:00000000 r2:0000097e r1:c27eea00 r0:c0619208
 r7:00000000
[<c055c520>] (kernel_init) from [<c000f7e8>] (ret_from_fork+0x14/0x2c)
 r5:c055c520 r4:00000000
---[ end Kernel panic - not syncing: No working init found.  Try passing init= .

离线

#9 2020-06-30 22:23:05

没事逛荡
会员
注册时间: 2018-10-22
累计积分: 28

Re: DOPI编译

编译内核,查看cat build.sh,输出

cp arch/arm/configs/hi3516ev200_full_defconfig  .config
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- uImage

copy了一个配置文件过来,然后编译。

也可以自己做一个配置,输入 make menuconfig

   HOSTCC  scripts/kconfig/mconf.o
In file included from scripts/kconfig/mconf.c:23:0:
scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: 没有那个文件或目录
compilation terminated.
scripts/Makefile.host:124: recipe for target 'scripts/kconfig/mconf.o' failed
make[2]: *** [scripts/kconfig/mconf.o] Error 1
Makefile:546: recipe for target 'menuconfig' failed
make[1]: *** [menuconfig] Error 2
Makefile:525: recipe for target '__build_one_by_one' failed
make: *** [__build_one_by_one] Error 2

执行

sudo apt-get install libncurses5-dev

安装完成后,再次执行,make menuconfig,可以去配置内核了

离线

#10 2020-06-30 22:36:38

没事逛荡
会员
注册时间: 2018-10-22
累计积分: 28

Re: DOPI编译

编译uboot,执行cat build.sh,输出

if [ $1 == "nand" ] 
then
echo "#define DOPI_SPI_NAND ">include/configs/dopi.h
make ARCH=arm CROSS_COMPILE=arm-himix100-linux-  hi3516ev200_config
echo "DOPI_SPI_NAND=y">>./.config
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- 
cp reg_info.bin .reg
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- u-boot-z.bin
    echo " build spi nand flash version"
else
	echo "build spi nor flash version"
echo "#define DOPI_SPI_NOR ">include/configs/dopi.h
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- hi3516ev200_config
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- 
cp reg_info.bin .reg
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- u-boot-z.bin
fi

dopi板载是Nand Flash,所以需要输入参数 Nand,执行的也就是在include/configs/dopi.h中写入宏定义,以及./.config中加个配置。
这里可以修改下,既然板载默认是Nand,可以不输入参数,默认选nand。

if [ $1 == "nor" ] 
then
echo "#define DOPI_SPI_NOR ">include/configs/dopi.h
make ARCH=arm CROSS_COMPILE=arm-himix100-linux-  hi3516ev200_config
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- 
cp reg_info.bin .reg
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- u-boot-z.bin
    echo " build spi nor flash version"
else
	echo "build spi nand flash version"
echo "#define DOPI_SPI_NADN ">include/configs/dopi.h
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- hi3516ev200_config
echo "DOPI_SPI_NAND=y">>./.config
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- 
cp reg_info.bin .reg
make ARCH=arm CROSS_COMPILE=arm-himix100-linux- u-boot-z.bin
fi

离线

页脚

工信部备案:粤ICP备20025096号-1 Powered by FluxBB