Facing issue in loading UART for Beaglebone debian - linux

I am facing issue in loading uart port for Beaglebone Debian.
Following are my configurations:
I have a beaglebone with Debian OS. I have an sd card with 4 Partitions.
Partition 1 ( mmcblk0p1 ) contains following bootloader configurations:-
/boot/dtbs/4.14.71-ti-r80/am335x-bonegreen-wireless.dtb
/boot/vmlinuz-4.14.71-ti-r80
/boot/uEnv.txt
/boot/initrd.img-4.14.71-ti-r80
/lib/firmware/BB-UART4-00A0.dtbo
/lib/firmware/BB-UART1-00A0.dtbo
/lib/firmware/BB-I2C2-00A0.dtbo
/lib/firmware/AM335X-PRU-UIO-00A0.dtbo
/lib/firmware/BB-BBGW-WL1835-00A0.dtbo
/lib/firmware/BB-BONE-eMMC1-01-00A0.dtbo
/lib/firmware/BB-ADC-00A0.dtbo
/uEnv.txt
Partition 2 ( mmcblk0p2 ) contains the Debian OS.
Partition 3 ( mmcblk0p3 ) contains another Debian OS.
Partition 4 ( mmcblk0p4 ) decides from Which partition to boot?
/uEnv.txt from mmcblk0p1 reads from mmcblk0p4 and decides from which partition to boot.
This is my /uEnv.txt:
rdaddr=0x88080000
initrd_high=0xffffffff
fdt_high=0xffffffff
loadxrd=echo debug: [/boot/initrd.img-${uname_r}] ... ; load mmc 0:1 ${rdaddr} /boot/initrd.img-${uname_r}; setenv rdsize ${filesize}
loaduEnvtxt=load mmc 0:1 ${loadaddr} /boot/uEnv.txt ; env import -t ${loadaddr} ${filesize};
check_dtb=if test -n ${dtb}; then setenv fdtfile ${dtb};fi;
check_uboot_overlays=if test -n ${enable_uboot_overlays}; then setenv enable_uboot_overlays ;fi;
loadall=run loaduEnvtxt; run check_dtb; run check_uboot_overlays; run loadxrd;
rootpart=0:2
flagpart=0:4
bootdir=/boot
bootfile=vmlinuz-4.14.71-ti-r80
console=ttyO0,115200n8
fdtaddr=0x88000000
fdtfile=am335x-bonegreen-wireless.dtb
loadaddr=0x82000000
mmcroot=/dev/mmcblk0p2 ro
mmcrootfstype=ext4 rootwait
mmcargs=setenv bootargs console=${console} ${optargs} ${cape_disable} ${cape_enable} root=${mmcroot} rootfstype=${mmcrootfstype} ${cmdline}
loadfdt=echo debug: [/boot/dtbs/${uname_r}/${fdtfile}] ... ;load mmc 0:1 ${fdtaddr} /boot/dtbs/${uname_r}/${fdtfile}
loadimage=echo debug: [/boot/vmlinuz-${uname_r}] ... ; load mmc 0:1 ${loadaddr} /boot/vmlinuz-${uname_r}
boot_three=setenv rootpart 0:3; setenv mmcroot /dev/mmcblk0p3 ro
findroot=\
if test -e mmc $flagpart three; then \
if test -e mmc $flagpart three_ok; then \
run boot_three; \
elif test ! -e mmc $flagpart three_tried; then \
fatwrite mmc $flagpart $loadaddr three_tried 4; \
run boot_three; \
fi; \
elif test -e mmc $flagpart two; then \
if test ! -e mmc $flagpart two_ok; then \
if test -e mmc $flagpart two_tried; then \
run boot_three; \
else \
fatwrite mmc $flagpart $loadaddr two_tried 4; \
fi; \
fi; \
fi;
uenvcmd=\
run loadall; \
run findroot; \
echo Using root partition ${rootpart}; \
if run loadfdt; then \
echo Loaded ${fdtfile}; \
if run loadimage; then \
run mmcargs; \
bootz ${loadaddr} - ${fdtaddr}; \
fi; \
fi;
In /boot/uEnv.txt I have enabled following Configs:
uname_r=4.14.71-ti-r80
enable_uboot_overlays=1
uboot_overlay_addr0=/lib/firmware/BB-UART4-00A0.dtbo
uboot_overlay_addr1=/lib/firmware/BB-UART1-00A0.dtbo
uboot_overlay_addr2=/lib/firmware/BB-I2C2-00A0.dtbo
uboot_overlay_pru=/lib/firmware/AM335X-PRU-RPROC-4-14-TI-00A0.dtbo
enable_uboot_cape_universal=1
cmdline=coherent_pool=1M net.ifnames=0 quiet
My Boot logs:
U-Boot SPL 2018.09-00002-g0b54a51eee (Sep 10 2018 - 19:41:39 -0500)
Trying to boot from MMC2
Loading Environment from EXT4...
** Unable to use mmc 0:1 for loading the env **
U-Boot 2018.09-00002-g0b54a51eee (Sep 10 2018 - 19:41:39 -0500), Build: jenkins-github_Bootloader-Builder-65
CPU : AM335X-GP rev 2.1
I2C: ready
DRAM: 512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
Reset Source: Power-on reset has occurred.
RTC 32KCLK Source: External.
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from EXT4...
** Unable to use mmc 0:1 for loading the env **
Board: BeagleBone Black
<ethaddr> not set. Validating first E-fuse MAC
BeagleBone Black:
Model: SeeedStudio BeagleBone Green Wireless:
BeagleBone: cape eeprom: i2c_probe: 0x54:
BeagleBone: cape eeprom: i2c_probe: 0x55:
BeagleBone: cape eeprom: i2c_probe: 0x56:
BeagleBone: cape eeprom: i2c_probe: 0x57:
Net: eth0: MII MODE
Could not get PHY for cpsw: addr 0
cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
board_name=[A335BNLT] ...
board_rev=[GW1A] ...
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
60067 bytes read in 6 ms (9.5 MiB/s)
gpio: pin 56 (gpio 56) value is 0
gpio: pin 55 (gpio 55) value is 0
gpio: pin 54 (gpio 54) value is 0
gpio: pin 53 (gpio 53) value is 1
switch to partitions #0, OK
mmc0 is current device
gpio: pin 54 (gpio 54) value is 1
Checking for: /uEnv.txt ...
2628 bytes read in 2 ms (1.3 MiB/s)
gpio: pin 55 (gpio 55) value is 1
Loaded environment from /uEnv.txt
Importing environment from mmc ...
Checking if uenvcmd is set ...
gpio: pin 56 (gpio 56) value is 1
Running uenvcmd ...
2113 bytes read in 3 ms (687.5 KiB/s)
debug: [/boot/initrd.img-4.14.71-ti-r80] ...
4799493 bytes read in 303 ms (15.1 MiB/s)
Using root partition 0:2
debug: [/boot/dtbs/4.14.71-ti-r80/am335x-bonegreen-wireless.dtb] ...
60067 bytes read in 8 ms (7.2 MiB/s)
Loaded am335x-bonegreen-wireless.dtb
debug: [/boot/vmlinuz-4.14.71-ti-r80] ...
10416640 bytes read in 652 ms (15.2 MiB/s)
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Using Device Tree in place at 88000000, end 88011aa2
Starting kernel ...
[ 0.000749] timer_probe: no matching timers found
[ 0.783193] wkup_m3_ipc 44e11324.wkup_m3_ipc: could not get rproc handle
[ 1.073624] omap_voltage_late_init: Voltage driver support not added
[ 1.080550] PM: Cannot get wkup_m3_ipc handle
Question:
Now when I boot into the partition and check for the UART port I am unable to find them.
ls -l /dev/ttyO*
lrwxrwxrwx 1 root root 5 Nov 3 2016 /dev/ttyO0 -> ttyS0
lrwxrwxrwx 1 root root 5 Nov 3 2016 /dev/ttyO2 -> ttyS2
The output I am expecting is:
lrwxrwxrwx 1 root root 5 Nov 3 2016 /dev/ttyO0 -> ttyS0
lrwxrwxrwx 1 root root 5 Nov 3 2016 /dev/ttyO1 -> ttyS1
lrwxrwxrwx 1 root root 5 Nov 3 2016 /dev/ttyO2 -> ttyS2
lrwxrwxrwx 1 root root 5 Nov 3 2016 /dev/ttyO3 -> ttyS3
lrwxrwxrwx 1 root root 5 Nov 3 2016 /dev/ttyO4 -> ttyS4
lrwxrwxrwx 1 root root 5 Nov 3 2016 /dev/ttyO5 -> ttyS5

