Skip to content

Instantly share code, notes, and snippets.

@Michcioperz
Created September 2, 2020 16:27
Show Gist options
  • Save Michcioperz/99b40b861b158e2cbff507288d804c6b to your computer and use it in GitHub Desktop.
Save Michcioperz/99b40b861b158e2cbff507288d804c6b to your computer and use it in GitHub Desktop.
librespot for openwrt netgear r6220
FROM debian:buster
RUN dpkg --add-architecture mipsel && apt-get update && apt-get install -y wget xz-utils
RUN wget https://downloads.openwrt.org/releases/19.07.2/targets/ramips/mt7621/openwrt-sdk-19.07.2-ramips-mt7621_gcc-7.5.0_musl.Linux-x86_64.tar.xz && tar xf openwrt-sdk-*.tar.* && rm openwrt-sdk-*.tar.*
ENV STAGING_DIR=/openwrt-sdk-19.07.2-ramips-mt7621_gcc-7.5.0_musl.Linux-x86_64/staging_dir
ENV PATH=/openwrt-sdk-19.07.2-ramips-mt7621_gcc-7.5.0_musl.Linux-x86_64/staging_dir/toolchain-mipsel_24kc_gcc-7.5.0_musl/bin:/root/.cargo/bin:$PATH:/usr/bin:/bin:/usr/sbin:/sbin
RUN wget https://sh.rustup.rs -O rustup-init && chmod +x rustup-init && ./rustup-init --profile minimal -y
RUN rustup target add mipsel-unknown-linux-musl
RUN apt-get install git --no-install-recommends -y
RUN git clone https://github.com/librespot-org/librespot
WORKDIR librespot
RUN cargo fetch --target mipsel-unknown-linux-musl --locked
RUN mkdir .cargo && echo '[target.mipsel-unknown-linux-musl]\nlinker = "mipsel-openwrt-linux-gcc"' > .cargo/config
RUN apt-get install build-essential -y --no-install-recommends
RUN echo '\n[profile.release]\nlto = "thin"\ndebug = 0\npanic = "abort"\nincremental = false\ncodegen-units = 1\nopt-level = "s"' >> Cargo.toml
RUN cargo build --release --target mipsel-unknown-linux-musl --locked --no-default-features
RUN mipsel-openwrt-linux-strip target/mipsel-unknown-linux-musl/release/librespot
opkg update
opkg install kmod-usb-core kmod-usb-audio kmod-sound-core alsa-utils
amixer sset Speaker 100%
/tmp/librespot --name Router --backend pipe --disable-audio-cache | aplay -f cd -
@humaita-github
Copy link

Hi, I tried the commands you pasted in here, but when running "cargo build ..." I get "error: failed to run custom build command for ring v0.16.20" -- any ideas how to fix this? I couldn't find anything meaningful on Google. I am running Ubuntu 20.04.5 LTS.

@Michcioperz
Copy link
Author

@humaita-github sorry, i haven't used this in two years

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment