美文网首页
Armbian分区布局和启动脚本

Armbian分区布局和启动脚本

作者: Armlinux | 来源:发表于2023-04-12 08:10 被阅读0次

1.分区布局

256(boot),-(data)

boot::256M:2  data::-1:4
===================================================================================
ID| name            |          offset|(   human)|            size|(   human)| masks
-----------------------------------------------------------------------------------
 0: bootloader                      0 (   0.00B)           400000 (   4.00M)      0
    (GAP)                                                 2000000 (  32.00M)
 1: reserved                  2400000 (  36.00M)          4000000 (  64.00M)      0
    (GAP)                                                  800000 (   8.00M)
 2: cache                     6c00000 ( 108.00M)                0 (   0.00B)      0
    (GAP)                                                  800000 (   8.00M)
 3: env                       7400000 ( 116.00M)           800000 (   8.00M)      0
    (GAP)                                                  800000 (   8.00M)
 4: boot                      8400000 ( 132.00M)         10000000 ( 256.00M)      2
    (GAP)                                                  800000 (   8.00M)
 5: data                     18c00000 ( 396.00M)        1bb400000 (   6.93G)      4
===================================================================================

aml_autoscript.cmd

if printenv bootfromsd; then exit; else setenv ab 0; fi;
setenv bootcmd 'run start_autoscript; run storeboot'
setenv start_autoscript 'if mmcinfo; then run start_mmc_autoscript; fi; if usb start; then run start_usb_autoscript; fi; run start_emmc_autoscript'
setenv start_emmc_autoscript 'for p in 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18; do if fatload mmc 1:${p} 1020000 emmc_autoscript; then autoscr 1020000; fi; done;'
setenv start_mmc_autoscript 'if fatload mmc 0 1020000 s905_autoscript; then autoscr 1020000; fi;'
setenv start_usb_autoscript 'for usbdev in 0 1 2 3; do if fatload usb ${usbdev} 1020000 s905_autoscript; then autoscr 1020000; fi; done'
setenv upgrade_step 2
saveenv
sleep 1
reboot

emmc_autoscript.cmd

for p in 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18; do if fatload mmc 1:${p} 0x1000000 u-boot.emmc; then go 0x1000000; fi; done
setenv dtb_addr 0x1000000
setenv env_addr 0x1040000
setenv kernel_addr 0x11000000
setenv initrd_addr 0x13000000
setenv boot_start booti ${kernel_addr} ${initrd_addr} ${dtb_addr}
setenv addmac 'if printenv mac; then setenv bootargs ${bootargs} mac=${mac}; elif printenv eth_mac; then setenv bootargs ${bootargs} mac=${eth_mac}; elif printenv ethaddr; then setenv bootargs ${bootargs} mac=${ethaddr}; fi'
for p in 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18; do if fatload mmc 1:${p} ${env_addr} uEnv.txt && env import -t ${env_addr} ${filesize}; setenv bootargs ${APPEND}; then if fatload mmc 1:${p} ${kernel_addr} ${LINUX}; then if fatload mmc 1:${p} ${initrd_addr} ${INITRD}; then if fatload mmc 1:${p} ${dtb_addr} ${FDT}; then run addmac; run boot_start; fi; fi; fi; fi; done; 

s905_autoscript.cmd

echo "start amlogic old u-boot"
if fatload mmc 0 ${loadaddr} boot_android; then if test ${ab} = 0; then setenv ab 1; saveenv; exit; else setenv ab 0; saveenv; fi; fi;
if fatload usb 0 ${loadaddr} boot_android; then if test ${ab} = 0; then setenv ab 1; saveenv; exit; else setenv ab 0; saveenv; fi; fi;
if fatload mmc 0 0x1000000 u-boot.ext; then go 0x1000000; fi;
if fatload usb 0 0x1000000 u-boot.ext; then go 0x1000000; fi;
setenv kernel_addr_r 0x11000000
setenv ramdisk_addr_r 0x13000000
setenv fdt_addr_r 0x1000000
setenv l_mmc "0"
for devtype in "mmc usb" ; do if test "${devtype}" = "usb"; then echo "start test usb"; setenv l_mmc "0 1 2 3"; fi; for devnum in ${l_mmc} ; do if test -e ${devtype} ${devnum} uEnv.txt; then fatload ${devtype} ${devnum} ${loadaddr} uEnv.txt; env import -t ${loadaddr} ${filesize}; setenv bootargs ${APPEND}; if printenv mac; then setenv bootargs ${bootargs} mac=${mac}; elif printenv eth_mac; then setenv bootargs ${bootargs} mac=${eth_mac}; fi; if fatload ${devtype} ${devnum} ${kernel_addr_r} ${LINUX}; then if fatload ${devtype} ${devnum} ${ramdisk_addr_r} ${INITRD}; then if fatload ${devtype} ${devnum} ${fdt_addr_r} ${FDT}; then fdt addr ${fdt_addr_r}; booti ${kernel_addr_r} ${ramdisk_addr_r} ${fdt_addr_r}; fi; fi; fi; fi; done; done;

