init-eMMC-flasher-v3.sh not shutting down

I am updating my images ((3.8.13-bone68) and looking to make new images for cloning from SD card to eMMC

My process is to setup beaglebone as required and then run /opt/scripts/tools/eMMC/beaglebone-black-make-microSD-flasher-from-eMMC.sh after first changing directory to /opt/scripts/tools and issuing a git pull to get the lastest scripts.

Creating SD image works as expected.

However when cloning from SD to eMMC (in powered off board, insert SD card, hold boot button and power up board and wait for power down) the destination board is not closing down. I then hooked up serial to usb cable and monitored output. I see the script is getting called and message “eMMC has been flashed: please wait for device to power down” is being displayed. However the device is not shutting down and appears to be restarting.

Looking at init-eMMC-flasher-v3.sh script function copy_rootfs () I see:

`
message=“eMMC has been flashed: please wait for device to power down.” ; broadcast
message="-----------------------------" ; broadcast

flush_cache
#To properly shudown, /opt/scripts/boot/am335x_evm.sh is going to call halt:
exec /sbin/init
#halt -f
`

The last line is calling /sbin/init and halt is commented out - is this correct? I’d assume if you wanted to shutdown using init you’d need to calling init 0 and not just init.

Thanks
Colin

Yeah, this is a bug/workaround...

Does? "exec /sbin/init 0" actually shut it down? For me when i tested
it late last year summer, it wasn't doing what i wanted..

Right now i catch the "shutdown" here:

https://github.com/RobertCNelson/boot-scripts/blob/master/boot/generic-startup.sh#L3-L10

Regards,

Part of it, I couldn't get /sbin/init to actually tell the pmic to
shutdown in 3.8.x, so we drop into systemd (/sbin/init) to do it....

Regards,

I was just going to add to my post that I found difference in my am335x_evm.sh files. Prior working version included

#eMMC flasher just exited single user mode via: [exec /sbin/init] #as we can't shudown properly in single user mode.. unset are_we_flasher are_we_flasher=$(grep init-eMMC-flasher /proc/cmdline || true) if [ ! "x${are_we_flasher}" = "x" ] ; then halt exit fi

while current am335x_evm.sh doesn’t. I do see the code you mention in generic-startup.sh but don’t see where this file is called/referenced.

About a week ago i moved that into the generic (all) startup script
that calls the board options. Mostly to shutdown before ssh key
re-generation on flashing microsd and to share it with the x15
flasher..

(systemd/sysv init script) -> boot/generic-startup.sh -> boot/am335x_evm.sh

the systemd/sysv script i implant into the file system is located here:

https://github.com/RobertCNelson/omap-image-builder/tree/master/target/init_scripts

systemd-generic-board-startup.service

looks like "generic-debian.sh" (sysv) is still calling the old one, i
don't use that..

Regards,

I’m in process of reflashing and will let you know on /sbin/init 0 working or not.

Did ‘shutdown -h now’ not work when you tried, any reason not to call this directly in the init-eMMC script?

Looking forward to getting this version buttoned up so that I can move to later version…

I'm in process of reflashing and will let you know on /sbin/init 0 working
or not.

Did 'shutdown -h now' not work when you tried, any reason not to call this
directly in the init-eMMC script?

i think it just brought down the kernel... don't remember 100% anymore..

Looking forward to getting this version buttoned up so that I can move to
later version....

btw... there is a back door in the init script:

touch /boot/debug.txt

beagleboard.org

and you get bash access, in that init, over serial <quite useful to
debug single user mode>...

Regards,

Thanks Robert, appreciate the info.