Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ apt-get install -y git rsync build-essential cmake device-tree-compiler bc binut
git config --global http.version HTTP/1.1
git config --global http.postBuffer 157286400
cd buildroot
make BR2_EXTERNAL=../ext_tree luckfox_pico_max_defconfig
make BR2_EXTERNAL=../ext_tree luckfox_pico_ultra_defconfig
export FORCE_UNSAFE_CONFIGURE=1
export LIBCLANG_PATH=/usr/lib/llvm-14/lib
export CLANG_PATH=/usr/bin/clang
export BINDGEN_EXTRA_CLANG_ARGS="--sysroot=`pwd`/output/host/arm-buildroot-linux-gnueabihf/sysroot"
rm -rf output/image/* ; rm -rf output/target ; find output/ -name ".stamp*installed" -delete ; rm -f output/build/host-gcc-final-*/.stamp_host_installed
rm -rf output/target ; find output/ -name ".stamp_target_installed" -delete ; rm -f output/build/host-gcc-final-*/.stamp_host_installed
make


Expand Down
5 changes: 5 additions & 0 deletions buildroot/board/luckfox-pico/common/post-image.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/sh

# Copy tidal.sqfs to images directory for flashing
if [ -f "/tmp/tidal.sqfs" ]; then
cp /tmp/tidal.sqfs $BINARIES_DIR/
fi