打包脚本镜像

mkimage -A arm64 -O linux -T script -C none -d   s905_autoscript.cmd   s905_autoscript
mkimage -A arm64 -O linux -T script -C none -d   emmc_autoscript.cmd   emmc_autoscript
mkimage -A arm64 -O linux -T script -C none -d   aml_autoscript.cmd   aml_autoscript

fw_env.config

/dev/your_emmc_drive 0x7400000 0x10000 

安卓uboot配置信息实例

baudrate=115200
bootargs=rootfstype=ramfs init=/init console=ttyS0,115200 no_console_suspend earlyprintk=aml-uart,0xc81004c0 ramoops.mem_address=0x20000000 ramoops.mem_size=0x
100000 ramoops.record_size=0x8000 ramoops.console_size=0x4000 androidboot.selinux=permissive logo=osd1,loaded,0x3f800000,576cvbs hdmimode=1080p60hz cvbsmode=57
6cvbs hdmitx= androidboot.firstboot=0 mac=c4:2f:ad:XX:XX:XX
androidboot.mac=c4:2f:ad:XX:XX:XX
bootcmd=run storeboot
bootdelay=1
bootmode_check=get_rebootmode; echo reboot_mode=${reboot_mode};if test ${reboot_mode} = factory_reset; then defenv_reserv aml_dt;setenv upgrade_step 2; save;fi;
bootup_offset=0x1080240
bootup_size=0x3f4c8
cmdline_keys=if keyman init 0x1234; then if keyman read usid ${loadaddr} str; then setenv bootargs ${bootargs} androidboot.serialno=${usid};fi;if keyman read mac ${loadaddr} str; then setenv bootargs ${bootargs} mac=${mac} androidboot.mac=${mac};fi;if keyman read deviceid ${loadaddr} str; then setenv bootargs ${bootargs} androidboot.deviceid=${deviceid};fi;fi;
cvbsmode=576cvbs
display_bpp=16
display_color_bg=0
display_color_fg=0xffff
display_color_index=16
display_height=576
display_layer=osd1
display_width=720
dtb_mem_addr=0x1000000
edid.crcvalue=0xe2070000
ethact=Meson_Ethernet
ethaddr=00:15:18:01:81:31
factory_reset_poweroff_protect=echo wipe_data=${wipe_data}; echo wipe_cache=${wipe_cache};if test ${wipe_data} = failed; then run init_display; run storeargs;if mmcinfo; then run recovery_from_sdcard;fi;if usb start 0; then run recovery_from_udisk;fi;run recovery_from_flash;fi; if test ${wipe_cache} = failed; then run init_display; run storeargs;if mmcinfo; then run recovery_from_sdcard;fi;if usb start 0; then run recovery_from_udisk;fi;run recovery_from_flash;fi;
fb_addr=0x3f800000
fb_height=1080
fb_width=1920
fdt_high=0x20000000
firstboot=0
gatewayip=10.18.9.1
hdmimode=1080p60hz
hostname=arm_gxbb
identifyWaitTime=750
init_display=hdmitx hpd;osd open;osd clear;vout output ${outputmode};imgread pic logo bootup $loadaddr;bmp display $bootup_offset;bmp scale
initargs=rootfstype=ramfs init=/init console=ttyS0,115200 no_console_suspend earlyprintk=aml-uart,0xc81004c0 ramoops.mem_address=0x20000000 ramoops.mem_size=0x100000 ramoops.record_size=0x8000 ramoops.console_size=0x4000 androidboot.selinux=permissive
ipaddr=10.18.9.97
irremote_update=if irkey 0xe31cfb04 0xb748fb04 2500000; then echo read irkey ok!; if itest ${irkey_value} == 0xe31cfb04; then run update;else if itest ${irkey_value} == 0xb748fb04; then run update;\fi;fi;fi;
loadaddr=1080000
mac=c4:2f:ad:xx:xx:xx
netmask=255.255.255.0
outputmode=576cvbs
preboot=run factory_reset_poweroff_protect;run upgrade_check;run bootmode_check;run init_display;run storeargs;run upgrade_key;run upgrade_sadckey;run switch_b
ootmode;
reboot_mode=cold_boot
recovery_from_flash=if imgread kernel recovery ${loadaddr}; then wipeisb; bootm ${loadaddr}; fi recovery_from_sdcard=if fatload mmc 0 ${loadaddr} aml_autoscript; then autoscr ${loadaddr}; fi;if fatload mmc 0 ${loadaddr} recovery.img; then if fatload mmc 0
 ${dtb_mem_addr} dtb.img; then echo sd dtb.img loaded; fi;wipeisb; bootm ${loadaddr};fi;
recovery_from_udisk=if fatload usb 0 ${loadaddr} aml_autoscript; then autoscr ${loadaddr}; fi;if fatload usb 0 ${loadaddr} recovery.img; then if fatload usb 0
${dtb_mem_addr} dtb.img; then echo udisk dtb.img loaded; fi;wipeisb; bootm ${loadaddr};fi;
sdc_burning=sdc_burn ${sdcburncfg}
sdcburncfg=aml_sdc_burn.ini
serverip=10.18.9.113
set=environment variables
stderr=serial
stdin=serial
stdout=serial
storeargs=setenv bootargs ${initargs} logo=${display_layer},loaded,${fb_addr},${outputmode} hdmimode=${hdmimode} cvbsmode=${cvbsmode} hdmitx=${cecconfig} andro
idboot.firstboot=${firstboot}; run cmdline_keys;
storeboot=echo Booting...; if unifykey get usid; then  setenv bootargs ${bootargs} androidboot.serialno=${usid};fi;if unifykey get mac; then setenv bootargs ${
bootargs} mac=${ethaddr};fi;if imgread kernel boot ${loadaddr}; then store dtb read $dtb_mem_addr; bootm ${loadaddr}; fi;run update;
switch_bootmode=get_rebootmode;if test ${reboot_mode} = factory_reset; then run recovery_from_flash;else if test ${reboot_mode} = update; then run update;else
if test ${reboot_mode} = cold_boot; then run try_auto_burn; fi;fi;fi;
try_auto_burn=update 700 750;
update=run usb_burning; run sdc_burning; if mmcinfo; then run recovery_from_sdcard;fi;if usb start 0; then run recovery_from_udisk;fi;run recovery_from_flash;
upgrade_check=echo upgrade_step=${upgrade_step}; if itest ${upgrade_step} == 3; then run init_display; run storeargs; run update;else if itest ${upgrade_step}
== 1; then defenv_reserv; setenv upgrade_step 2; saveenv;fi;fi;
upgrade_key=if gpio input GPIOAO_3; then echo detect upgrade key; run update;fi;
upgrade_sadckey=saradc open 0; if saradc get_in_range 0 0x50; then sleep 1; if saradc get_in_range 0 0x50; then echo update by key...; run update; fi;fi;
upgrade_step=2
usb_burning=update 1000
wipe_cache=successful
wipe_data=successful

后面u-boot部分摘自https://www.bbsmax.com/A/8Bz8Q17yJx/

相关文章

  • armbian开机自启动配置

    安装armbian系统,开机启动脚本rc.local 默认是不启动,不管在里面添加了什么脚本都是不管用的,需要按如...

  • Armbian 分区优化

    问题Android 电视盒刷 Armbian,分区时,EMMC 前面一部分没被利用,为什么?以及怎么办? 原因u-...

  • 制作USB安装盘

    使用grub2制作启动U盘 原理概述:将U盘格式为GPT类型的分区,添加bios引导支持的启动分区和EFI引导分区...

  • CSS布局&居中贴士

    CSS布局小贴士 左右布局实现 使用浮动float可将左部分区域和右部分区域的float属性都设置为left,然后...

  • 修改引导启动分区位置

    引导启动分区(即磁盘分区表DPT以80开头的分区表项),作为引导计算机启动的分区,一般默认第一分区为引导启动分区,...

  • Mongodb启动和关闭脚本化.md

    Mongodb停止和启动脚本 见下面代码mongostop 停止脚本 见下面代码mongostart 启动脚本 可...

  • Linux 根文件夹下各个文件夹的作用

    bin 可执行文件,存放在最经常使用的命令和脚本 boot 引导分区,Linux 系统启动时的引导程序,包括一些连...

  • 使用web容器启动job服务

    脚本启动要写前置脚本和后置脚本,使用tomcat启动没那么多事,只要配置web.xml在启动的时候加载spring...

  • Hive01

    Hive 启动 Hive 启动方式 建表语法【单分区】示例: 加载【单分区】数据示例: 【多分区】示例: 加载【多...

  • 斐讯N1刷Ubuntu系统配置SMB

    修改armbian的源 安装samba 添加用户 挂载移动硬盘 建立挂载目录,有几个分区就建立几个目录,可以1,2...

网友评论

      本文标题:Armbian分区布局和启动脚本

      本文链接:https://www.haomeiwen.com/subject/stbnddtx.html