Jump to content

Caletronics

Members
  • Posts

    3
  • Joined

  • Last visited

  1. I too wanted to boot to a second partition and struggled. The workaround by @richardk sort of fixes of the problem but isn't a general solution. After examining the U-Boot environment (printenv at the u-boot prompt) and /boot/boot.cmd I feel that boot.cmd needs to be patched. If you set the boot flag on the second partition (parted or fdisk, etc.) then U-Boot correctly sets 'distro_bootpart' and thereafter uses '${devnum}:${distro_bootpart}'. I modified boot.cmd to follow the same convention, rebuilt boot.scr and it works. *** a/boot.cmd 2020-03-29 11:47:02.268576905 -0700 --- b/boot.cmd 2020-03-29 11:55:28.541325423 -0700 *************** *** 18,25 **** echo "Boot script loaded from ${devtype}" ! if test -e ${devtype} ${devnum} ${prefix}armbianEnv.txt; then ! load ${devtype} ${devnum} ${load_addr} ${prefix}armbianEnv.txt env import -t ${load_addr} ${filesize} fi --- 18,25 ---- echo "Boot script loaded from ${devtype}" ! if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}armbianEnv.txt; then ! load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}armbianEnv.txt env import -t ${load_addr} ${filesize} fi *************** *** 34,71 **** if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=memory swapaccount=1"; fi ! load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} fdt addr ${fdt_addr_r} fdt resize 65536 for overlay_file in ${overlays}; do ! if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/allwinner/overlay/${overlay_prefix}-${overlay_file}.dtbo; then echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo" fdt apply ${load_addr} || setenv overlay_error "true" fi done for overlay_file in ${user_overlays}; do ! if load ${devtype} ${devnum} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then echo "Applying user provided DT overlay ${overlay_file}.dtbo" fdt apply ${load_addr} || setenv overlay_error "true" fi done if test "${overlay_error}" = "true"; then echo "Error applying DT overlays, restoring original DT" ! load ${devtype} ${devnum} ${fdt_addr_r} ${prefix}dtb/${fdtfile} else ! if load ${devtype} ${devnum} ${load_addr} ${prefix}dtb/allwinner/overlay/${overlay_prefix}-fixup.scr; then echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)" source ${load_addr} fi ! if test -e ${devtype} ${devnum} ${prefix}fixup.scr; then ! load ${devtype} ${devnum} ${load_addr} ${prefix}fixup.scr echo "Applying user provided fixup script (fixup.scr)" source ${load_addr} fi fi ! load ${devtype} ${devnum} ${ramdisk_addr_r} ${prefix}uInitrd ! load ${devtype} ${devnum} ${kernel_addr_r} ${prefix}Image booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r} --- 34,71 ---- if test "${docker_optimizations}" = "on"; then setenv bootargs "${bootargs} cgroup_enable=memory swapaccount=1"; fi ! load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}dtb/${fdtfile} fdt addr ${fdt_addr_r} fdt resize 65536 for overlay_file in ${overlays}; do ! if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}dtb/allwinner/overlay/${overlay_prefix}-${overlay_file}.dtbo; then echo "Applying kernel provided DT overlay ${overlay_prefix}-${overlay_file}.dtbo" fdt apply ${load_addr} || setenv overlay_error "true" fi done for overlay_file in ${user_overlays}; do ! if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}overlay-user/${overlay_file}.dtbo; then echo "Applying user provided DT overlay ${overlay_file}.dtbo" fdt apply ${load_addr} || setenv overlay_error "true" fi done if test "${overlay_error}" = "true"; then echo "Error applying DT overlays, restoring original DT" ! load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}dtb/${fdtfile} else ! if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}dtb/allwinner/overlay/${overlay_prefix}-fixup.scr; then echo "Applying kernel provided DT fixup script (${overlay_prefix}-fixup.scr)" source ${load_addr} fi ! if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}fixup.scr; then ! load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}fixup.scr echo "Applying user provided fixup script (fixup.scr)" source ${load_addr} fi fi ! load ${devtype} ${devnum}:${distro_bootpart} ${ramdisk_addr_r} ${prefix}uInitrd ! load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} ${prefix}Image booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}
  2. First of all thank you for this post; it helped a lot. But, I've just went through a similar journey and wonder if this is a complete solution. Your 'fragment@0' does what it intends but in my experience it was only half of the solution. My gleanings through various sources indicates that to actually accomplish something a second piece of the puzzle (for arguments sake 'fragment@1') is needed and it must reference the name (or alias?) of 'fragment@0'. I guess the reference could come from some other dts file but, normally, from, at least, another overlay file, or within the same overlay file. The point I'm trying to make is that 'fragment@0' on its own did little. I found that setting 'bias-pull-up' will not result in seeing '1' on a gpio pin without another device-tree node referencing that pin. As far as I can see something like https://forum.armbian.com/topic/6723-gpio-keys-mainline-linux/ with 'fragment@1' referencing 'fragment@0' (through the line 'pinctrl-0 = <&gpio_keys>;' in that instance) only then would apply the 'bias-pull-up'. I'm not advocating for how this appears to me at the moment. I'd rather use a gpio on its own if possible (perhaps there's a 'compatible = XXX' that I haven't found yet).
  3. The Debian packages bilibop(-*) are what you want. It works with kernels that have either aufs or overlayfs. You must be using initramfs-tools (as opposed to dracut). When your initrd is rebuilt it includes some of its scripts and files that do the magic. Use a normal /etc/fstab. In the bilibop configuration file you can whitelist other partitions that you want mounted normally. You have to put in a kernel command line argument, I like 'lockfs=soft', but other options are available. With lockfs=soft the real rootfs is mounted read-only at either /overlay/ro or /aufs/ro. You can, as root, do something like below if you need to change something permanently: root@skylight1:~$ mount -o remount,rw /overlay/ro root@skylight1:~$ chroot /overlay/ro root@skylight1:/$ .... do your work here root@skylight1:/$ exit root@skylight1:~$ mount -o remount,ro /overlay/ro For simple file edits that's it. But some operations, say 'apt-get install somepackage', will require more work. You'll need to bind mount /dev, /proc and maybe others to /overlay/ro before entering the chroot (and umounting it all later). One caution: if you use lockfs=hard (good for kiosk mode) you can paint yourself into a corner where you can't change the system at all. You'd have to mount your rootfs on another system (if you're working off an SD card) or NFS boot if you're working off of MMC. The included /usr/share/doc/bilibop* files are pretty good at explaining how it works.
×
×
  • Create New...