summaryrefslogtreecommitdiffstats
path: root/target/linux/omap24xx/base-files/lib/preinit/99_p54spi_eeprom
blob: cd406f42d2826c568463072ec5b61e6ed3606905 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/sh

do_generate_p54spi_eeprom() {
	[ -e /lib/firmware/3826.eeprom ] && return 0

	[ -x /usr/bin/calvaria ] || { echo "p54spi EEPROM: calvaria not found"; return 1; }
	[ -x /usr/bin/cal2p54 ] || { echo "p54spi EEPROM: cal2p54 not found"; return 1; }

	/usr/bin/calvaria -p -n wlan-iq-align -i last /dev/mtdblock1 >/tmp/wlan-iq-align || {
		echo "p54spi EEPROM: Failed to extract wlan-iq-align"
		return 1
	}
	/usr/bin/calvaria -p -n wlan-tx-gen2 -i last /dev/mtdblock1 >/tmp/txgen_file || {
		echo "p54spi EEPROM: Failed to extract wlan-tx-gen2"
		return 1
	}

	/usr/bin/cal2p54 /tmp/txgen_file /tmp/wlan-iq-align >/lib/firmware/3826.eeprom || {
		echo "p54spi EEPROM: Failed to generate EEPROM"
		return 1
	}

	rm -f /tmp/wlan-iq-align /tmp/txgen_file
}

boot_hook_add preinit_mount_root do_generate_p54spi_eeprom