Related

nfs mounting problem VFS: Unable to mount root fs via NFS

I am not able to mount nfs, my Parameters are like following, it is from bootlin;
setenv bootargs 'console=ttyS0,115200 root=/dev/nfs rw
nfsroot=192.168.0.1:/nfs,nfsvers=3,tcp
ip=192.168.0.100:::::usb0 g_ether.dev_addr=f8:dc:7a:00:00:02
g_ether.host_addr=f8:dc:7a:00:00:01'
setenv bootcmd 'mmc dev 0; devnum=${mmcdev}; setenv devtype mmc;
mmc rescan; run loadimage; run findfdt; run mmcloados'
When I am on uboot console, I called ifconfig command on host, but I couldn't see the network interface. Is it normal?
How can I determine if the mac address is correct?
when I tried to ping, I get "host is not alive" feedback.
Bootlog looks like following;
U-Boot 2021.01-ga6e7892957 (May 14 2021 - 05:06:14 +0000)
CPU : AM335X-GP rev 2.1
Model: TI AM335x BeagleBone Black
DRAM: 512 MiB
WDT: Started with servicing (60s timeout)
NAND: 0 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT... OK
Net: eth2: ethernet#4a100000, eth3: usb_ether
Hit any key to stop autoboot: 0
switch to partitions #0, OK
mmc0 is current device
4944384 bytes read in 325 ms (14.5 MiB/s)
65774 bytes read in 13 ms (4.8 MiB/s)
## Flattened Device Tree blob at 88000000
Booting using the fdt blob at 0x88000000
Loading Device Tree to 8ffec000, end 8ffff0ed ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Linux version 5.10.30-gd85aee3e19 (oe-user#oe-host) (arm-poky-linux-gnueabi-gcc (GCC) 9.3.0, GNU ld (GNU Binutils) 2.34.0.20200220) #1 PREEMPT Fri May 7 18:33:44 UTC 2021
[ 0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] OF: fdt: Machine model: TI AM335x BeagleBone Black
[ 0.000000] Memory policy: Data cache writeback
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 48 MiB at 0x9c800000
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x0000000080000000-0x000000009fefffff]
[ 0.000000] HighMem empty
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080000000-0x000000009fefffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x000000009fefffff]
[ 0.000000] CPU: All CPU(s) started in SVC mode.
[ 0.000000] AM335X ES2.1 (sgx neon)
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 129666
[ 0.000000] Kernel command line: console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.0.1:/nfs,nfsvers=3,tcp ip=192.168.0.100:::::usb0 g_ether.dev_addr=f8:dc:7a:00:00:02 g_ether.host_addr=f8:dc:7a:00:00:01
[ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes, linear)
[ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[ 0.000000] Memory: 452372K/523264K available (10240K kernel code, 692K rwdata, 3336K rodata, 1024K init, 282K bss, 21740K reserved, 49152K cma-reserved, 0K highmem)
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Preemptible hierarchical RCU implementation.
[ 0.000000] rcu: RCU event tracing is enabled.
[ 0.000000] Trampoline variant of Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[ 0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[ 0.000000] IRQ: Found an INTC at 0x(ptrval) (revision 5.0) with 128 interrupts
[ 0.000000] random: get_random_bytes called from start_kernel+0x324/0x4e0 with crng_init=0
[ 0.000000] TI gptimer clocksource: always-on /ocp/interconnect#44c00000/segment#200000/target-module#31000
[ 0.000009] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns
[ 0.000027] clocksource: dmtimer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[ 0.000336] TI gptimer clockevent: 24000000 Hz at /ocp/interconnect#48000000/segment#0/target-module#40000
[ 0.001256] Console: colour dummy device 80x30
[ 0.001333] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)
[ 0.090406] pid_max: default: 32768 minimum: 301
[ 0.090566] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.090581] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[ 0.091421] CPU: Testing write buffer coherency: ok
[ 0.091494] CPU0: Spectre v2: using BPIALL workaround
[ 0.092291] Setting up static identity map for 0x80100000 - 0x80100060
[ 0.092430] rcu: Hierarchical SRCU implementation.
[ 0.092519] EFI services will not be available.
[ 0.092875] devtmpfs: initialized
[ 0.102888] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
[ 0.103133] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[ 0.103157] futex hash table entries: 256 (order: -1, 3072 bytes, linear)
[ 0.106522] pinctrl core: initialized pinctrl subsystem
[ 0.107450] DMI not present or invalid.
[ 0.107895] NET: Registered protocol family 16
[ 0.110073] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.127754] l3-aon-clkctrl:0000:0: failed to disable
[ 0.128925] thermal_sys: Registered thermal governor 'fair_share'
[ 0.128937] thermal_sys: Registered thermal governor 'bang_bang'
[ 0.128952] thermal_sys: Registered thermal governor 'step_wise'
[ 0.128959] thermal_sys: Registered thermal governor 'user_space'
[ 0.129305] cpuidle: using governor ladder
[ 0.129341] cpuidle: using governor menu
[ 1.148982] No ATAGs?
[ 1.149010] hw-breakpoint: debug architecture 0x4 unsupported.
[ 1.172697] iommu: Default domain type: Translated
[ 1.174699] SCSI subsystem initialized
[ 1.175150] mc: Linux media interface: v0.10
[ 1.175194] videodev: Linux video capture interface: v2.00
[ 1.175300] pps_core: LinuxPPS API ver. 1 registered
[ 1.175309] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti#linux.it>
[ 1.175332] PTP clock support registered
[ 1.175391] EDAC MC: Ver: 3.0.0
[ 1.176597] Advanced Linux Sound Architecture Driver Initialized.
[ 1.177941] clocksource: Switched to clocksource dmtimer
[ 1.185160] NET: Registered protocol family 2
[ 1.186139] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 4096 bytes, linear)
[ 1.186177] TCP established hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 1.186218] TCP bind hash table entries: 4096 (order: 2, 16384 bytes, linear)
[ 1.186258] TCP: Hash tables configured (established 4096 bind 4096)
[ 1.186373] UDP hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 1.186394] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes, linear)
[ 1.186536] NET: Registered protocol family 1
[ 1.187084] RPC: Registered named UNIX socket transport module.
[ 1.187101] RPC: Registered udp transport module.
[ 1.187108] RPC: Registered tcp transport module.
[ 1.187114] RPC: Registered tcp NFSv4.1 backchannel transport module.
[ 1.187132] PCI: CLS 0 bytes, default 64
[ 1.188552] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available
[ 1.189793] Initialise system trusted keyrings
[ 1.190087] workingset: timestamp_bits=14 max_order=17 bucket_order=3
[ 1.193778] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 1.194528] NFS: Registering the id_resolver key type
[ 1.194578] Key type id_resolver registered
[ 1.194588] Key type id_legacy registered
[ 1.194676] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[ 1.194689] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[ 1.194734] ntfs: driver 2.1.32 [Flags: R/O].
[ 1.195340] Key type asymmetric registered
[ 1.195357] Asymmetric key parser 'x509' registered
[ 1.195405] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[ 1.195417] io scheduler mq-deadline registered
[ 1.195426] io scheduler kyber registered
[ 1.555186] omap-mailbox 480c8000.mailbox: omap mailbox rev 0x400
[ 1.652454] debugfs: Directory '49000000.dma' with parent 'dmaengine' already present!
[ 1.652500] edma 49000000.dma: TI EDMA DMA engine driver
[ 1.672358] pinctrl-single 44e10800.pinmux: 142 pins, size 568
[ 1.722033] Serial: 8250/16550 driver, 10 ports, IRQ sharing enabled
[ 1.726383] printk: console [ttyS0] disabled
[ 1.726571] 44e09000.serial: ttyS0 at MMIO 0x44e09000 (irq = 20, base_baud = 3000000) is a 8250
[ 2.375855] printk: console [ttyS0] enabled
[ 2.382982] omap_rng 48310000.rng: Random Number Generator ver. 20
[ 2.389283] random: fast init done
[ 2.392908] random: crng init done
[ 2.414615] brd: module loaded
[ 2.424526] loop: module loaded
[ 2.432117] libphy: Fixed MDIO Bus: probed
[ 2.497968] davinci_mdio 4a101000.mdio: davinci mdio revision 1.6, bus freq 1000000
[ 2.505680] libphy: 4a101000.mdio: probed
[ 2.512049] davinci_mdio 4a101000.mdio: phy[0]: device 4a101000.mdio:00, driver SMSC LAN8710/LAN8720
[ 2.521681] cpsw 4a100000.ethernet: initialized cpsw ale version 1.4
[ 2.528155] cpsw 4a100000.ethernet: ALE Table size 1024
[ 2.533505] cpsw 4a100000.ethernet: cpts: overflow check period 500 (jiffies)
[ 2.540829] cpsw 4a100000.ethernet: Detected MACID = 6c:ec:eb:ab:52:64
[ 2.549619] i2c /dev entries driver
[ 2.555585] cpuidle: enable-method property 'ti,am3352' found operations
[ 2.563165] sdhci: Secure Digital Host Controller Interface driver
[ 2.569503] sdhci: Copyright(c) Pierre Ossman
[ 2.574856] sdhci-pltfm: SDHCI platform and OF driver helper
[ 2.582911] sdhci-omap 481d8000.mmc: supply vqmmc not found, using dummy regulator
[ 2.591548] ledtrig-cpu: registered to indicate activity on CPUs
[ 2.611739] davinci-mcasp 48038000.mcasp: IRQ common not found
[ 2.629606] NET: Registered protocol family 10
[ 2.635179] Segment Routing with IPv6
[ 2.644917] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[ 2.652099] NET: Registered protocol family 17
[ 2.656950] Key type dns_resolver registered
[ 2.661989] omap_voltage_late_init: Voltage driver support not added
[ 2.669321] Loading compiled-in X.509 certificates
[ 2.681322] mmc1: SDHCI controller on 481d8000.mmc [481d8000.mmc] using External DMA
[ 2.695224] OMAP GPIO hardware version 0.1
[ 2.728464] tps65217-pmic: Failed to locate of_node [id: -1]
[ 2.740405] tps65217-bl: Failed to locate of_node [id: -1]
[ 2.748809] tps65217 0-0024: TPS65217 ID 0xe version 1.2
[ 2.755267] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz
[ 2.764284] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 100 kHz
[ 2.778397] omap_gpio 44e07000.gpio: Could not set line 6 debounce to 200000 microseconds (-22)
[ 2.789190] sdhci-omap 48060000.mmc: Got CD GPIO
[ 2.794188] sdhci-omap 48060000.mmc: supply vqmmc not found, using dummy regulator
[ 2.879941] mmc0: SDHCI controller on 48060000.mmc [48060000.mmc] using External DMA
[ 2.921947] mmc0: new high speed SDHC card at address 1234
[ 2.931057] tda998x 0-0070: found TDA19988
[ 2.935744] mmcblk0: mmc0:1234 SA04G 3.68 GiB
[ 2.947658] mmcblk0: p1 p2
[ 2.951020] tilcdc 4830e000.lcdc: bound 0-0070 (ops tda998x_ops)
[ 2.962961] [drm] Initialized tilcdc 1.0.0 20121205 for 4830e000.lcdc on minor 0
[ 2.970854] tilcdc 4830e000.lcdc: [drm] Cannot find any crtc or sizes
[ 2.979434] tilcdc 4830e000.lcdc: [drm] Cannot find any crtc or sizes
[ 3.173535] mmc1: new high speed MMC card at address 0001
[ 3.180862] mmcblk1: mmc1:0001 MMC04G 3.66 GiB
[ 3.186126] mmcblk1boot0: mmc1:0001 MMC04G partition 1 1.00 MiB
[ 3.192926] mmcblk1boot1: mmc1:0001 MMC04G partition 2 1.00 MiB
[ 3.199477] mmcblk1rpmb: mmc1:0001 MMC04G partition 3 128 KiB, chardev (243:0)
[ 3.211617] mmcblk1: p1
[ 15.448539] ALSA device list:
[ 15.451579] No soundcards found.
[ 111.209007] VFS: Unable to mount root fs via NFS.
[ 111.213900] devtmpfs: mounted
[ 111.221944] Freeing unused kernel memory: 1024K
[ 111.240361] Run /sbin/init as init process
[ 111.246257] Run /etc/init as init process
[ 111.250600] Run /bin/init as init process
[ 111.254784] Run /bin/sh as init process
[ 111.259326] Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance.
[ 111.273591] ---[ end Kernel panic - not syncing: No working init found. Try passing init= option to kernel. See Linux Documentation/admin-guide/init.rst for guidance. ]---
environment variables are like above;
=> printenv
addr_fit=0x90000000
arch=arm
args_mmc=run finduuid;setenv bootargs console=${console} ${optargs} root=PARTUUID=${uuid} rw rootfstype=${mmcrootfstype}
baudrate=115200
board=am335x
board_name=A335BNLT
board_rev=00C0
board_serial=5014BBBK1826
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_efi_bootmgr=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_fdt=try
boot_fit=0
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc0 legacy_mmc0 mmc1 legacy_mmc1 nand0 usb0 pxe dhcp
bootargs=console=ttyS0,115200 root=/dev/nfs rw nfsroot=192.168.0.1:/nfs,nfsvers=3,tcp ip=192.168.0.100:::::usb0 g_ether.dev_addr=f8:dc:7a:00:00:02 g_ether.host_addr=f8:dc:7a:00:00:01
bootcmd=mmc dev 0; devnum=${mmcdev}; setenv devtype mmc; mmc rescan; run loadimage; run findfdt; run mmcloados
bootcmd_dhcp=setenv devtype dhcp; run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00010:UNDI:003000;setenv bootp_arch 0xa;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_legacy_mmc0=setenv mmcdev 0; setenv bootpart 0:2 ; run mmcboot
bootcmd_legacy_mmc1=setenv mmcdev 1; setenv bootpart 1:2 ; run mmcboot
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_mmc1=devnum=1; run mmc_boot
bootcmd_nand=run nandboot
bootcmd_orig=if test ${boot_fit} -eq 1; then run update_to_fit; fi; run findfdt; run init_console; run envboot; run distro_bootcmd
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=devnum=0; run usb_boot
bootcount=1
bootdelay=2
bootdir=/boot
bootenvfile=uEnv.txt
bootfile=zImage
bootm_size=0x10000000
bootpart=0:2
bootscript=echo Running bootscript from mmc${mmcdev} ...; source ${loadaddr}
console=ttyO0,115200n8
cpu=armv7
dfu_alt_info_emmc=rawemmc raw 0 3751936;boot part 1 1;rootfs part 1 2;MLO fat 1 1;MLO.raw raw 0x100 0x200;u-boot.img.raw raw 0x300 0x1000;u-env.raw raw 0x1300 0x200;spl-os-args.raw raw 0x1500 0x200;spl-os-image.raw raw 0x1700 0x6900;spl-os-args fat 1 1;spl-os-image fat 1 1;u-boot.img fat 1 1;uEnv.txt fat 1 1
dfu_alt_info_mmc=boot part 0 1;rootfs part 0 2;MLO fat 0 1;MLO.raw raw 0x100 0x200;u-boot.img.raw raw 0x300 0x1000;u-env.raw raw 0x1300 0x200;spl-os-args.raw raw 0x1500 0x200;spl-os-image.raw raw 0x1700 0x6900;spl-os-args fat 0 1;spl-os-image fat 0 1;u-boot.img fat 0 1;uEnv.txt fat 0 1
dfu_alt_info_nand=SPL part 0 1;SPL.backup1 part 0 2;SPL.backup2 part 0 3;SPL.backup3 part 0 4;u-boot part 0 5;u-boot-spl-os part 0 6;kernel part 0 8;rootfs part 0 9
dfu_alt_info_ram=kernel ram 0x80200000 0x4000000;fdt ram 0x80f80000 0x80000;ramdisk ram 0x81000000 0x4000000
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
dtboaddr=0x89000000
efi_dtb_prefixes=/ /dtb/ /dtb/current/
envboot=mmc dev ${mmcdev}; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadbootscript; then run bootscript;else if run loadbootenv; then echo Loaded env from ${bootenvfile};run importbootenv;fi;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;fi;fi;
eth1addr=6c:ec:eb:ab:52:66
eth2addr=6c:ec:eb:ab:52:64
eth3addr=de:ad:be:ef:00:01
ethact=usb_ether
ethaddr=6c:ec:eb:ab:52:64
fdt_addr_r=0x88000000
fdtaddr=0x88000000
fdtcontroladdr=9df41050
fdtfile=undefined
findfdt=if test $board_name = A335BONE; then setenv fdtfile am335x-bone.dtb; fi; if test $board_name = A335BNLT; then setenv fdtfile am335x-boneblack.dtb; fi; if test $board_name = A335PBGL; then setenv fdtfile am335x-pocketbeagle.dtb; fi; if test $board_name = BBBW; then setenv fdtfile am335x-boneblack-wireless.dtb; fi; if test $board_name = BBG1; then setenv fdtfile am335x-bonegreen.dtb; fi; if test $board_name = BBGW; then setenv fdtfile am335x-bonegreen-wireless.dtb; fi; if test $board_name = BBBL; then setenv fdtfile am335x-boneblue.dtb; fi; if test $board_name = BBEN; then setenv fdtfile am335x-sancloud-bbe.dtb; fi; if test $board_name = A33515BB; then setenv fdtfile am335x-evm.dtb; fi; if test $board_name = A335X_SK; then setenv fdtfile am335x-evmsk.dtb; fi; if test $board_name = A335_ICE; then setenv fdtfile am335x-icev2.dtb; fi; if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
finduuid=part uuid mmc ${bootpart} uuid
get_overlaystring=for overlay in $name_overlays;do;setenv overlaystring ${overlaystring}'#'${overlay};done;
importbootenv=echo Importing environment from mmc${mmcdev} ...; env import -t ${loadaddr} ${filesize}
init_console=if test $board_name = A335_ICE; then setenv console ttyO3,115200n8;else setenv console ttyO0,115200n8;fi;
ipaddr=192.168.0.100
kernel_addr_r=0x82000000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0x82000000
loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenvfile}
loadbootscript=load mmc ${mmcdev} ${loadaddr} boot.scr
loadfdt=load ${devtype} ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
loadimage=load ${devtype} ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
mmcboot=mmc dev ${mmcdev}; devnum=${mmcdev}; devtype=mmc; if mmc rescan; then echo SD/MMC found on device ${mmcdev};if run loadimage; then run args_mmc; if test ${boot_fit} -eq 1; then run run_fit; else run mmcloados;fi;fi;fi;
mmcdev=0
mmcloados=if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdtaddr}; else if test ${boot_fdt} = try; then bootz; else echo WARN: Cannot load the DT; fi; fi; else bootz; fi;
mmcrootfstype=ext4 rootwait
mtdids=nand0=nand.0
mtdparts=mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.backup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)
name_fit=fitImage
nandargs=setenv bootargs console=${console} ${optargs} root=${nandroot} rootfstype=${nandrootfstype}
nandboot=echo Booting from nand ...; run nandargs; nand read ${fdtaddr} NAND.u-boot-spl-os; nand read ${loadaddr} NAND.kernel; bootz ${loadaddr} - ${fdtaddr}
nandroot=ubi0:rootfs rw ubi.mtd=NAND.file-system,2048
nandrootfstype=ubifs rootwait=1
netargs=setenv bootargs console=${console} ${optargs} root=/dev/nfs nfsroot=${serverip}:${rootpath},${nfsopts} rw ip=dhcp
netboot=echo Booting from network ...; setenv autoload no; dhcp; run netloadimage; run netloadfdt; run netargs; bootz ${loadaddr} - ${fdtaddr}
netloadfdt=tftp ${fdtaddr} ${fdtfile}
netloadimage=tftp ${loadaddr} ${bootfile}
nfsopts=nolock
partitions=uuid_disk=${uuid_gpt_disk};name=bootloader,start=384K,size=1792K,uuid=${uuid_gpt_bootloader};name=rootfs,start=2688K,size=-,uuid=${uuid_gpt_rootfs}
pxefile_addr_r=0x80100000
ramargs=setenv bootargs console=${console} ${optargs} root=${ramroot} rootfstype=${ramrootfstype}
ramboot=echo Booting from ramdisk ...; run ramargs; bootz ${loadaddr} ${rdaddr} ${fdtaddr}
ramdisk_addr_r=0x88080000
ramroot=/dev/ram0 rw
ramrootfstype=ext2
rdaddr=0x88080000
rootpath=/export/rootfs
run_fit=bootm ${addr_fit}#${fdtfile}${overlaystring}
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z "${fdtfile}" -a -n "${soc}"; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;run boot_efi_bootmgr;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi; then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x80000000
serial#=5014BBBK1826
serverip=192.168.0.1
soc=am33xx
spiargs=setenv bootargs console=${console} ${optargs} root=${spiroot} rootfstype=${spirootfstype}
spiboot=echo Booting from spi ...; run spiargs; sf probe ${spibusno}:0; sf read ${loadaddr} ${spisrcaddr} ${spiimgsize}; bootz ${loadaddr}
spibusno=0
spiimgsize=0x362000
spiroot=/dev/mtdblock4 rw
spirootfstype=jffs2
spisrcaddr=0xe0000
static_ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off
stderr=serial#44e09000
stdin=serial#44e09000
stdout=serial#44e09000
update_to_fit=setenv loadaddr ${addr_fit}; setenv bootfile ${name_fit}
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
usbnet_devaddr=f8:dc:7a:00:00:02
usbnet_hostaddr=f8:dc:7a:00:00:01
vendor=ti
ver=U-Boot 2021.01-ga6e7892957 (May 14 2021 - 05:06:14 +0000)
Environment size: 10427/131068 bytes
=>
I created a cfg file and added it to my kernel recipe, configuration is below. But I am still unable to achieve nfs mounting. Any suggestions?
Is there a way to make sure, may configuration changes are in the built kernel?
I have put all files, MLO, Uboot, dtb and zImage in Boot partition of the sdcard, is it correct?
CONFIG_USB_COMMON=y
CONFIG_USB_MUSB_HDRC=y
CONFIG_USB_MUSB_GADGET=y
CONFIG_USB_MUSB_DSPS=y
CONFIG_NOP_USB_XCEIV=y
CONFIG_AM335X_CONTROL_USB=y
CONFIG_AM335X_PHY_USB=y
CONFIG_USB_GADGET=y
CONFIG_USB_LIBCOMPOSITE=y
CONFIG_USB_U_ETHER=y
CONFIG_USB_F_ECM=y
CONFIG_USB_F_SUBSET=y
CONFIG_USB_F_RNDIS=y
CONFIG_USB_ETH=y
Thank you.