mv -f $BINARIES_DIR/rootfs.ubi $BINARIES_DIR/rootfs.img 2>/dev/null
mv -f $BINARIES_DIR/uboot-env.bin $BINARIES_DIR/env.img 2>/dev/null
rm -f $BINARIES_DIR/*.dtb
Expand Down
1 change: 1 addition & 0 deletions ext_tree/Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ menu "Custom packages"
source "../ext_tree/package/squeezeliteR2/Config.in"
source "../ext_tree/package/status-monitor/Config.in"
source "../ext_tree/package/qobuz-connect/Config.in"
source "../ext_tree/package/tidal-connect/Config.in"
endmenu
4 changes: 4 additions & 0 deletions ext_tree/board/luckfox/config/uboot-env.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
blkdevparts=mmcblk0:32K(env),512K@32K(idblock),256K(uboot),32M(boot),512M(oem),256M(userdata),6G(rootfs)
sys_bootargs= root=/dev/mmcblk0p7 rootfstype=ext4 rk_dma_heap_cma=24M
sd_parts=mmcblk0:16K@512(env),512K@32K(idblock),4M(uboot)
bootcmd=mmc dev ${devnum}; fatload mmc ${devnum}:5 ${kernel_addr_r} zImage; fatload mmc ${devnum}:5 ${fdt_addr_r} rv1106_pll.dtb; bootz ${kernel_addr_r} - ${fdt_addr_r}
5 changes: 5 additions & 0 deletions ext_tree/board/luckfox/dts_max/rv1106-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,11 @@ i2s0_8ch {
/* gpio1_d3 */
<1 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up_drv_level_2>;
};
mute_inv_gpio: mute-inv-gpio {
rockchip,pins =
/* gpio2_a5 - Inverted mute signal (pin 69) */
<2 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
};
dsd_on_gpio: dsd-on-gpio {
rockchip,pins =
/* gpio1_d0 - DSD_ON signal */
Expand Down
2 changes: 2 additions & 0 deletions ext_tree/board/luckfox/dts_max/rv1106_512_ext-ipc.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ i2s0_8ch: i2s@ffae0000 {
rockchip,cru = <&cru>;
rockchip,grf = <&grf>;
mute-gpios = <&gpio1 RK_PD3 GPIO_ACTIVE_HIGH>;
mute-inv-gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>;
dsd-enable-gpios = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&i2s0_lrck
Expand All @@ -81,6 +82,7 @@ i2s0_8ch: i2s@ffae0000 {
&i2s0_sdo2_sdi2
&i2s0_sdo3_sdi1
&mute_gpio
&mute_inv_gpio
&dsd_on_gpio
&mclk_sel_gpio>;
status = "disable";
Expand Down
2 changes: 1 addition & 1 deletion ext_tree/board/luckfox/dts_max/rv1106_512_ext.dts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

/**********EMMC*************/
&emmc {
status = "disable";
status = "okay";
};

/**********ETH**********/
Expand Down
2 changes: 2 additions & 0 deletions ext_tree/board/luckfox/dts_max/rv1106_ext-ipc.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ i2s0_8ch: i2s@ffae0000 {
rockchip,cru = <&cru>;
rockchip,grf = <&grf>;
mute-gpios = <&gpio1 RK_PD3 GPIO_ACTIVE_HIGH>;
mute-inv-gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>;
dsd-enable-gpios = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&i2s0_lrck
Expand All @@ -81,6 +82,7 @@ i2s0_8ch: i2s@ffae0000 {
&i2s0_sdo2_sdi2
&i2s0_sdo3_sdi1
&mute_gpio
&mute_inv_gpio
&dsd_on_gpio
&mclk_sel_gpio>;
status = "disable";
Expand Down
2 changes: 1 addition & 1 deletion ext_tree/board/luckfox/dts_max/rv1106_ext.dts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

/**********EMMC*************/
&emmc {
status = "disable";
status = "okay";
};

/**********ETH**********/
Expand Down
2 changes: 2 additions & 0 deletions ext_tree/board/luckfox/dts_max/rv1106_pll-ipc.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
rockchip,volume-max = <100>;
rockchip,volume-default = <100>;
mute-gpios = <&gpio1 RK_PD3 GPIO_ACTIVE_HIGH>;
mute-inv-gpios = <&gpio2 RK_PA5 GPIO_ACTIVE_HIGH>;
dsd-enable-gpios = <&gpio1 RK_PD0 GPIO_ACTIVE_HIGH>;
pinctrl-names = "default";
pinctrl-0 = <&i2s0_lrck
Expand All @@ -58,6 +59,7 @@
&i2s0_sdo2_sdi2
&i2s0_sdo3_sdi1
&mute_gpio
&mute_inv_gpio
&dsd_on_gpio>;
status = "okay";
};
Expand Down
2 changes: 1 addition & 1 deletion ext_tree/board/luckfox/dts_max/rv1106_pll.dts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

/**********EMMC*************/
&emmc {
status = "disable";
status = "okay";
};

/**********ETH**********/
Expand Down
5 changes: 4 additions & 1 deletion ext_tree/board/luckfox/rootfs_overlay/etc/fstab
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# <file system> <mount pt> <type> <options> <dump> <pass>
/dev/root / ext2 rw,noauto 0 1
/dev/root / ext4 rw,noauto 0 1
/dev/mmcblk0p6 /data ext4 rw,relatime 0 0
/dev/mmcblk0p5 /boot vfat defaults 0 0
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620,ptmxmode=0666 0 0
debugfs /sys/kernel/debug debugfs defaults 0 0
tmpfs /dev/shm tmpfs mode=1777 0 0
tmpfs /tmp tmpfs mode=1777 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
Expand Down
2 changes: 1 addition & 1 deletion ext_tree/board/luckfox/rootfs_overlay/etc/fw_env.config
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/dev/mtd0 0x0 0x40000 0x20000
/dev/mmcblk0 0x0 0x8000 0x200 64
11 changes: 10 additions & 1 deletion ext_tree/board/luckfox/rootfs_overlay/etc/i2s.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,13 @@ MCLK=512
MODE=pll

### std, lr, plr, 8ch ######
SUBMODE=std
SUBMODE=std

### PCM channel swap: 0 or 1 ###
PCM_SWAP=0

### DSD physical swap: 0 or 1 ###
DSD_SWAP=1

### Frequency domain swap (44/48): 0 or 1 ###
FREQ_SWAP=0
30 changes: 25 additions & 5 deletions ext_tree/board/luckfox/rootfs_overlay/etc/init.d/S01RkLunch
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#!/bin/sh

# Find mixer control with playback volume and switch capabilities
MIXER=$(amixer 2>/dev/null | awk '
/^Simple mixer control/ {
control = $0
gsub(/.*'\''/, "", control)
gsub(/'\''.*/, "", control)
}
/Capabilities:/ && /pvolume/ && /pswitch/ {
print control
exit
}
')
# Fallback to first available control if none found
[ -z "$MIXER" ] && MIXER=$(amixer 2>/dev/null | awk -F "'" 'NR==1 {print $2; exit}')

echo 1 > /sys/devices/platform/ffae0000.i2s/mute
MIXER=`amixer 2>/dev/null| awk -F "'" 'NR==1 {print $2; exit}'`
/usr/bin/amixer set "$MIXER" mute
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" mute 2>/dev/null

if [ -f /data/ethaddr.txt ]; then
MAC=`cat /data/ethaddr.txt`
Expand All @@ -23,10 +37,16 @@ MIXER=`amixer 2>/dev/null| awk -F "'" 'NR==1 {print $2; exit}'`
/sbin/ifconfig eth0 up && /sbin/udhcpc -i eth0

grep MCLK=1024 /etc/i2s.conf && echo 1024 > /sys/devices/platform/ffae0000.i2s/mclk_multiplier
echo 100 > /sys/devices/platform/ffae0000.i2s/premute_delay_ms
echo 300 > /sys/devices/platform/ffae0000.i2s/postmute_delay_ms
echo 1 > /sys/devices/platform/ffae0000.i2s/dsd_physical_swap
echo 0 > /sys/devices/platform/ffae0000.i2s/pcm_channel_swap

PCM_SWAP=$(grep '^PCM_SWAP=' /etc/i2s.conf | cut -d'=' -f2 | tr -d '[:space:]')
[ -n "$PCM_SWAP" ] && echo "$PCM_SWAP" > /sys/devices/platform/ffae0000.i2s/pcm_channel_swap || echo 0 > /sys/devices/platform/ffae0000.i2s/pcm_channel_swap

DSD_SWAP=$(grep '^DSD_SWAP=' /etc/i2s.conf | cut -d'=' -f2 | tr -d '[:space:]')
[ -n "$DSD_SWAP" ] && echo "$DSD_SWAP" > /sys/devices/platform/ffae0000.i2s/dsd_physical_swap || echo 1 > /sys/devices/platform/ffae0000.i2s/dsd_physical_swap

FREQ_SWAP=$(grep '^FREQ_SWAP=' /etc/i2s.conf | cut -d'=' -f2 | tr -d '[:space:]')
[ -n "$FREQ_SWAP" ] && echo "$FREQ_SWAP" > /sys/devices/platform/ffae0000.i2s/freq_domain_invert || echo 0 > /sys/devices/platform/ffae0000.i2s/freq_domain_invert


rcS()
Expand Down
7 changes: 7 additions & 0 deletions ext_tree/board/luckfox/rootfs_overlay/etc/init.d/S94ioi2s
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ start() {
exit 1
fi
echo "OK"

# Initialize I2S/MCLK by briefly opening audio device
printf "Initializing I2S/MCLK: "
timeout 1 aplay -D default -f S16_LE -r 44100 /dev/zero 2>/dev/null &
sleep 0.3
killall aplay 2>/dev/null
echo "OK"
}

stop() {
Expand Down
8 changes: 5 additions & 3 deletions ext_tree/board/luckfox/rootfs_overlay/etc/rc.pure/S95aplayer
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#!/bin/sh

MIXER=`sed 's/,.*//' /tmp/mixer_control_cache`

start() {
touch /var/log/aplayer.log
ln -s -f /var/log/aplayer.log /usr/aprenderer/aplayer.log
printf "Starting APlayer: "
cd /usr/aplayer; nice -n -30 ./aplayer > /dev/null 2>&1 && echo "OK" || echo "FAIL"
sleep 0.5
if [ -f /tmp/mixer_control_cache ]; then
MIXER=$(cat /tmp/mixer_control_cache | cut -d, -f1 | tr -d "'")
[ -n "$MIXER" ] && amixer set "$MIXER" unmute 2>/dev/null
fi
sync
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" unmute 2>/dev/null
}
stop() {
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" mute 2>/dev/null
killall -9 aplayer
}
restart() {
Expand Down
13 changes: 4 additions & 9 deletions ext_tree/board/luckfox/rootfs_overlay/etc/rc.pure/S95aprenderer
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
#!/bin/sh

MIXER=`sed 's/,.*//' /tmp/mixer_control_cache`

start() {
renice -10 $$
touch /var/log/aprenderer.log
ln -s -f /var/log/aprenderer.log /usr/aprenderer/aprenderer.log
printf "Starting APlayer UPNP: "
cd /usr/aprenderer; ./ap2renderer > /dev/null 2>&1 && echo "OK" || echo "FAIL"
sleep 0.5
pid=$(pidof ap2renderer)
if [ -n "$pid" ]; then
renice -15 $pid
for tid in $(ls /proc/$pid/task/); do
renice -15 $tid
done
if [ -f /tmp/mixer_control_cache ]; then
MIXER=$(cat /tmp/mixer_control_cache | cut -d, -f1 | tr -d "'")
[ -n "$MIXER" ] && amixer set "$MIXER" unmute 2>/dev/null
fi
sync
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" unmute 2>/dev/null
}
stop() {
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" mute 2>/dev/null
killall -9 ap2renderer
}
restart() {
Expand Down
7 changes: 4 additions & 3 deletions ext_tree/board/luckfox/rootfs_overlay/etc/rc.pure/S95apscream
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/sh

MIXER=`sed 's/,.*//' /tmp/mixer_control_cache`

start() {
touch /var/log/apscream.log
ln -s -f /var/log/apscream.log /usr/apscream/apscream.log
printf "Starting APscream: "
cd /usr/apscream; ./apscream > /dev/null 2>&1 && echo "OK" || echo "FAIL"
sleep 0.5
if [ -f /tmp/mixer_control_cache ]; then
MIXER=$(cat /tmp/mixer_control_cache | cut -d, -f1 | tr -d "'")
[ -n "$MIXER" ] && amixer set "$MIXER" unmute 2>/dev/null
fi
sync
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" unmute 2>/dev/null
}
stop() {
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" mute 2>/dev/null
killall -9 apscream
}
restart() {
Expand Down
14 changes: 4 additions & 10 deletions ext_tree/board/luckfox/rootfs_overlay/etc/rc.pure/S95mpd
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/sh

MIXER=`sed 's/,.*//' /tmp/mixer_control_cache`

start() {
renice -10 $$
printf "Starting mpd: "
mkdir -p /var/cache/
ln -s /opt/upmpdcli /var/cache/
Expand All @@ -16,17 +15,12 @@ start() {
sleep 0.5
/usr/bin/mpd
sleep 0.5
pid=$(pidof /usr/bin/mpd)
if [ -n "$pid" ]; then
renice -15 $pid
for tid in $(ls /proc/$pid/task/); do
renice -15 $tid
done
if [ -f /tmp/mixer_control_cache ]; then
MIXER=$(cat /tmp/mixer_control_cache | cut -d, -f1 | tr -d "'")
[ -n "$MIXER" ] && amixer set "$MIXER" unmute 2>/dev/null
fi
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" unmute 2>/dev/null
}
stop() {
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" mute 2>/dev/null
killall -9 mpd
killall -9 upmpdcli
}
Expand Down
9 changes: 5 additions & 4 deletions ext_tree/board/luckfox/rootfs_overlay/etc/rc.pure/S95naa
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
#!/bin/sh

MIXER=`sed 's/,.*//' /tmp/mixer_control_cache`

start() {
printf "Starting NAA: "
/usr/sbin/networkaudiod > /dev/null 2>&1 &
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" unmute 2>/dev/null
sleep 0.5
if [ -f /tmp/mixer_control_cache ]; then
MIXER=$(cat /tmp/mixer_control_cache | cut -d, -f1 | tr -d "'")
[ -n "$MIXER" ] && amixer set "$MIXER" unmute 2>/dev/null
fi
}
stop() {
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" mute 2>/dev/null
killall -9 networkaudiod
}
restart() {
Expand Down
26 changes: 5 additions & 21 deletions ext_tree/board/luckfox/rootfs_overlay/etc/rc.pure/S95qobuz
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/sh

MIXER=`sed 's/,.*//' /tmp/mixer_control_cache`

start() {
local mode="$1"
Expand Down Expand Up @@ -96,32 +95,17 @@ start() {
OUTPUT_DEVICE="default"
fi

renice -15 $$
# Start qobuz-connect (no LD_PRELOAD needed, all parameters embedded)
/opt/qobuz-connect/qobuz-connect -o $OUTPUT_DEVICE > /dev/null 2>&1 &
sleep 2

# Set high priority for better audio performance
pid=$(pidof qobuz-connect)
if [ -n "$pid" ]; then
renice -15 $pid 2>/dev/null
for tid in $(ls /proc/$pid/task/ 2>/dev/null); do
renice -15 $tid 2>/dev/null
done
echo "started (PID: $pid)"
else
echo "failed to start"
echo "Error log:"
cat /tmp/qobuz.log 2>/dev/null || echo "No log available"
exit 1
sleep 0.5
if [ -f /tmp/mixer_control_cache ]; then
MIXER=$(cat /tmp/mixer_control_cache | cut -d, -f1 | tr -d "'")
[ -n "$MIXER" ] && amixer set "$MIXER" unmute 2>/dev/null
fi

# Unmute audio output
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" unmute 2>/dev/null || echo "No mixer controls available"
}

stop() {
# Mute audio output
[ -n "$MIXER" ] && /usr/bin/amixer set "$MIXER" mute 2>/dev/null || echo "No mixer controls available"
pid=$(pidof qobuz-connect)
if [ -n "$pid" ]; then
kill -9 $pid
Expand Down
Loading