页次: 1
真不一样,要锁定定kernel的mmc设备才行。
uboot可以跑脚本的,先判断mmc2是否存在,然后可以生成不同的 bootargs,然后再boot
大佬这个脚本写得太刁了:
buildroot-tiny200 (F1C100/200s) 开发包近期更新内容 * 已支持DVP摄像头 *
http://whycan.com/t_5221.html
问题是uboot无法决定kernel怎么挂,挂成什么盘符,你说的貌似需要patch下kernel
https://lore.kernel.org/patchwork/cover/674381/
这个问题我也纠结过,首先我改dts里面mmc别名,发现并没有什么卵用。
最好就是uboot脚本检测,然后生成不同的bootargs
我记得在uboot里面可以自动检测的,但是忘记了怎么改。那堆条件语句有点晕。另外uboot的bootargs的更改貌似也无法检测kernel挂出来的是mmcblk0还是mmcblk1还是mmcblk2,mmcinfo也只能检测当前挂载的mmc,而不是列出所有的mmc.
所以问题来了,不知道什么原因,原来emmc默认是mmcblk2的,rootfs就是mmclbk2p2咯,但是不知道做了什么导致了挂载的emmc从mmcblk2变成了mmcblk1,结果就是rootfs无法挂载,导致机器挂了。
请问各位大佬,有碰到过这个情况不?我想做的是在uboot自动检测(不知道是否可行)或者kernel强制挂成什么分区就好了,或者驱动的时候根据插没插tf卡自动挂载rootfs。
为毛我的问题都没有人回答。。。太简单了各路大神不屑于回答?
kernel setting:
general setup -> system V IPC must on...
# cat .asoundrc
pcm.dmixplug {
type plug
slave {
pcm "dmix"
}
hint {
show on
description "DMix"
}
}
aplay -D dmixplug 1.wav
对了,如果需要和shairport-sync 混音, 需要修改 shairport-sync.conf,alsa的栏,default改成dmixplug就好了,mixer我也改了
之前要从最新的kernel拷贝对应的代码:pinctrl-sun8i-v3s.c, sunxi-ng/ccu-sun8i-v3s.c 注意拷贝完成,如果有PGxx找不到,补充下(代码拷贝更改而已,不解释)
解决过程如下:(拷贝的代码记得是 5.10的 sun4i-i2s.c)
1. 开始没有看见dai_probe是因为没有加载simple-audio-card的ko,蠢死算了,后来跟踪代码发现的。跟踪代码还是si比较好,容易跟踪
2. 跟着就是各种坑了,上面dts的 simple-audio-card,routing 去掉,默认的就好了,否则出错。
3. MCLK设置有问题,理论上是应该 22576000的,结果是2256000了,导致 LRCK计算出来是 7.99导致上面设置出错,sun4i_i2s_get_bclk_div函数,改改
int div = (parent_rate+sampling_rate*word_size) / sampling_rate / word_size / channels;
4. 上面好了就可以用了,但是LRCK不对,因为DTS dai-tdm-slot-width = <32>; 这个没鬼用,要改 sun8i_i2s_set_chan_cfg函数
//lrck_period = params_physical_width(params);
lrck_period = 32;
好了,结束了。
数字音响的一些知识,可以关注下微信公众号:全数字化音响
最新进展了
[ 50.462795] asoc-simple-card sound_i2s: pcm5102a-hifi <-> 1c22000.i2s0 mapping ok
[ 85.650446] sun4i-i2s 1c22000.i2s0: Unsupported BCLK divider: -22
[ 85.659638] sun4i-i2s 1c22000.i2s0: ASoC: can't set 1c22000.i2s0 hw params: -22
aplay: set_params:1363: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 44100
PERIOD_TIME: (125011 125012)
PERIOD_SIZE: 5513
PERIOD_BYTES: 22052
PERIODS: 4
BUFFER_TIME: (500045 500046)
BUFFER_SIZE: 22052
BUFFER_BYTES: 88208
TICK_TIME: 0
已经能够挂上了。剩下的问题可以跟踪了。
sound/soc/sunxi/sun4i-i2s.c
static int sun4i_i2s_dai_probe(struct snd_soc_dai *dai)
{
}这个没有调用?
没有,百思不得其解,连时钟和i2s寄存器都没有初始化(可能是dai probe才初始化的)
https://www.kernel.org/doc/Documentation/devicetree/bindings/sound/simple-card.txt
从这里看dts应该是没错
另外sun4i-i2s.c代码测试过从 4.13开始到5.10都不行
i2s0: i2s@1c22000 {
#sound-dai-cells = <0>;
compatible = "allwinner,sun8i-h3-i2s";
reg = <0x01c22000 0x400>;
interrupts = <GIC_SPI 13 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&ccu CLK_BUS_I2S0>, <&ccu CLK_I2S0>;
clock-names = "apb", "mod";
dmas = <&dma 3>, <&dma 3>;
resets = <&ccu RST_BUS_I2S0>;
pinctrl-names = "default";
pinctrl-0 = <&i2s0_pins>;
dma-names = "rx", "tx";
status = "disabled";
//status = "okay";
};
都加了,dai_probe死活没有调用
或者说我怎么查这个?
pcm5102: pcm510x {
compatible = "ti,pcm5102a";
pcm510x,format = "i2s";
#sound-dai-cells = <0>;
};
sound_i2s {
compatible = "simple-audio-card";
simple-audio,name="s3-i2s";
simple-audio-card,format = "i2s";
simple-audio-card,mclk-fs = <256>;
simple-audio-card,routing = "Playback", "DAI0 Playback",
"DAI0 Capture", "Capture";
status = "okay";
simple-audio-card,cpu {
sound-dai = <&i2s0>;
dai-tdm-slot-num = <2>;
dai-tdm-slot-width = <32>;
};
simple-audio-card,codec {
sound-dai = <&pcm5102>;
};
};
请问全志V3s使用荔枝派最新的 linux 4.13-y 分支,如何支持声卡?
http://whycan.com/t_489.html#p1595
(出处:哇酷开发者社区【全志 V3S/F1C100s/X3】)
我的问题不是这个
root@Yotta:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Codec [V3s Audio Codec], device 0: CDC PCM Codec-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
root@YottaBURN:~# aplay hc.wav
aplay: main:788: audio open error: No such device
git主线的代码
或者到 hub.fastgit.org那里直接下载zip,下载完当然要defconfig了
参考网页: http://sunxi.org/Mainline_Kernel_Howto
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sunxi_defconfig
make ARCH=arm menuconfig
然后选择sun8i,就可以编译了。
配合荔枝的uboot,启动没问题,但是有线网络不行。emmc不行,模拟声卡不行(原因不明)
debootstrap --keyring=./debian-release-10.gpg --foreign --verbose --arch=armhf stable rootfs http://ftp2.cn.debian.org/debian
上面的参数:stable表示是当前稳定版本,默认是最新的buster,如果改成buster也没问题,至少到今天stable表示buster,未来几个月也会,但是有更新版本debian发行了,这个stable就会改变成最新的稳定版本代号。请注意
拷贝错了,下载没有问题,在ubuntu解压还有个gpg问题,估计是开发的机器,太多key乱套了。
--------------华丽丽的分割线,上面是在pc上下载的命令,下面是在S3下载的命令 -----------
但是在armhf debian stretch 貌似没有问题。当然如果要避免解压时间戳错误,debootstrap前apt-get install ntpdate && ntpdate ntp1.aliyun.com 同步下时间会更好,注意,以下命令包含解压,完成了rootfs就可以用了,不需要做啥了(加了--forgien需要第二步)
debootstrap stable rootfs http://ftp2.cn.debian.org/debian
I: Retrieving InRelease
I: Checking Release signature
I: Valid Release signature (key id 6D33866EDD8FFA41C0143AEDDCC9EFBF77E11517)
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
------------------------------ debootstrap.log
gpgv: Signature made Sat Feb 8 11:05:38 2020 UTC
gpgv: using RSA key 6D33866EDD8FFA41C0143AEDDCC9EFBF77E11517
gpgv: issuer "debian-release@lists.debian.org"
---------------------------验证
format一个u盘,uboot设置好,启动看到了
Debian GNU/Linux 10 YottaDevelopment ttyS2
忘记设置root密码了。。。无法登陆,验证完成
--------------------------其他问题,自己想办法解决吧,不再回复疑问,也不接受反驳不接受批评
root@YottaBuster:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
---内存使用状态
total used free shared buff/cache available
Mem: 118944 16972 70568 2064 31404 93924
Swap: 0 0 0
一般建议开辟个swap,就不会有什么太大内存不够的崩溃
buster默认去掉了net-tools,所以ifconfig没了,取代的是ip,更强大,不过不熟悉怎么使用
环境:ubuntu 16.04
sudo apt-get install debootstrap
mkdir buster
wget https://ftp-master.debian.org/keys/release-10.asc -qO- | gpg --import --no-default-keyring --keyring ./debian-release-10.gpg
#debootstrap --keyring=./debian-release-10.gpg --variant=minbase buster buster http://ftp.cn.debian.org/debian/
debootstrap --keyring=./debian-release-10.gpg --foreign --verbose --arch=armhf stretch rootfs http://ftp2.cn.debian.org/debian
注意,根据buster说明建议最小内存是 256MB
https://www.debian.org/releases/stable/armhf/ch03s04.en.html
而之前的stretch是128MB
https://www.debian.org/releases/stretch/amd64/ch03s04.html.en
debian镜像列表
https://www.debian.org/mirror/list
如何制作rootfs的基础说明debootstrap
https://wiki.debian.org/Debootstrap
https://linux-sunxi.org/Debootstrap
跟着就要进行第二步了,请参考
https://whycan.cn/t_2666.html
-----------------------------------------
参考链接: Debian 9.9 (stretch) 文件系统制作 by @powerpan
emmc uboot启动的问题,改动的是荔枝的 uboot代码, board.c
主要问题是pin config的问题,nnd这个uboot根本不会去读device tree。修改以下代码后就可以发现emmc了。
#elif defined(CONFIG_MACH_SUN8I) || defined(CONFIG_MACH_SUN50I)
#ifdef CONFIG_MACH_SUN8I_V3S
#define SUN8I_S3_GPC_SDC2 2
/* SDC2: PC0-PC10 by power*/
for (pin = SUNXI_GPC(0); pin <= SUNXI_GPC(10); pin++) {
//sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
sunxi_gpio_set_cfgpin(pin, SUN8I_S3_GPC_SDC2);
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
sunxi_gpio_set_drv(pin, 2);
}
#else
/* SDC2: PC5-PC6, PC8-PC16 */
for (pin = SUNXI_GPC(5); pin <= SUNXI_GPC(6); pin++) {
sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
sunxi_gpio_set_drv(pin, 2);
}
for (pin = SUNXI_GPC(8); pin <= SUNXI_GPC(16); pin++) {
sunxi_gpio_set_cfgpin(pin, SUNXI_GPC_SDC2);
sunxi_gpio_set_pull(pin, SUNXI_GPIO_PULL_UP);
sunxi_gpio_set_drv(pin, 2);
}
#endif
#elif defined(CONFIG_MACH_SUN9I)
另外荔枝的 4.13的内核,emmc死活按照mmc2挂载,需要修改uboot的bootargs,否则没法挂文件系统。
uboot信息:
Hit any key to stop autoboot: 0
=> mmcinfo
Device: SUNXI SD/MMC
Manufacturer ID: 15
OEM: 100
Name: 4FTE4
Tran Speed: 52000000
Rd Block Len: 512
MMC version 5.1
High Capacity: Yes
Capacity: 3.6 GiB
Bus Width: 8-bit
Erase Group Size: 512 KiB
HC WP Group Size: 8 MiB
User Capacity: 3.6 GiB WRREL
Boot Capacity: 4 MiB ENH
RPMB Capacity: 512 KiB ENH
进入系统后信息:
ls /dev/mmc*
/dev/mmcblk2 /dev/mmcblk2boot1 /dev/mmcblk2p2
/dev/mmcblk2boot0 /dev/mmcblk2p1
按楼主的教程, 又失败一次,
还是卡在
3I: Unpacking libxapian30:armhf... W: Failure while installing base packages. This will be re-attempted up to five times. W: See //debootstrap/debootstrap.log for details (possibly the package archive is at fault) W: Failure while installing base packages. This will be re-attempted up to five times. W: See //debootstrap/debootstrap.log for details (possibly the package archive is at fault) W: Failure while installing base packages. This will be re-attempted up to five times. W: See //debootstrap/debootstrap.log for details (possibly the package archive is at fault) W: Failure while installing base packages. This will be re-attempted up to five times. W: See //debootstrap/debootstrap.log for details (possibly the package archive is at fault) W: Failure while installing base packages. This will be re-attempted up to five times. W: See //debootstrap/debootstrap.log for details (possibly the package archive is at fault)
接着换一个网址再试,
debootstrap --foreign --verbose --arch=armhf stretch rootfs http://ftp.de.debian.org/debian
仍然一样, 换一台服务器继续,
还是用楼主提供的服务器地址, 就正常了。
看来服务器这个坑还挺大的.
出现错误继续之前的一步直到没错就行,不用换服务器,偶尔出错而已
0. 准备工作:
sudo apt install qemu-user-static -y
sudo apt install debootstrap -y
mkdir rootfs
1. debootstrap
debootstrap --foreign --verbose --arch=armhf stretch rootfs http://ftp2.cn.debian.org/debian
2.
cd rootfs
mount --bind /dev dev/
mount --bind /sys sys/
mount --bind /proc proc/
mount --bind /dev/pts dev/pts/
cd ..
3.
cp /usr/bin/qemu-arm-static rootfs/usr/bin/
chmod +x rootfs/usr/bin/qemu-arm-static
4. 解压
LC_ALL=C LANGUAGE=C LANG=C chroot rootfs /debootstrap/debootstrap --second-stage --verbose
可以在这个时候
LC_ALL=C LANGUAGE=C LANG=C chroot rootfs
安装任何东西
5.
passwd ###设置root密码
apt-cache clean #删除安装包
exit
rm rootfs/usr/bin/qemu-arm-static
unmount all point 2 did. ---- but all documents not mention this.
6. 在rootfs下面 运行 tar cvzf ../debian9.9.rootfs.gz .
可以生成包,任意解压到文件系统即可
modify /etc/apt/sourc.list
deb http://ftp2.cn.debian.org/debian stretch main
modify /etc/ssh/sshd_config
PermitRootLogin yes
问题解决了,感谢 冰淇琳 icenowy 的 patch,
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
CLK_MMC1下面增加 CLK_MMC2的时钟3行
[CLK_MMC1] = &mmc1_clk.common.hw,
[CLK_MMC1_SAMPLE] = &mmc1_sample_clk.common.hw,
[CLK_MMC1_OUTPUT] = &mmc1_output_clk.common.hw,
[CLK_MMC2] = &mmc2_clk.common.hw,
[CLK_MMC2_SAMPLE] = &mmc2_sample_clk.common.hw,
[CLK_MMC2_OUTPUT] = &mmc2_output_clk.common.hw,
启动能看到
root@LicheePi:~# ls /dev/mmcblk*
/dev/mmcblk0 /dev/mmcblk0p2 /dev/mmcblk2boot0
/dev/mmcblk0p1 /dev/mmcblk2 /dev/mmcblk2boot1
会不会是 IO,寄存器基地址和中断等资源配置不对呢?
我们看看是否可以解决这个问题吧
1. 上面有个地方bus_width应该是8的,没改
2. 修改pinctrl-sun8i-v3s.c
add
SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 4),
SUNXI_FUNCTION(0x0, "gpio_in"),
SUNXI_FUNCTION(0x1, "gpio_out"),
SUNXI_FUNCTION(0x2, "mmc2")), /* D1 */
SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 5),
SUNXI_FUNCTION(0x0, "gpio_in"),
SUNXI_FUNCTION(0x1, "gpio_out"),
SUNXI_FUNCTION(0x2, "mmc2")), /* D2 */
SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 6),
SUNXI_FUNCTION(0x0, "gpio_in"),
SUNXI_FUNCTION(0x1, "gpio_out"),
SUNXI_FUNCTION(0x2, "mmc2")), /* D3 */
SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 7),
SUNXI_FUNCTION(0x0, "gpio_in"),
SUNXI_FUNCTION(0x1, "gpio_out"),
SUNXI_FUNCTION(0x2, "mmc2")), /* D4 */
SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 8),
SUNXI_FUNCTION(0x0, "gpio_in"),
SUNXI_FUNCTION(0x1, "gpio_out"),
SUNXI_FUNCTION(0x2, "mmc2")), /* D5 */
SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 9),
SUNXI_FUNCTION(0x0, "gpio_in"),
SUNXI_FUNCTION(0x1, "gpio_out"),
SUNXI_FUNCTION(0x2, "mmc2")), /* D6 */
SUNXI_PIN(SUNXI_PINCTRL_PIN(C, 10),
SUNXI_FUNCTION(0x0, "gpio_in"),
SUNXI_FUNCTION(0x1, "gpio_out"),
SUNXI_FUNCTION(0x2, "mmc2")), /* D7 */
但是还不能用,说无法复位,发现在sunxi-mmc.c里面出错
[ 2.403310] sunxi-mmc 1c11000.mmc: fatal err reset timeout
[ 2.408816] sunxi_mmc_probe -5
[ 2.412372] sunxi-mmc: probe of 1c11000.mmc failed with error -5
因为 0x1c11000 读到的返回值是2,而不是0
但是测试过,所有的管脚配置都是对的,
0x1c20848, 0x1c2084c管脚设置都是2了
而且在用户态写复位也没问题
busybox devmem 0x1c11000 32 7
busybox devmem 0x1c11000 返回低三位0
页次: 1