Destroying luks header on dm-crypt linux

I am trying to destroy the luks header on one of my logical volume data1, I am still able to read the file inside data1 after I delete the luks header. I suppose it should not be the case right? Can someone help me in understanding this case?
lsblk output
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 894.2G 0 disk
├─sda1 8:1 0 500M 0 part /boot
└─sda2 8:2 0 893.8G 0 part
├─vg0-root 251:0 0 758.7G 0 lvm
│ └─luks-45f803e5-3c17-4aaf-a9ad-d66c8b5458de 251:2 0 758.7G 0 crypt /
├─vg0-swap 251:1 0 75G 0 lvm [SWAP]
├─vg0-data3 251:3 0 20G 0 lvm
│ └─luks-6e168d35-26dc-429c-a3d6-8cb4f1c1d39e 251:7 0 20G 0 crypt /data3
├─vg0-data2 251:4 0 20G 0 lvm
│ └─luks-75727dd1-a332-423d-8c37-4cedf9cbe83c 251:8 0 20G 0 crypt /data2
└─vg0-data1 251:5 0 20G 0 lvm
└─luks-cf2d9729-2d1b-48b8-8502-dea937ef602f 251:6 0 20G 0 crypt /data1
Luksdump output to check if the luks header is exists:
-130-sapam#test-host:~ $ sudo cryptsetup luksDump /dev/mapper/vg0-data1
LUKS header information for /dev/mapper/vg0-data1
Version: 1
Cipher name: aes
Cipher mode: xts-plain64
Hash spec: sha256
Payload offset: 4096
MK bits: 256
MK digest: 9f e7 1a b3 0e fb 4e bc 6d 1b 9e 46 f8 bd 15 22 ea 04 6e c3
MK salt: 83 5e 90 5b b3 a1 c5 a5 d4 22 a0 3e 23 25 51 50
fc cd a8 ac db 9f d0 a8 8b 81 6e 9a 92 1f d8 d3
MK iterations: 43750
UUID: cf2d9729-2d1b-48b8-8502-dea937ef602f
Key Slot 0: ENABLED
Iterations: 439102
Salt: f1 6d 23 b0 b7 ee fc 09 8c 6b 92 ef b2 17 ef d9
0c 83 64 29 bf bc 98 3f f6 93 4b 45 06 49 a9 21
Key material offset: 8
AF stripes: 4000
Key Slot 1: DISABLED
Key Slot 2: DISABLED
Key Slot 3: DISABLED
Key Slot 4: DISABLED
Key Slot 5: DISABLED
Key Slot 6: DISABLED
Key Slot 7: DISABLED
Destroying the luks header:
-130-sapam#test-host:~ $ sudo dd bs=512 count=4096 if=/dev/zero of=/dev/mapper/vg0-data1
4096+0 records in
4096+0 records out
2097152 bytes (2.1 MB) copied, 0.00444235 s, 472 MB/s
-0-sapam#test-host:~ $ sudo cryptsetup luksDump /dev/mapper/vg0-data1
-1-sapam#test-host:~ $
I still able to read the file inside /data1/
-1-sapam#test-host:~ $ cat /data1/foo
james
-0-sapam#test-host:~ $
From my understanding is once the header is destroyed, the /data1 should not be able to read right?
It seems you are destroying already mounted partition.
Encryption/decryption keys are hold in the memory while the partition is mounted. You should unmout your LUKS partition first:
# umount /data1
and then erase the LUKS header. You won't be able to mount it again.
Please note cryptsetup utility has a command to erase LUKS header:
# cryptsetup luksErase /dev/mapper/vg0-data1
The advantage of this operation is that you can restore LUKS header from the backup if you done it before.
from cryptsetup(8):
erase <device>
luksErase <device>
Erase all keyslots and make the LUKS container permanently inac‐
cessible. You do not need to provide any password for this op‐
eration.
WARNING: This operation is irreversible.
While luksErase is nice to wipe the keyslots area, note that it doesn't actually destroy the entire LUKS Header. It leaves the metadata intact.
I submitted a feature request asking for the luksErase command to have the ability to wipe the plaintext metadata in the header as well, but the developer rejected & closed it :(
LUKS Header Shredder
You can use the following BASH script to find every LUKS device on the system, wipe the headers, and shutdown the machine.
Disclaimer
The script below contains experimental software that may or may not lead to corruption or total permanent deletion of some or all of your data. I cannot be responsible for any data loss that has occurred as a result of following this guide.
The contents of this answer is provided openly and is licensed under the CC-BY-SA license. The software included in this guide is licensed under the GNU GPLv3 license. All content here is consistent with the limitations of liabilities outlined in its respective licenses.
I highly recommend that any experiments with the script included in this answer is used exclusively on a disposable machine containing no valuable data.
If data loss is a concern for you, then leave now and do not proceed. You have been warned.
#!/bin/bash
#set -x
################################################################################
# File: buskill-selfdestruct.sh
# Purpose: Self-destruct trigger script for BusKill Kill Cord
# For more info, see: https://buskill.in/
# WARNING: THIS IS EXPERIMENTAL SOFTWARE THAT IS DESIGNED TO CAUSE PERMANENT,
# COMPLETE AND IRREVERSIBLE DATA LOSS!
# Note : This script will *not* execute unless it's passed the '--yes'
# argument. Be sure to test this trigger before depending on it!
# Authors: Michael Altfield <michael#buskill.in>
# Created: 2020-03-11
# Updated: 2020-03-11
# Version: 0.1
################################################################################
############
# SETTINGS #
############
BUSKILL_LOCK='/usr/local/bin/buskill-lock.sh'
[ -f ${BUSKILL_LOCK} ] || echo "ERROR: Unable to find buskill-lock.sh"
CRYPTSETUP=`which cryptsetup` || echo "ERROR: Unable to find cryptsetup"
LS=`which ls` || echo "ERROR: Unable to find ls"
CAT=`which cat` || echo "ERROR: Unable to find cat"
GREP=`which grep` || echo "ERROR: Unable to find grep"
ECHO=`which echo` || echo "ERROR: Unable to find echo"
AWK=`which awk` || echo "ERROR: Unable to find awk"
HEAD=`which head` || echo "ERROR: Unable to find head"
LSBLK=`which lsblk` || echo "ERROR: Unable to find lsblk"
OD=`which od` || echo "ERROR: Unable to find od"
##############
# ROOT CHECK #
##############
# re-run as root
if [[ $EUID -ne 0 ]]; then
exec sudo /bin/bash "$0" "$#"
fi
###########
# CONFIRM #
###########
# for safety, exit if this script is executed without a '--yes' argument
${ECHO} "${#}" | ${GREP} '\--yes' &> /dev/null
if [ $? -ne 0 ]; then
${ECHO} "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING"
${ECHO} "================================================================================"
${ECHO} "WARNING: THIS IS EXPERIMENTAL SOFTWARE THAT IS DESIGNED TO CAUSE PERMANENT, COMPLETE AND IRREVERSIBLE DATA LOSS!"
${ECHO} "================================================================================"
${ECHO} "WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING"
${ECHO}
${ECHO} "cowardly refusing to execute without the '--yes' argument for your protection. If really you want to proceed with damaging your system, retry with the '--yes' argument"
exit 1
fi
###########################
# (DELAYED) HARD SHUTDOWN #
###########################
# The most secure encrypted computer is an encrypted computer that is *off*
# This is our highest priority; initiate a hard-shutdown to occur in 5 minutes regardless
# of what happens later in this script
nohup sleep 60 && echo o > /proc/sysrq-trigger &
nohup sleep 61 && shutdown -h now &
nohup sleep 62 && poweroff --force --no-sync &
###############
# LOCK SCREEN #
###############
# first action: lock the screen!
${BUSKILL_LOCK} &
#####################
# WIPE LUKS VOLUMES #
#####################
# overwrite luks headers
${ECHO} "INFO: shredding LUKS header (plaintext metadata and keyslots with encrypted master decryption key)"
writes=''
IFS=$'\n'
for line in $( ${LSBLK} --list --output 'PATH,FSTYPE' | ${GREP} 'crypt' ); do
device="`${ECHO} \"${line}\" | ${AWK} '{print \$1}'`"
${ECHO} -e "\t${device}"
###########################
# OVERWRITE LUKS KEYSLOTS #
###########################
# erases all keyslots, making the LUKS container "permanently inaccessible"
${CRYPTSETUP} luksErase --batch-mode "${device}" || ${HEAD} --bytes 20M /dev/urandom > ${device} &
# store the pid of the above write tasks so we can try to wait for it to
# flush to disk later -- before triggering a brutal hard-shutdown
writes="${writes} $!"
#####################################
# OVERWRITE LUKS PLAINTEXT METADATA #
#####################################
luksVersion=`${OD} --skip-bytes 6 --read-bytes 2 --format d2 --endian=big --address-radix "n" "${device}"`
# get the end byte to overwrite. For more info, see:
# https://security.stackexchange.com/questions/227359/how-to-determine-start-and-end-bytes-of-luks-header
if [[ $luksVersion -eq 1 ]]; then
# LUKS1: https://gitlab.com/cryptsetup/cryptsetup/-/wikis/LUKS-standard/on-disk-format.pdf
# in LUKS1, the whole header ends at 512 * the `payload-offset`
# this is actually more than we need (includes keyslots), but
# it's the fastest/easiest to bound to fetch in LUKS1
payloadOffset=`${OD} --skip-bytes 104 --read-bytes 4 --format d4 --endian=big --address-radix "n" "${device}"`
luksEndByte=$(( 512 * ${payloadOffset} ))
elif [[ $luksVersion -eq 2 ]]; then
# LUKS2: https://gitlab.com/cryptsetup/LUKS2-docs/blob/master/luks2_doc_wip.pdf
# in LUKS2, the end of the plaintext metadata area is twice the
# size of the `hdr_size` field
hdr_size=`${OD} --skip-bytes 8 --read-bytes 8 --format d8 --endian=big --address-radix "n" "${device}"`
luksEndByte=$(( 2 * ${hdr_size} ))
else
# version unclear; just overwrite 20 MiB
luksEndByte=20971520
fi
# finally, shred that plaintext metadata; we do this in a new file descriptor
# to prevent bash from truncating if ${device} is a file
exec 5<> "${device}"
${HEAD} --bytes "${luksEndByte}" /dev/urandom >&5 &
writes="${writes} $!"
exec 5>&-
done
#######################
# WAIT ON DISK WRITES #
#######################
# wait until all the write tasks above have completed
# note: do *not* put quotes around this arg or the whitespace will break wait
wait ${writes}
# clear write buffer to ensure headers overwrites are actually synced to disks
sync; echo 3 > /proc/sys/vm/drop_caches
#################################
# WIPE DECRYPTION KEYS FROM RAM #
#################################
# suspend each currently-decrypted LUKS volume
${ECHO} "INFO: removing decryption keys from memory"
for device in $( ${LS} -1 "/dev/mapper" ); do
${ECHO} -e "\t${device}";
${CRYPTSETUP} luksSuspend "${device}" &
# clear page caches in memory (again)
sync; echo 3 > /proc/sys/vm/drop_caches
done
#############################
# (IMMEDIATE) HARD SHUTDOWN #
#############################
# do whatever works; this is important.
echo o > /proc/sysrq-trigger &
sleep 1
shutdown -h now &
sleep 1
poweroff --force --no-sync &
# exit cleanly (lol)
exit 0
Sources
LUKS Header Shredder (BusKill Self-Destruct Trigger)
https://github.com/BusKill/buskill-linux/blob/master/triggers/buskill-selfdestruct.sh

Run program on boot with initramfs

I'm running uClinux on a SmartFusion2 as part of a University team building a small cube satellite. However, I'm not super experienced in Linux kernel, and this issue has had me stumped for a few days. I'm trying to get the SmartFusion to run a program on bootup. Currently, the only .uImage that does this is the test 'hello' file. I'm trying to recreate the process for another program, but am running into some difficulties.
in my hello directory I have the following files: hello.busybox, hello.kernel.M2S, help.txt, hello.uImage, Makefile, hello.initramfs, hello (directory)
in the hello subdirectory (projects/hello/hello):
hello (executable), hello.c, hello.gdb, hello.h, hello.o, Makefile
to try and get the uImage to boot and run a different program, I made a copy of my projects/hello/hello directory and renamed it 'goodbye', with a few minor changes int the .h and .c files for testing purposes. Now I'm trying to get the executable 'hello' in projects/hello/goodbye to run on boot.
My initramfs file originally looked like this:
# This is a very simple, default initramfs
dir /dev 0755 0 0
nod /dev/console 0600 0 0 c 5 1
nod /dev/tty 0666 0 0 c 5 0
nod /dev/null 0600 0 0 c 1 3
nod /dev/mem 0600 0 0 c 1 1
nod /dev/kmem 0600 0 0 c 1 2
nod /dev/zero 0600 0 0 c 1 5
nod /dev/random 0600 0 0 c 1 8
nod /dev/urandom 0600 0 0 c 1 9
dir /dev/pts 0755 0 0
nod /dev/ptmx 0666 0 0 c 5 2
nod /dev/ttyS0 0666 0 0 c 4 64
nod /dev/ttyS1 0666 0 0 c 4 65
nod /dev/ttyS2 0666 0 0 c 4 66
nod /dev/ttyS3 0666 0 0 c 4 67
nod /dev/ttyS4 0666 0 0 c 4 68
nod /dev/ttyS5 0666 0 0 c 4 69
dir /bin 755 0 0
dir /proc 755 0 0
file /bin/hello ${INSTALL_ROOT}/projects/${SAMPLE}/hello/hello 755 0 0
slink /bin/init hello 777 0 0
I changed the last two lines of the initramfs to read as follows:
file /bin/hello ${INSTALL_ROOT}/projects/${SAMPLE}/hello/goodbye 755 0 0
slink /bin/init hello 777 0 0
But when I try and boot the SmartFusion2 after remaking the uImage, I get this, witht the error at the bottom:
Starting kernel ...
Linux version 2.6.33-arm1 (ecenstudent#EE10308) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189) ) #38 Thu May 25 09:09:08 MDT 2017
CPU: ARMv7-M Processor [412fc231] revision 1 (ARMv7M)
CPU: NO data cache, 8K instruction cache
Machine: Microsemi M2S
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: m2s_platform=m2s-fg484-som console=ttyS0,115200 panic=10 ip=10.2.118.102:10.2.118.101:192.168.0.1::m2s-fg484-som:eth0:off ethaddr=3C:FB:96:05:00:53
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 64408k/64408k available, 1128k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0x00000000 - 0x00001000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0x00000000 - 0xffffffff (4095 MB)
lowmem : 0xa0000000 - 0xa4000000 ( 64 MB)
modules : 0xa0000000 - 0x01000000 (1552 MB)
.init : 0xa0008000 - 0xa0012000 ( 40 kB)
.text : 0xa0074bc0 - 0xa0083000 ( 58 kB)
.data : 0xa0084000 - 0xa008cce0 ( 36 kB)
Hierarchical RCU implementation.
NR_IRQS:83
Calibrating delay loop... 132.30 BogoMIPS (lpj=661504)
Mount-cache hash table entries: 512
Switching to clocksource mss_timer2
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x40000000 (irq = 10) is a 16550A
console [ttyS0] enabled
serial8250.1: ttyS1 at MMIO 0x40010000 (irq = 11) is a 16550A
Freeing init memory: 40K
Kernel panic - not syncing: No init found. Try passing init= option to kernel.
Backtrace: no frame pointer
Rebooting in 10 seconds..
Can somebody help explain why this is happening and what I need to do to my initramfs to make it run the proper program on boot? Thanks!!
As it turns out, I was confused about how those two lines worked. When I finally figured it out, they looked like this:
file /bin/hello ${INSTALL_ROOT}/projects/${SAMPLE}/goodbye/hello 755 0 0
slink /bin/init hello 777 0 0
then it worked as desired, and I was able to implement it into other uImages.

Buildroot does not create /dev entries for emmc on am335x custom board

I have a custom board based on am335x. I am building a buildroot for a minimal root filesystem (minimal by size) : boots off as initramfs. I am able to boot the image but unfortunately there are no /dev/mmcblk0 entry.
I would like to know how to make it create that entry.
The following is some log and data to help.
======================================================================
# ls /dev
console ram14 tty26 tty55
cpu_dma_latency ram15 tty27 tty56
full ram2 tty28 tty57
hwrng ram3 tty29 tty58
i2c-0 ram4 tty3 tty59
i2c-1 ram5 tty30 tty6
input ram6 tty31 tty60
kmem ram7 tty32 tty61
kmsg ram8 tty33 tty62
loop-control ram9 tty34 tty63
loop0 random tty35 tty7
loop1 shm tty36 tty8
loop2 tty tty37 tty9
loop3 tty0 tty38 ttyO0
loop4 tty1 tty39 ttyO1
loop5 tty10 tty4 ttyS0
loop6 tty11 tty40 ttyS1
loop7 tty12 tty41 ttyS2
mem tty13 tty42 ttyS3
network_latency tty14 tty43 ubi_ctrl
network_throughput tty15 tty44 urandom
null tty16 tty45 usbmon0
port tty17 tty46 vcs
psaux tty18 tty47 vcs1
ptmx tty19 tty48 vcsa
pts tty2 tty49 vcsa1
ram0 tty20 tty5 watchdog
ram1 tty21 tty50 watchdog0
ram10 tty22 tty51 zero
ram11 tty23 tty52
ram12 tty24 tty53
ram13 tty25 tty54
# cat /proc/partitions
major minor #blocks name# cat /proc/devices
Character devices:
1 mem
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
29 fb
89 i2c
90 mtd
128 ptm
136 pts
153 spi
166 ttyACM
180 usb
188 ttyUSB
189 usb_device
226 drm
248 ttySDIO
249 usbmon
250 ttyO
251 watchdog
252 ptp
253 pps
254 rtc
Block devices:
1 ramdisk
259 blkext
7 loop
8 sd
31 mtdblock
65 sd
66 sd
67 sd
68 sd
69 sd
70 sd
71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
179 mmc
# cat /etc/fstab
# <file system> <mount pt> <type> <options> <dump> <pass>
/dev/root / ext2 rw,noauto 0 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0
tmpfs /tmp tmpfs mode=1777 0 0
tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0
sysfs /sys sysfs defaults 0 0
==================================================================
It is booting busybox and using devtmpfs which are defaults for buildroot.
If I use TI's minimalfs, it does show /dev/mmcblk0 so the kernel and device tree are ok. How to solve this.
Regards,
Preetam
You can create this node manually by mknod
mknod [OPTION]... NAME TYPE [MAJOR MINOR]
In your case type would be b (block). Major number you may find in sources or use
cat /proc/devices the minor number is a partition number.
If this is not the case, try to enable udev in buildroot config.

Can't flash with avrisp mkII in avrdude Version 6.0.1

I have had problems with this programming board. It is set up correctly seems to be an AVRISP MKII.
I received the following error messages upon flashing with avrdude:
(trusty)chandran#localhost:~$ avrdude -c avrispmkii -p t85 -vv
avrdude: Version 6.0.1, compiled on Oct 21 2013 at 15:55:32
Copyright (c) 2000-2005 Brian Dean, h ttp://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/etc/avrdude.conf"
User configuration file is "/home/chandran/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : avrispmkii
avrdude: usb_open(): cannot read serial number "error sending control
message: Connection timed out"
avrdude: usbdev_open(): Found AVRISP mkII, serno: [unknown]
avrdude: usbdev_recv_frame(): usb_bulk_read(): error submitting URB: No
such file or directory
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: usbdev_recv_frame(): usb_bulk_read(): error submitting URB: No such file or directory
avrdude: stk500v2_recv_mk2: error in USB receive
avrdude: stk500v2_getsync(): timeout communicating with programmer
AVR Part : ATtiny85
Chip Erase delay : 4500 us
PAGEL : P00
BS2 : P00
RESET disposition : possible i/o
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 6 4 0 no 512 4 0 4000 4500 0xff 0xff
flash 65 6 32 0 yes 8192 64 128 4500 4500 0xff 0xff
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 2 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel AVR ISP mkII
Programmer Model: AVRISP mkII
avrdude: usbdev_recv_frame(): usb_bulk_read(): error submitting URB: No such file or directory
It is hard to identify the issue since my version of the programming board doesn't have such great documentation.
Thanks in advance!
This bug was causing the problems. I simply reverted to the previous version of avrdude (5.11.1) and it worked. By now there is an even newer version of avrdude (6.3), this bug might no longer be a problem in latest version.
Here are some steps:
Revert to an older version of avrdude either by using sudo apt-get install <package-name>=<package-version-number> OR sudo apt-get install <package-name>=<package-version-number>
Check if it works: avrdude -p <your part name> -c <your programmer name (avrispmkII)>
You might have to specify a port. Use something like ''watch ls /dev/tty*'' to find your device if you get an error like this one:
(trusty)chandran#localhost:~$ avrdude -c avrispmkII -p t85
avrdude: ser_open(): can't open device "/dev/ttyS0": No such file or directory
avrdude done. Thank you.
Here is what it will look like when you get it right:
(trusty)chandran#localhost:~$ avrdude -c avrispmkII -p t85 -P usb -vv
avrdude: Version 5.11.1, compiled on Oct 30 2011 at 10:37:28
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "/etc/avrdude.conf"
User configuration file is "/home/chandran/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : usb
Using Programmer : avrispmkII
avrdude: usb_open(): cannot read serial number "No error"
avrdude: usbdev_open(): Found AVRISP mkII, serno: [unknown]
avrdude: usbdev_open(): using read endpoint 0x83
AVR Part : ATtiny85
Chip Erase delay : 4500 us
PAGEL : P00
BS2 : P00
RESET disposition : possible i/o
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 6 4 0 no 512 4 0 4000 4500 0xff 0xff
flash 65 6 32 0 yes 8192 64 128 4500 4500 0xff 0xff
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 2 0 0 0 0 0x00 0x00
Programmer Type : STK500V2
Description : Atmel AVR ISP mkII
Programmer Model: AVRISP mkII
Hardware Version: 0
Firmware Version Master : 1.255
Vtarget : 3.3 V
SCK period : 8.00 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e930b
avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: safemode: lfuse reads as 62
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK
avrdude done. Thank you.
If this doesn't fix your problem, you might want to look at some other solutions:
https://electronics.stackexchange.com/questions/78302/avrisp-mkii-not-reading-device-signature/189488
https://electronics.stackexchange.com/questions/67757/why-does-my-avrisp-mkii-programmer-not-work
AVRISP MKII doesn't work with AVRDUDE on Linux
https://electronics.stackexchange.com/questions/74298/how-does-avrdude-with-avr-isp-mkii-respond-when-no-target-board-is-connected
Good luck!

Resources