[Letux-kernel] patchset enable distro support

H. Nikolaus Schaller hns at goldelico.com
Mon Apr 24 18:32:54 CEST 2017


Hi Josua,

> Am 17.04.2017 um 15:18 schrieb Josua Mayer <josua.mayer at jm0.eu>:
> 
> Hi everybody,
> 
> I have now come up with the necessary bits to get distro_boot working on
> the gta04.
> 
> Still missing:
> - change the magical boot menu boot-script to use the distro commands
> on selected partitions, instead of looking for bootargs.scr
> - find out what is needed for other letux devices
> 
> br
> Josua
> 
> <0002-gta04-override-beaglerev-variable.patch><0001-omap3_beagle-use-config_distro_bootcmd.patch>

I have now applied your patches and tested a little.

Initially it did not work properly, just setting beaglerev=undefined. But CONFIG_EXTRA_ENV_SETTINGS were ignored.
I.e. no kernel_addr_r, initrd_addr_r etc.

Then I realized that they come from the default u-boot environment and we have a NAND that stores the
previous settings :)

So doing env default -a did make them available.

This made me fix the boot.scr to
* reset the environment when reflashing (should probably have been done before)
* remember and restore $ftdfile before resetting the environment
* use $ftdfile for choosing the DTB to load

Now I can flash and boot the Letux kernel without apparent problems.

Patches have been committed and pushed to the server.

I think in the long run we can replace the private variables defining the
load addresses with the official ones.

BR,
Nikolaus


Debian GNU/Linux 8 letux console

letux login: root
Password:
Last login: Sat Jan  1 00:00:57 UTC 2000 on console
Linux letux 4.10.5-letux+ #912 SMP PREEMPT Fri Mar 24 12:07:04 CET 2017 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root at letux:~# fw_printenv
arch=arm
baudrate=115200
board=letux-gta04
board_name=letux-gta04
boot=
if itest $FDT == 1
then
  bootm ${loadaddr} - ${loadaddrfdt}
else
  bootm ${loadaddr}
fi
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_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_targets=mmc0
bootaddr=0x81800000
bootcmd=
if run loadbootscript
then
  run bootscript
else
  run mmcboot
fi
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootdelay=1
bootdir=/boot
bootenv=uEnv.txt
bootfile=uImage
bootorder=1 2 3 4
bootpart=0:2
bootscript=echo Running bootscript ...; source ${bootaddr}
buddy=none
camera=none
console=ttyO2,115200n8
cpu=armv7
defaultdisplay=lcd
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
dvimode=640x480MR-16 at 60
efi_dtb_prefixes=/ /dtb/ /dtb/current/
fdt_addr_r=0x80f80000
fdt_high=0xffffffff
fdtaddr=0x80f80000
fdtfile=omap3-gta04a3.dtb
fileaddr=80400000
filesize=3c5f1
findfdt=if test $beaglerev = AxBx; then setenv fdtfile omap3-beagle.dtb; fi; if test $beaglerev = Cx; then setenv fdtfile omap3-beagle.dtb; fi; if test $beaglerev = C4; then setenv fdtfile omap3-beagle.dtb; fi; if test $beaglerev = xMAB; then setenv fdtfile omap3-beagle-xm-ab.dtb; fi; if test $beaglerev = xMC; then setenv fdtfile omap3-beagle-xm.dtb; fi; if test $fdtfile = undefined; then echo WARNING: Could not determine device tree to use; fi;
imgtempaddr=0x80800000
importbootenv=echo Importing environment from mmc ...; env import -t -r $loadaddr $filesize
initrd_addr_r=0x81000000
kernel_addr_r=0x80200000
kernelloaded=status set 10
kernelloading=status set 18
kernelmmc=0
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadaddr=0x82000000
loadaddrfdt=0x81c00000
loadbootenv=fatload mmc ${mmcdev} ${loadaddr} ${bootenv}
loadbootscript=
i2c dev 0
mmc rescan
if load mmc ${mmc} ${bootaddr} boot.scr
then
  echo did load bootscript from mmc;
elif ${nand_cmd} read ${bootaddr} 1b0000 40000
then
  echo did load bootscript from nand
fi
loadfdt=run validatefdt; load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}
loadimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}
loadimg=
i2c dev 0
mmc rescan
if load mmc ${mmc} ${imgaddr} ${imgfile}.rgb16
then
  ;
elif load mmc ${mmc} ${imgtempaddr} ${imgfile}.rgb16z
then
  unzip ${imgtempaddr} ${imgaddr}
elif ${nand_cmd} read ${imgtempaddr} ${imgnandaddr} 40000
then
  unzip ${imgtempaddr} ${imgaddr}
