制作UEF 的启动盘

  • .启动文件可以通过编译ShellPkg/ShellPkg.dsc得到,制作UEFI BIOS启动盘后就可以把自己的app或者驱动放到UEFI 启动盘的U盘上,然后进行load进行运行调试,可以省去把驱动下载到板子上的步骤,方便调试硬件。
source edk_setup.sh
build -p ShellPkg/ShellPkg.dsc -t GCC5 -b RELEASE -a X64
# -p 要编译的包
# -t 选择的工具链
# -b 目标类型
# -a 架构类型

可以得到Shell.efi
编译的过程中可能出现Shell.dll权限不足的问题,可以用chmod 777 Shell.dll进行更改权限即可编译通过
制作shell 启动盘
1)将U盘格式化为FAT32(FAT/FAT16也可以),可以用软碟通,随便烧录个镜像,然后再清除下里面内容
2)在U盘的根目录建立efi\boot文件夹
3)将刚生成32/64位Shell.efi改为bootx32.efi或者bootx64.efi,并复制到U盘的efi\boot目录下
将做好的U盘插入到计算机,开机从U盘启动,即可进入UEFI Shell环境了。
在这里插入图片描述

然后输入fs0:
就可以进入U盘路径,然后可以用命令load My_driver.efi或者loadpcirom My_Oprom.rom进行驱动的加载调试,如果不涉及到硬件的话,可以直接在虚拟机中进行调试。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
private final CharSequence getSmallTime() { Context context = getContext(); boolean is24 = DateFormat.is24HourFormat(context); LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale); final char MAGIC1 = '\uEF00'; final char MAGIC2 = '\uEF01'; SimpleDateFormat sdf; String format = is24 ? d.timeFormat24 : d.timeFormat12; // Add seconds to the format string format += ":ss"; if (!format.equals(mClockFormatString)) { /* * Search for an unquoted "a" in the format string, so we can * add dummy characters around it to let us find it again after * formatting and change its size. */ if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) { int a = -1; boolean quoted = false; for (int i = 0; i < format.length(); i++) { char c = format.charAt(i); if (c == ''') { quoted = !quoted; } if (!quoted && c == 'a') { a = i; break; } } if (a >= 0) { // Move a back so any whitespace before AM/PM is also in the alternate size. final int b = a; while (a > 0 && Character.isWhitespace(format.charAt(a-1))) { a--; } format = format.substring(0, a) + MAGIC1 + format.substring(a, b) + "a" + MAGIC2 + format.substring(b + 1); } } mClockFormat = sdf = new SimpleDateFormat(format); mClockFormatString = format; } else { sdf = mClockFormat; } String result = sdf.format(mCalendar.getTime()); if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) { int magic1 = result.indexOf(MAGIC1); int magic2 = result.indexOf(MAGIC2); if (magic1 >= 0 && magic2 > magic1) { SpannableStringBuilder formatted = new SpannableStringBuilder(result); if (AM_PM_STYLE == AM_PM_STYLE_GONE) { formatted.delete(magic1, magic2+1); } else { if (AM_PM_STYLE == AM_PM_STYLE_SMALL) { CharacterStyle style = new RelativeSizeSpan(0.7f); formatted.setSpan(style, magic1, magic2, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); } formatted.delete(magic2, magic2 + 1); formatted.delete(magic1, magic1 + 1); } return formatted; } } return result;}如何实时更新秒
06-08
可以通过使用定时器或者Handler来实现每秒更新一次秒数。具体实现方法如下: 1.在构造函数或onCreate()方法中初始化定时器或Handler。 2.定时器或Handler中的回调方法中,调用invalidate()方法刷新UI界面。 示例代码如下: ``` private final CharSequence getSmallTime() { Context context = getContext(); boolean is24 = DateFormat.is24HourFormat(context); LocaleData d = LocaleData.get(context.getResources().getConfiguration().locale); final char MAGIC1 = '\uEF00'; final char MAGIC2 = '\uEF01'; SimpleDateFormat sdf; String format = is24 ? d.timeFormat24 : d.timeFormat12; // Add seconds to the format string format += ":ss"; if (!format.equals(mClockFormatString)) { /* * Search for an unquoted "a" in the format string, so we can * add dummy characters around it to let us find it again after * formatting and change its size. */ if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) { int a = -1; boolean quoted = false; for (int i = 0; i < format.length(); i++) { char c = format.charAt(i); if (c == ''') { quoted = !quoted; } if (!quoted && c == 'a') { a = i; break; } } if (a >= 0) { // Move a back so any whitespace before AM/PM is also in the alternate size. final int b = a; while (a > 0 && Character.isWhitespace(format.charAt(a-1))) { a--; } format = format.substring(0, a) + MAGIC1 + format.substring(a, b) + "a" + MAGIC2 + format.substring(b + 1); } } mClockFormat = sdf = new SimpleDateFormat(format); mClockFormatString = format; } else { sdf = mClockFormat; } mCalendar.setTimeInMillis(System.currentTimeMillis()); // 更新Calendar对象 String result = sdf.format(mCalendar.getTime()); if (AM_PM_STYLE != AM_PM_STYLE_NORMAL) { int magic1 = result.indexOf(MAGIC1); int magic2 = result.indexOf(MAGIC2); if (magic1 >= 0 && magic2 > magic1) { SpannableStringBuilder formatted = new SpannableStringBuilder(result); if (AM_PM_STYLE == AM_PM_STYLE_GONE) { formatted.delete(magic1, magic2+1); } else { if (AM_PM_STYLE == AM_PM_STYLE_SMALL) { CharacterStyle style = new RelativeSizeSpan(0.7f); formatted.setSpan(style, magic1, magic2, Spannable.SPAN_EXCLUSIVE_INCLUSIVE); } formatted.delete(magic2, magic2 + 1); formatted.delete(magic1, magic1 + 1); } return formatted; } } return result; } ``` 在构造函数或onCreate()方法中添加以下代码: ``` // 定义Handler private Handler mHandler = new Handler(); // 定义Runnable private Runnable mRunnable = new Runnable() { @Override public void run() { invalidate(); // 刷新UI界面 mHandler.postDelayed(mRunnable, 1000); // 每秒执行一次 } }; // 在构造函数或onCreate()方法中启动定时器 mHandler.postDelayed(mRunnable, 1000); ``` 这样就可以实现每秒更新秒数了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值