页次: 1
修改内核源码目录下的 ./arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_a>;
status = "okay";
spi-max-frequency = <50000000>;
flash: w25q128@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "winbond,w25q128", "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x100000>;
read-only;
};
partition@100000 {
label = "dtb";
reg = <0x100000 0x10000>;
read-only;
};
partition@110000 {
label = "kernel";
reg = <0x110000 0x400000>;
read-only;
};
partition@510000 {
label = "rootfs";
reg = <0x510000 0xAF0000>;
};
};
};
};
按这个来配置,这个不行?
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (egsen@ubuntu) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #2 Tue Aug 14 21:19:44 CST 2018
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Lichee Pi Nano
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] random: fast init done
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 8128
[ 0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
[ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Memory: 22672K/32768K available (6144K kernel code, 237K rwdata, 1408K rodata, 1024K init, 246K bss, 10096K reserved, 0K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xc2800000 - 0xff800000 ( 976 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc2000000 ( 32 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (7136 kB)
[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)
[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 238 kB)
[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 247 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000047] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000114] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000659] Console: colour dummy device 80x30
[ 0.000751] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070237] pid_max: default: 32768 minimum: 301
[ 0.070552] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.070598] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.072066] CPU: Testing write buffer coherency: ok
[ 0.073772] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.076332] devtmpfs: initialized
[ 0.082875] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.082948] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.083211] pinctrl core: initialized pinctrl subsystem
[ 0.085245] NET: Registered protocol family 16
[ 0.086716] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.088480] cpuidle: using governor menu
[ 0.114319] SCSI subsystem initialized
[ 0.114662] usbcore: registered new interface driver usbfs
[ 0.114814] usbcore: registered new interface driver hub
[ 0.115011] usbcore: registered new device driver usb
[ 0.115438] pps_core: LinuxPPS API ver. 1 registered
[ 0.115469] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.115531] PTP clock support registered
[ 0.116023] Advanced Linux Sound Architecture Driver Initialized.
[ 0.117568] clocksource: Switched to clocksource timer
[ 0.144060] NET: Registered protocol family 2
[ 0.145491] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.145573] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.145625] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.145910] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.145971] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.146451] NET: Registered protocol family 1
[ 0.147833] RPC: Registered named UNIX socket transport module.
[ 0.147879] RPC: Registered udp transport module.
[ 0.147897] RPC: Registered tcp transport module.
[ 0.147913] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.150120] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.151932] Initialise system trusted keyrings
[ 0.152465] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[ 0.169941] NFS: Registering the id_resolver key type
[ 0.170027] Key type id_resolver registered
[ 0.170049] Key type id_legacy registered
[ 0.170170] jffs2: version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
[ 0.184565] Key type asymmetric registered
[ 0.184607] Asymmetric key parser 'x509' registered
[ 0.184810] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.184843] io scheduler noop registered
[ 0.184862] io scheduler deadline registered
[ 0.185643] io scheduler cfq registered (default)
[ 0.185677] io scheduler mq-deadline registered
[ 0.185694] io scheduler kyber registered
[ 0.186821] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[ 0.196463] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.367473] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.374366] console [ttyS0] disabled
[ 0.394629] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[ 0.868257] console [ttyS0] enabled
[ 0.878827] panel-simple panel: panel supply power not found, using dummy regulator
[ 0.888250] SCSI Media Changer driver v0.25
[ 0.893776] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.900429] ehci-platform: EHCI generic platform driver
[ 0.905933] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.912233] ohci-platform: OHCI generic platform driver
[ 0.917929] usbcore: registered new interface driver usb-storage
[ 0.924895] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[ 0.933955] i2c /dev entries driver
[ 0.997694] sunxi-mmc 1c0f000.mmc: base:0x06f7e97f irq:19
[ 1.005118] usbcore: registered new interface driver usbhid
[ 1.010824] usbhid: USB HID core driver
[ 1.032698] NET: Registered protocol family 17
[ 1.037390] Key type dns_resolver registered
[ 1.044034] Loading compiled-in X.509 certificates
[ 1.059655] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739c38)
[ 1.068558] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc0738f1c)
[ 1.076226] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 1.082946] [drm] No driver support for vblank timestamp query.
[ 1.136957] Console: switching to colour frame buffer device 60x34
[ 1.160345] sun4i-drm display-engine: fb0: frame buffer device
[ 1.167479] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[ 1.176624] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.188616] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.194408] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 1.204549] hub 1-0:1.0: USB hub found
[ 1.208607] hub 1-0:1.0: 1 port detected
[ 1.214103] using random self ethernet address
[ 1.218743] using random host ethernet address
[ 1.224955] usb0: HOST MAC 3e:10:47:76:4b:a1
[ 1.229476] usb0: MAC 26:46:97:40:41:40
[ 1.233476] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[ 1.241036] g_cdc gadget: g_cdc ready
[ 1.245682] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.263334] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 1.270199] vcc3v3: disabling
[ 1.273185] ALSA device list:
[ 1.276151] #0: Loopback 1
[ 1.279956] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.288702] cfg80211: failed to load regulatory.db
[ 1.294233] Waiting for root device /dev/mtdblock3...
@晕哥 是不是分区不成功,根系统起不来,怎么弄?
U-Boot SPL 2018.01-05676-g0018878-dirty (Aug 05 2018 - 11:29:58)
DRAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI
U-Boot 2018.01-05676-g0018878-dirty (Aug 05 2018 - 11:29:58 +0800) Allwinner Technology
CPU: Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM: 32 MiB
MMC: SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
Setting up a 480x272 lcd console (overscan 0x0)
In: serial@1c25000
Out: serial@1c25000
Err: serial@1c25000
Net: No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot: 2 1 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
device 0 offset 0x100000, size 0x4000
SF: 16384 bytes @ 0x100000 Read: OK
device 0 offset 0x110000, size 0x400000
SF: 4194304 bytes @ 0x110000 Read: OK
## Flattened Device Tree blob at 80c00000
Booting using the fdt blob at 0x80c00000
Loading Device Tree to 80e61000, end 80e65f3e ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 4.15.0-rc8-licheepi-nano+ (egsen@ubuntu) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #2 Tue Aug 14 21:19:44 CST 2018
[ 0.000000] CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=0005317f
[ 0.000000] CPU: VIVT data cache, VIVT instruction cache
[ 0.000000] OF: fdt: Machine model: Lichee Pi Nano
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] random: fast init done
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 8128
[ 0.000000] Kernel command line: console=ttyS0,115200 panic=5 rootwait root=/dev/mtdblock3 rw rootfstype=jffs2
[ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Memory: 22672K/32768K available (6144K kernel code, 237K rwdata, 1408K rodata, 1024K init, 246K bss, 10096K reserved, 0K cma-reserved, 0K highmem)
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( 4 kB)
[ 0.000000] fixmap : 0xffc00000 - 0xfff00000 (3072 kB)
[ 0.000000] vmalloc : 0xc2800000 - 0xff800000 ( 976 MB)
[ 0.000000] lowmem : 0xc0000000 - 0xc2000000 ( 32 MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
[ 0.000000] .text : 0x(ptrval) - 0x(ptrval) (7136 kB)
[ 0.000000] .init : 0x(ptrval) - 0x(ptrval) (1024 kB)
[ 0.000000] .data : 0x(ptrval) - 0x(ptrval) ( 238 kB)
[ 0.000000] .bss : 0x(ptrval) - 0x(ptrval) ( 247 kB)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000047] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000114] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000656] Console: colour dummy device 80x30
[ 0.000747] Calibrating delay loop... 203.16 BogoMIPS (lpj=1015808)
[ 0.070236] pid_max: default: 32768 minimum: 301
[ 0.070550] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.070595] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.072066] CPU: Testing write buffer coherency: ok
[ 0.073767] Setting up static identity map for 0x80100000 - 0x80100058
[ 0.076322] devtmpfs: initialized
[ 0.082878] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.082952] futex hash table entries: 256 (order: -1, 3072 bytes)
[ 0.083208] pinctrl core: initialized pinctrl subsystem
[ 0.085245] NET: Registered protocol family 16
[ 0.086712] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.088473] cpuidle: using governor menu
[ 0.114357] SCSI subsystem initialized
[ 0.114702] usbcore: registered new interface driver usbfs
[ 0.114850] usbcore: registered new interface driver hub
[ 0.115044] usbcore: registered new device driver usb
[ 0.115473] pps_core: LinuxPPS API ver. 1 registered
[ 0.115503] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[ 0.115565] PTP clock support registered
[ 0.116058] Advanced Linux Sound Architecture Driver Initialized.
[ 0.117600] clocksource: Switched to clocksource timer
[ 0.144110] NET: Registered protocol family 2
[ 0.145537] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.145616] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[ 0.145666] TCP: Hash tables configured (established 1024 bind 1024)
[ 0.145953] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.146013] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.146490] NET: Registered protocol family 1
[ 0.147851] RPC: Registered named UNIX socket transport module.
[ 0.147893] RPC: Registered udp transport module.
[ 0.147909] RPC: Registered tcp transport module.
[ 0.147925] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 0.150136] NetWinder Floating Point Emulator V0.97 (double precision)
[ 0.151954] Initialise system trusted keyrings
[ 0.152487] workingset: timestamp_bits=30 max_order=13 bucket_order=0
[ 0.169929] NFS: Registering the id_resolver key type
[ 0.170015] Key type id_resolver registered
[ 0.170036] Key type id_legacy registered
[ 0.170154] jffs2: version 2.2. (NAND) 漏 2001-2006 Red Hat, Inc.
[ 0.184548] Key type asymmetric registered
[ 0.184591] Asymmetric key parser 'x509' registered
[ 0.184799] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[ 0.184835] io scheduler noop registered
[ 0.184854] io scheduler deadline registered
[ 0.185640] io scheduler cfq registered (default)
[ 0.185674] io scheduler mq-deadline registered
[ 0.185693] io scheduler kyber registered
[ 0.186819] sun4i-usb-phy 1c13400.phy: Couldn't request ID GPIO
[ 0.196449] suniv-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[ 0.367557] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[ 0.374463] console [ttyS0] disabled
[ 0.394721] 1c25000.serial: ttyS0 at MMIO 0x1c25000 (irq = 23, base_baud = 6250000) is a 16550A
[ 0.868350] console [ttyS0] enabled
[ 0.878908] panel-simple panel: panel supply power not found, using dummy regulator
[ 0.888341] SCSI Media Changer driver v0.25
[ 0.893854] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 0.900510] ehci-platform: EHCI generic platform driver
[ 0.906007] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 0.912309] ohci-platform: OHCI generic platform driver
[ 0.918000] usbcore: registered new interface driver usb-storage
[ 0.924967] udc-core: couldn't find an available UDC - added [g_cdc] to list of pending drivers
[ 0.934022] i2c /dev entries driver
[ 0.997727] sunxi-mmc 1c0f000.mmc: base:0x06f7e97f irq:19
[ 1.005147] usbcore: registered new interface driver usbhid
[ 1.010856] usbhid: USB HID core driver
[ 1.032777] NET: Registered protocol family 17
[ 1.037464] Key type dns_resolver registered
[ 1.044107] Loading compiled-in X.509 certificates
[ 1.059720] sun4i-drm display-engine: bound 1e60000.display-backend (ops 0xc0739c38)
[ 1.068621] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops 0xc0738f1c)
[ 1.076287] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 1.083010] [drm] No driver support for vblank timestamp query.
[ 1.137014] Console: switching to colour frame buffer device 60x34
[ 1.160417] sun4i-drm display-engine: fb0: frame buffer device
[ 1.167546] [drm] Initialized sun4i-drm 1.0.0 20150629 for display-engine on minor 0
[ 1.176703] usb_phy_generic usb_phy_generic.0.auto: usb_phy_generic.0.auto supply vcc not found, using dummy regulator
[ 1.188693] musb-hdrc musb-hdrc.1.auto: MUSB HDRC host driver
[ 1.194487] musb-hdrc musb-hdrc.1.auto: new USB bus registered, assigned bus number 1
[ 1.204644] hub 1-0:1.0: USB hub found
[ 1.208698] hub 1-0:1.0: 1 port detected
[ 1.214191] using random self ethernet address
[ 1.218825] using random host ethernet address
[ 1.225043] usb0: HOST MAC 3e:10:47:76:4b:a1
[ 1.229568] usb0: MAC 26:46:97:40:41:40
[ 1.233565] g_cdc gadget: CDC Composite Gadget, version: King Kamehameha Day 2008
[ 1.241128] g_cdc gadget: g_cdc ready
[ 1.245795] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 1.263420] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[ 1.270282] vcc3v3: disabling
[ 1.273267] ALSA device list:
[ 1.276232] #0: Loopback 1
[ 1.280065] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 1.288815] cfg80211: failed to load regulatory.db
[ 1.294340] Waiting for root device /dev/mtdblock3...
[ 202.987720] random: crng init done
@晕哥 这是怎么回事?
dd if=/dev/zero of=flashimg.bin bs=1M count=16 &&\
dd if=$YOUR_UBOOT_FILE of=flashimg.bin bs=1K conv=notrunc &&\
dd if=$YOUR_DTB_FILE of=flashimg.bin bs=1K seek=1024 conv=notrunc &&\
dd if=$YOUR_KERNEL_FILE of=flashimg.bin bs=1K seek=1088 conv=notrunc &&\
mkdir rootfs
tar -xzvf $YOUR_ROOTFS_FILE -C ./rootfs &&\
cp -r $YOUR_MOD_FILE rootfs/lib/modules/ &&\
# 为根文件系统制作jffs2镜像包
# --pad参数指定 jffs2大小
# 由此计算得到 0x1000000(16M)-0x10000(64K)-0x100000(1M)-0x400000(4M)=0xAF0000
mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0xAF0000 -d rootfs/ -o jffs2.img &&\
dd if=jffs2.img of=$YOUR_IMG_FILE bs=1K seek=5184 conv=notrunc &&\
@晕哥 cp -r $YOUR_MOD_FILE rootfs/lib/modules/ YOUR_MOD_FILE这个是什么文件? 做启动文件系统需要用这个吗?
你是从git clone --depth=1 -b f1c100s-480272lcd-test https://github.com/Icenowy/linux.git
下载的吗
sun8i-r40-bananapi-m2-ultra.dts
sun8i-r40.dtsi
sun8i-reference-design-tablet.dtsi
sun8i-v3s.dtsi
sun8i-v3s-licheepi-zero-dock.dts
sun8i-v3s-licheepi-zero.dts
sun8i-v40-bananapi-m2-berry.dts
sun9i-a80-cubieboard4.dts
sun9i-a80.dtsi
sun9i-a80-optimus.dts
suniv.dtsi
suniv-f1c100s.dtsi
suniv-f1c100s-licheepi-nano.dts
sunxi-common-regulators.dtsi
sunxi-h3-h5.dtsi
sunxi-itead-core-common.dtsi
sunxi-reference-design-tablet.dtsi
tango4-common.dtsi
tango4-smp8758.dtsi
tango4-vantage-1172.dts
tegra114-dalmore.dts
tegra114.dtsi
tegra114-roth.dts
tegra114-tn7.dts
http://nano.lichee.pro/build_sys/kernel.html
按这个一步一步走就可以了,我刚刚就是在干净的环境编译的
我就是 按这个步骤来的
dd if=/dev/zero of=flashimg.bin bs=16M count=1
dd if=../ubootmainline/u-boot/u-boot-sunxi-with-spl.bin of=flashimg.bin bs=1K conv=notrunc
dd if=../zero41y/linux-zero-4.10.y/arch/arm/boot/dts/sun8i-v3s-licheepi-zero-dock.dtb of=flashimg.bin bs=1K seek=1024 conv=notrunc
dd if=../zero41y/linux-zero-4.10.y/arch/arm/boot/zImage of=flashimg.bin bs=1K seek=1088 conv=notrunc
dd if=../zero_imager/jffs2/jffs2.img of=flashimg.bin bs=1K seek=5184 conv=notrunc
按上面打包,为什么我打包出来的bin文件有105M多呢?
修改内核源码目录下的 ./arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts
&spi0 {
pinctrl-names = "default";
pinctrl-0 = <&spi0_pins_a>;
status = "okay";
spi-max-frequency = <50000000>;
flash: w25q128@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "winbond,w25q128", "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <50000000>;
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x000000 0x100000>;
read-only;
};
partition@100000 {
label = "dtb";
reg = <0x100000 0x10000>;
read-only;
};
partition@110000 {
label = "kernel";
reg = <0x110000 0x400000>;
read-only;
};
partition@510000 {
label = "rootfs";
reg = <0x510000 0xAF0000>;
};
};
};
};
添加这个就这样了
RAM: 32 MiB
Trying to boot from MMC1
Card did not respond to voltage select!
mmc_init: -95, time 22
spl: mmc init failed with error: -95
Trying to boot from sunxi SPI
U-Boot 2018.01-05676-g0018878-dirty (Aug 02 2018 - 20:35:23 +0800) Allwinner Technology
CPU: Allwinner F Series (SUNIV)
Model: Lichee Pi Nano
DRAM: 32 MiB
MMC: SUNXI SD/MMC: 0
SF: Detected w25q128bv with page size 256 Bytes, erase size 4 KiB, total 16 MiB
*** Warning - bad CRC, using default environment
Setting up a 480x272 lcd console (overscan 0x0)
In: serial@1c25000
Out: serial@1c25000
Err: serial@1c25000
Net: No ethernet found.
starting USB...
No controllers found
Hit any key to stop autoboot: 2 1 0
spi_flash@0:50000000: failed to activate chip-select 50000000
SF: error -2 reading JEDEC ID
Failed to initialize SPI flash at 0:50000000 (error -2)
No SPI flash selected. Please run `sf probe'
No SPI flash selected. Please run `sf probe'
=>
这是u-boot 启动信息,烧u-boot就可以看到串口有输出,SPIflash打包烧录串口一点信息就没有输出
就是按照二进制bin 打包
以16M 大小flash镜像打包脚本为例:
dd if=/dev/zero of=flashimg.bin bs=1M count=16 &&\
dd if=$YOUR_UBOOT_FILE of=flashimg.bin bs=1K conv=notrunc &&\
dd if=$YOUR_DTB_FILE of=flashimg.bin bs=1K seek=1024 conv=notrunc &&\
dd if=$YOUR_KERNEL_FILE of=flashimg.bin bs=1K seek=1088 conv=notrunc &&\
mkdir rootfs
tar -xzvf $YOUR_ROOTFS_FILE -C ./rootfs &&\
cp -r $YOUR_MOD_FILE rootfs/lib/modules/ &&\
# 为根文件系统制作jffs2镜像包
# --pad参数指定 jffs2大小
# 由此计算得到 0x1000000(16M)-0x10000(64K)-0x100000(1M)-0x400000(4M)=0xAF0000
mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0xAF0000 -d rootfs/ -o jffs2.img &&\
dd if=jffs2.img of=$YOUR_IMG_FILE bs=1K seek=5184 conv=notrunc &&\生产启动文件,串口就没有输出
二进制bin 打包
以16M 大小flash镜像打包脚本为例:
dd if=/dev/zero of=flashimg.bin bs=1M count=16 &&\
dd if=$YOUR_UBOOT_FILE of=flashimg.bin bs=1K conv=notrunc &&\
dd if=$YOUR_DTB_FILE of=flashimg.bin bs=1K seek=1024 conv=notrunc &&\
dd if=$YOUR_KERNEL_FILE of=flashimg.bin bs=1K seek=1088 conv=notrunc &&\
mkdir rootfs
tar -xzvf $YOUR_ROOTFS_FILE -C ./rootfs &&\
cp -r $YOUR_MOD_FILE rootfs/lib/modules/ &&\
# 为根文件系统制作jffs2镜像包
# --pad参数指定 jffs2大小
# 由此计算得到 0x1000000(16M)-0x10000(64K)-0x100000(1M)-0x400000(4M)=0xAF0000
mkfs.jffs2 -s 0x100 -e 0x10000 --pad=0xAF0000 -d rootfs/ -o jffs2.img &&\
dd if=jffs2.img of=$YOUR_IMG_FILE bs=1K seek=5184 conv=notrunc &&\
以上脚本通过对一个生成的16M空bin文件填充 uboot、dtb、kernel、rootfs 生成 16M 镜像,如需修改,请注意各个文件的大小,修改成对应地址(注意对齐)。
怎么烧进FLASH 启动不了?
不久把ucgui-3.90a移植到了Linux下,还是写个总结吧。。。
ucgui的可移植性很高,只需要做很少的改动就可以移植到各个平台,移植到Linux下也一样。
首先编辑GUIConf.h这个文件:
#ifndef GUICONF_H
#define GUICONF_H
#define GUI_OS (1) /* Compile with multitasking support */
#define GUI_SUPPORT_TOUCH (0) /* Support a touch screen (req. win-manager), for linux */
#define GUI_SUPPORT_UNICODE (1) /* Support mixed ASCII/UNICODE strings, for linux */
#define GUI_DEFAULT_FONT &GUI_Font6x8
#define GUI_ALLOC_SIZE 25*1024 /* Size of dynamic memory */
#define GUI_SUPPORT_CURSOR (1) /* for linux*/
#define GUI_WINSUPPORT 1 /* Window manager package available */
#define GUI_SUPPORT_MEMDEV 1 /* Memory devices available */
#define GUI_SUPPORT_AA 1 /* Anti aliasing available */
#endif /* Avoid multiple inclusion */
接着修改LCDConf.h文件,因为我们直接使用framebuffer设备,所以只需要修改LCDConf.h文件的前面部分即可:
#define LCD_XSIZE (720) /* X-resolution of LCD, Logical coor. for linux */
#define LCD_YSIZE (576) /* Y-resolution of LCD, Logical coor. for linux */
#define LCD_BITSPERPIXEL (16) /* for linux */
#define LCD_SWAP_RB (1) /* for linux, actually 1555 format */
#define LCD_FIXEDPALETTE (555) /* for linux, actually 1555 format */
#define LCD_CONTROLLER (-1) /* for linux */
接下来修改LCDDummy.c,添加对framebuffer的支持:
/* for linux framebuffer */
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <linux/fb.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
static struct fb_var_screeninfo vinfo;
static struct fb_fix_screeninfo finfo;
static char *pFrameBuffer = NULL;
........................................................
void LCD_L0_SetPixelIndex(int x, int y, int PixelIndex)
{
/* Convert logical into physical coordinates (Dep. on LCDConf.h) */
#if LCD_SWAP_XY | LCD_MIRROR_X| LCD_MIRROR_Y
int xPhys = LOG2PHYS_X(x, y);
int yPhys = LOG2PHYS_Y(x, y);
#else
#define xPhys x
#define yPhys y
#endif
int location = 0;
location = (x + vinfo.xoffset) * (vinfo.bits_per_pixel >> 3) + (y+vinfo.yoffset) * finfo.line_length;
*(short*)(pFrameBuffer + location) = (short)PixelIndex; /* 16bpp */
return;
}
unsigned int LCD_L0_GetPixelIndex(int x, int y)
{
LCD_PIXELINDEX PixelIndex;
/* Convert logical into physical coordinates (Dep. on LCDConf.h) */
#if LCD_SWAP_XY | LCD_MIRROR_X| LCD_MIRROR_Y
int xPhys = LOG2PHYS_X(x, y);
int yPhys = LOG2PHYS_Y(x, y);
#else
#define xPhys x
#define yPhys y
#endif
/* Read from hardware ... Adapt to your system */
{
int location = 0;
location = (x + vinfo.xoffset) * (vinfo.bits_per_pixel >> 3) + (y+vinfo.yoffset) * finfo.line_length;
PixelIndex = *(short*)(pFrameBuffer + location); /* 16bpp */
}
return PixelIndex;
}
....................................................
int LCD_L0_Init(void)
{
int f_fbDev;
int ScreenSize;
static struct fb_bitfield g_r16 = {10, 5, 0};
static struct fb_bitfield g_g16 = {5, 5, 0};
static struct fb_bitfield g_b16 = {0, 5, 0};
static struct fb_bitfield g_a16 = {15, 1, 0};
f_fbDev = open("/dev/fb0", O_RDWR);
if (f_fbDev <= 0)
{
printf("Error: cannot open framebuffer device.\n");
return (-1);
}
if (ioctl(f_fbDev, FBIOGET_VSCREENINFO, &vinfo) < 0)
{
printf("Error reading variable information.\n");
close(f_fbDev);
return (-1);
}
vinfo.xres = vinfo.xres_virtual = 720;
vinfo.yres = 576;
vinfo.yres_virtual = 576*2;
vinfo.transp= g_a16;
vinfo.red = g_r16;
vinfo.green = g_g16;
vinfo.blue = g_b16;
vinfo.bits_per_pixel = 16;
if (ioctl(f_fbDev, FBIOPUT_VSCREENINFO, &vinfo) < 0)
{
printf("Put variable screen info failed!\n");
close(f_fbDev);
return -1;
}
if (ioctl(f_fbDev, FBIOGET_FSCREENINFO, &finfo))
{
printf("Error reading fixed information.\n");
return -1;
}
printf("xres is %d\n, yres is %d\n", vinfo.xres, vinfo.yres);
ScreenSize = vinfo.xres * vinfo.yres * (vinfo.bits_per_pixel >> 3);
pFrameBuffer =(char *)mmap(0, ScreenSize, PROT_READ | PROT_WRITE, MAP_SHARED,f_fbDev, 0);
if ((long)pFrameBuffer == -1)
{
printf("Error: failed to map framebuffer device to memory.\n");
close(f_fbDev);
return (-1);
}
return 0;
}
至此,LCDDummy.c修改完毕。
接下来添加鼠标支持,新建一个GUI_MOUSE_DriverLinux.c代替原来的GUI_MOUSE_DriverPS2.c,这里的思路是用一个线程来读取鼠标设备:
.................................................
void *ThreadReamMouse(void)
{
int ret;
int fd;
fd_set readfs;
int maxfd = 0;
char temp[3];
fd = open ("/dev/mouse0",O_RDWR);
if (fd < 0)
{
printf ("%s open failed\n", "/dev/mouse0");
return NULL;
}
printf("open %s success, fd is %d\n", "/dev/mouse0", fd);
maxfd = fd + 1;
for (; ;)
{
FD_ZERO(&readfs);
FD_SET(fd, &readfs);
ret = select(maxfd, &readfs, NULL, NULL, NULL);
if (ret < 0)
{
printf("select failure!\n");
return NULL;
}
if (FD_ISSET(fd, &readfs))
{
/*
* 读取鼠标
*/
_NumBytesInBuffer = read(fd, _abInBuffer, sizeof(_abInBuffer));
if ((_NumBytesInBuffer == 3) && ((_abInBuffer[0] & 0x0c) == 0x08))
{
_EvaPacket();
//printf("Get mouse data!\n");
}
}
}
}
void GUI_MOUSE_DRIVER_PS2_Init(void)
{
pthread_t pidReadMouse;
_NumBytesInBuffer = 0;
pthread_create(&pidReadMouse, NULL, (void *)ThreadReamMouse, NULL);
printf("Create thread sucess!\n");
}
GUI_MOUSE_DRIVER_PS2_Init()函数需要在哪里调用呢?不调用的话,鼠标没法用啊。增加GUI_X_Linux.c文件:
.............................................................
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
..............................................................
void GUI_X_ExecIdle(void)
{
usleep(1000);
return;
}
int GUI_X_GetTime(void)
{
struct timeval tv;
int tm;
gettimeofday(&tv, NULL);
tm = tv.tv_sec*1024 + tv.tv_usec/1024;
return tm;
}
void GUI_X_Delay(int Period)
{
while(Period--)
{
usleep(1000);
}
return;
}
void GUI_X_Unlock(void)
{
pthread_mutex_unlock(&mutex);
return;
}
void GUI_X_Lock(void)
{
pthread_mutex_lock(&mutex);
return;
}
U32 GUI_X_GetTaskId(void)
{
pthread_t id;
id = pthread_self();
printf("GUI_X_GetTaskId %d \n", (U32)id);
return ((U32)id);
}
void GUI_X_InitOS(void)
{
printf("GUI_X_InitOS\n");
GUI_MOUSE_DRIVER_PS2_Init(); /* create read mouse thread for linux */
return;
}
.....................................................
至此,该修改的文件都修改完毕了,可以开始编译了。但是ucgui的工程一般是在windows下编译的,在Linux下交叉编译需要写Makefile,按照Linux的惯例,在每个文件夹下增加Makefile,如下:
CC = arm-linux-gcc
CFLAGS=-I../Core -I../../Config/ -I../WM/
#all c files at current directory
SRCS:=$(wildcard *.c)
#replace .c to .o in SRCS
OBJS:=$(SRCS:%.c=%.o)
all:$(OBJS)
%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
.PHONY : clean
clean:
rm *.o
再增加一个编译gui库的Makefile:
SUBDIRS=AntiAlias ConvertMono Font LCDDriver MemDev Widget ConvertColor Core JPEG MultiLayer WM
LIBOBJS=
LIBOBJS+=$(wildcard AntiAlias/*.o)
LIBOBJS+=$(wildcard ConvertMono/*.o)
LIBOBJS+=$(wildcard Font/*.o)
LIBOBJS+=$(wildcard LCDDriver/*.o)
LIBOBJS+=$(wildcard MemDev/*.o)
LIBOBJS+=$(wildcard ConvertColor/*.o)
LIBOBJS+=$(wildcard Core/*.o)
LIBOBJS+=$(wildcard JPEG/*.o)
LIBOBJS+=$(wildcard MultiLayer/*.o)
LIBOBJS+=$(wildcard WM/*.o)
LIBOBJS+=$(wildcard Widget/*.o)
all:
for name in $(SUBDIRS); do (cd $$name && make && cd ../) done
make guilib
.PHONY:guilib
guilib:
arm-linux-ar rv libucgui.a $(LIBOBJS)
.PHONY:clean
clean:
@rm -f libucgui.a
@for name in $(SUBDIRS); do (cd $$name && make clean && cd ../) done
至此,整个移植过程就告一段落,直接make 就可以了。。。
这样正确吗
页次: 1