fi
loadkernel=
run kernelloading
i2c dev 0
mmc rescan
DONE=0;KERNEL=0;FDT=0
run nandargs
echo trying partitions $bootorder
for p in $bootorder
do
  if itest $DONE == 0
  then
    if load mmc ${mmc}:${p} ${loadaddr} uImage
    then
      echo found kernel /uImage on partition $p
      setenv mmcroot "/dev/mmcblk${kernelmmc}p${p} rw"
      run mmcargs
      KERNEL=1;DONE=1
    elif load mmc ${mmc}:${p} ${loadaddr} /boot/uImage
    then
      echo found kernel /boot/uImage on EXT partition $p
      setenv mmcroot "/dev/mmcblk${kernelmmc}p${p} rw"
      run mmcargs
      KERNEL=1;DONE=1
    fi
    if load mmc ${mmc}:${p} ${imgtempaddr} bootargs.scr
    then
      setenv PARTITION $p
      setenv PARTITIONTYPE FAT
      source ${imgtempaddr}
      DONE=1
    elif load mmc ${mmc}:${p} ${imgtempaddr} /boot/bootargs.scr
    then
      setenv PARTITION $p
      setenv PARTITIONTYPE EXT
      source ${imgtempaddr}
      DONE=1
    fi
    if load mmc ${mmc}:${p} ${loadaddrfdt} ${fdtfile}
    then
      FDT=1
    elif load mmc ${mmc}:${p} ${loadaddrfdt} /boot/${fdtfile}
    then
      FDT=1
    fi
  fi
done
if itest $KERNEL == 0
then
  echo fallback to NAND kernel
  if ${nand_cmd} read ${loadaddr} 280000 5c0000
  then
    echo NAND kernel found
    if ${nand_cmd} read ${loadaddrfdt} 840000 40000
    then
      echo NAND DTB found
      FDT=1
    else
      FDT=0
    fi
  else
    status blink
  fi
fi
run kernelloaded
loadramdisk=load mmc ${bootpart} ${rdaddr} ${bootdir}/${ramdisk}
mmc=0
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
mmcargs=setenv bootargs console=${console} mpurate=${mpurate} mux=${mux} vram=${vram} omapfb.vram=${omapfbvram} omapfb.mode=dvi:${dvimode} omapfb.debug=y omapdss.def_disp=${defaultdisplay} ubi.mtd=${nand} root=${mmcroot} rootfstype=${mmcrootfstype}; echo did set bootargs for mmc
mmcboot=
if run loadkernel
then
  run boot
fi
mmcbootz=echo Booting with DT from mmc${mmcdev} ...; run mmcargs; bootz ${loadaddr} - ${fdtaddr}
mmcdev=0
mmcroot=/dev/mmcblk0p2 rw
mmcrootfstype=ext4,ext3,btrfs rootwait
mpurate=auto
nand=4
nand_cmd=nand
nandargs=setenv bootargs console=${console} mpurate=${mpurate} mux=${mux} vram=${vram} omapfb.vram=${omapfbvram} omapfb.mode=dvi:${dvimode} omapfb.debug=y omapdss.def_disp=${defaultdisplay} ubi.mtd=${nand} root=${nandroot} rootfstype=${nandrootfstype}; echo did set bootargs for ${nand_cmd}
nandboot=
run kernelloading
if ${nand_cmd} read ${loadaddr} 280000 600000
then
  run nandargs
  run kernelloaded
  bootm ${loadaddr}
fi
nandroot=ubi0:gta04-rootfs
nandrootfstype=ubifs
omapfbvram=0:8M,1:4M
persistbootorder=
if status check 1
then
  saveenv
fi
ramargs=setenv bootargs console=${console} ${optargs} mpurate=${mpurate} buddy=${buddy} vram=${vram} omapfb.mode=dvi:${dvimode} omapdss.def_disp=${defaultdisplay} root=${ramroot} rootfstype=${ramrootfstype}
ramboot=echo Booting from ramdisk ...; run ramargs; bootm ${loadaddr}
ramdisk=ramdisk.gz
ramroot=/dev/ram0 rw ramdisk_size=65536 initrd=0x81000000,64M
ramrootfstype=ext2
rdaddr=0x81000000
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
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;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}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.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
scriptversion=20170424123721
showimg=run loadimg; lcm fb ${imgaddr};
soc=omap3
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi
usbtty=cdc_acm
userbutton=if gpio input 173; then run userbutton_xm; else run userbutton_nonxm; fi;
userbutton_nonxm=gpio input 7;
userbutton_xm=gpio input 4;
validatefdt=if test $beaglerev = xMAB; then if test ! -e mmc ${bootpart} ${bootdir}/${fdtfile}; then setenv fdtfile omap3-beagle-xm.dtb; fi; fi;
vendor=goldelico
vram=12M
root at letux:~#
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.goldelico.com/pipermail/letux-kernel/attachments/20170424/642571f6/attachment.asc>


More information about the Letux-kernel mailing list