Exemple #1
0
            public MemoryStream Uboot(UbootType type = UbootType.SD)
            {
                var ubootStream = ArchiveFile("boot/uboot.bin");

                if (type == UbootType.SD)
                {
                    ubootStream.Seek(-8, SeekOrigin.End);
                    byte[] sdMarker = new byte[8];
                    ubootStream.Read(sdMarker, 0, sdMarker.Length);
                    ubootStream.Seek(-8, SeekOrigin.End);
                    ubootStream.Write(sdMarker, 4, 4);
                    ubootStream.Write(sdMarker, 0, 4);
                    ubootStream.Seek(0, SeekOrigin.Begin);
                }
                return(ubootStream);
            }
Exemple #2
0
        public static TaskFunc FlashUboot(UbootType type)
        {
            return((Tasker tasker, Object syncObject) =>
            {
                tasker.SetStatus(Resources.FlashingUboot);

                MemoryStream flashLog = new MemoryStream();
                var splitStream = new SplitterStream(flashLog).AddStreams(Program.debugStreams);
                if (hakchi.Shell.Execute($"sntool sd {(type == UbootType.SD ? "enable" : "disable")}", null, splitStream, splitStream) != 0)
                {
                    flashLog.Seek(0, SeekOrigin.Begin);
                    using (var sr = new StreamReader(flashLog))
                    {
                        throw new Exception(sr.ReadToEnd());
                    }
                }
                return Conclusion.Success;
            });
        }
Exemple #3
0
 public static MemoryStream GetUboot(UbootType type = UbootType.SD) => Get().Uboot(type);